-
Notifications
You must be signed in to change notification settings - Fork 99
PHP Deprecated: htmlspecialchars(): Passing null to parameter #1 ($string) of type string is deprecated #863
Copy link
Copy link
Closed
Labels
enhancementNew feature or requestNew feature or requestphpRequires understanding PHPRequires understanding PHP
Description
Description
Currently, if one does not set a default_value field, it defaults to null, and a site returns this following PHP deprecation error.
[27-Jan-2024 18:07:59 UTC] PHP Deprecated: htmlspecialchars(): Passing null to parameter #1 ($string) of type string is deprecated in /var/www/site/wp-includes/formatting.php on line 4715
The issue happens here:
| esc_textarea( $value ) |
Use Case
A site with fields that extend Fieldmanager_Field:
add_action( 'fm_post_post', function() {
$fm_title = new Fieldmanager_Textarea(
[
'name' => 'newsletter_excerpt',
'description' => __( 'Excerpt to be included in json feed for use in newsletters', 'example-site' ),
]
);
$fm_title->add_meta_box( __( 'Newsletter Excerpt', 'example-site' ), $post_types, 'normal', 'high' );
} );
Acceptance Criteria
- Modify the logic that prints the field in WP admin so that if a default value is not set, and it returns
null, thenesc_textareadoes not receive a value ofnull(either use a ternary to print an empty string, or pass an empty string toesc_textarea- do not modify the default value generally, since that could have other effects elsewhere that we want to avoid).
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or requestphpRequires understanding PHPRequires understanding PHP