Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Note: To minimize the impact on the rest of the Fieldmanager fields, this change is localized to the TextArea field, since that appears to be where the issue is occurring.
Fixes Issue
PHP Deprecated: htmlspecialchars(): Passing null to parameter #1 ($string) of type string is deprecated
Description of Change
To address the issue of PHP deprecation errors when a
default_valuefield is not set and defaults tonull, we have modified the logic in the printing of fields within the WP admin area. Specifically, in scenarios where a default value is not set, which leads to anullreturn value, a ternary operation or a direct assignment now ensures thatesc_textareareceives an empty string instead ofnull. This change preventshtmlspecialchars()from throwing a deprecation notice due to receiving anullvalue.The modification was implemented in the handling of default values within the
Fieldmanager_TextAreaclass to circumvent the deprecation notice. It's crucial to emphasize that the default behavior for handling default values remains unaltered to prevent unintended side effects in other areas of the application.Use Case Affected
This change impacts any site using fields that extend
Fieldmanager_TextArea, specifically in scenarios where thedefault_valueis not explicitly set. The new default value will be an empty string and notnullas it was previously.Comments/Suggestions
Fieldmanager_Textareaclass to address this deprecation issue.Acceptance Criteria
nullreturn value,esc_textareawill now receive an empty string instead ofnull.