Skip to content

Commit 22c142d

Browse files
committed
Fix PHP 8.6 compatibility: pass explicit $characters arg to trim()
1 parent e0ec141 commit 22c142d

4 files changed

Lines changed: 7 additions & 7 deletions

File tree

‎class-settings.php‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1238,7 +1238,7 @@ public static function taxonomy_search_tom_select() {
12381238
$search_term = explode( ',', $search_term );
12391239
$search_term = $search_term[ count( $search_term ) - 1 ];
12401240
}
1241-
$search_term = trim( $search_term );
1241+
$search_term = trim( $search_term, " \t\n\r\0\x0B" );
12421242

12431243
if ( 'meta_keys' === $endpoint ) {
12441244
if ( ! current_user_can( 'manage_options' ) ) {

‎settings/class-settings-api.php‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -659,7 +659,7 @@ public function admin_init() {
659659

660660
// Tag header rows so the settings search can group fields under them.
661661
if ( 'header' === $type ) {
662-
$args['class'] = trim( ( $args['class'] ?? '' ) . ' wz-settings-header-row' );
662+
$args['class'] = trim( ( $args['class'] ?? '' ) . ' wz-settings-header-row', " \t\n\r\0\x0B" );
663663
}
664664

665665
add_settings_field(

‎settings/class-settings-form.php‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ protected function get_default_description( $args ) {
105105
if ( is_array( $default ) ) {
106106
$default = implode( ',', array_map( 'strval', $default ) );
107107
}
108-
$default = trim( (string) $default );
108+
$default = trim( (string) $default, " \t\n\r\0\x0B" );
109109

110110
// Map option keys to their labels where the field has a choices list.
111111
if ( ! empty( $args['options'] ) && is_array( $args['options'] ) ) {
@@ -123,7 +123,7 @@ protected function get_default_description( $args ) {
123123
} elseif ( '' !== $default && 'multicheck' === $type ) {
124124
$labels = array();
125125
foreach ( explode( ',', $default ) as $key ) {
126-
$key = trim( $key );
126+
$key = trim( $key, " \t\n\r\0\x0B" );
127127
$labels[] = isset( $args['options'][ $key ] ) && is_string( $args['options'][ $key ] ) ? $args['options'][ $key ] : $key;
128128
}
129129
$default = implode( ', ', $labels );
@@ -195,7 +195,7 @@ protected function is_field_modified( $args ) {
195195
return $this->normalize_list_value( $value ) !== $this->normalize_list_value( $default );
196196
}
197197

198-
return trim( (string) $value ) !== trim( (string) $default );
198+
return trim( (string) $value, " \t\n\r\0\x0B" ) !== trim( (string) $default, " \t\n\r\0\x0B" );
199199
}
200200

201201
/**
@@ -279,7 +279,7 @@ protected function get_field_class( $args, $default_class = '' ) {
279279
if ( $default_class ) {
280280
$class = $default_class . ' ' . $class;
281281
}
282-
return trim( $class );
282+
return trim( $class, " \t\n\r\0\x0B" );
283283
}
284284

285285
/**

‎util/class-hook-registry.php‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ public static function register( string $hook_type, string $hook_name, callable
4040
if ( ! in_array( $hook_type, array( 'action', 'filter' ), true ) ) {
4141
return false;
4242
}
43-
if ( empty( trim( $hook_name ) ) ) {
43+
if ( empty( trim( $hook_name, " \t\n\r\0\x0B" ) ) ) {
4444
return false;
4545
}
4646
if ( $priority < 0 ) {

0 commit comments

Comments
 (0)