Skip to content

Commit b022645

Browse files
authored
Fix deprecated explode() warning with null parameter (#2137)
1 parent f9a1941 commit b022645

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
Significance: patch
2+
Type: fixed
3+
4+
Fix PHP warning when saving ActivityPub settings.

includes/class-sanitize.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ class Sanitize {
2222
*/
2323
public static function url_list( $value ) {
2424
if ( ! \is_array( $value ) ) {
25-
$value = \explode( PHP_EOL, $value );
25+
$value = \explode( PHP_EOL, (string) $value );
2626
}
2727

2828
$value = \array_filter( $value );
@@ -45,7 +45,7 @@ public static function url_list( $value ) {
4545
*/
4646
public static function identifier_list( $value ) {
4747
if ( ! \is_array( $value ) ) {
48-
$value = \explode( PHP_EOL, $value );
48+
$value = \explode( PHP_EOL, (string) $value );
4949
}
5050

5151
$value = \array_filter( $value );
@@ -84,7 +84,7 @@ public static function identifier_list( $value ) {
8484
* @return string The sanitized list of hosts.
8585
*/
8686
public static function host_list( $value ) {
87-
$value = \explode( PHP_EOL, $value );
87+
$value = \explode( PHP_EOL, (string) $value );
8888
$value = \array_map(
8989
function ( $host ) {
9090
$host = \trim( $host );
@@ -113,7 +113,7 @@ function ( $host ) {
113113
*/
114114
public static function blog_identifier( $value ) {
115115
// Hack to allow dots in the username.
116-
$parts = \explode( '.', $value );
116+
$parts = \explode( '.', (string) $value );
117117
$sanitized = \array_map( 'sanitize_title', $parts );
118118
$sanitized = \implode( '.', $sanitized );
119119

0 commit comments

Comments
 (0)