Making WordPress.org

Opened 3 months ago

Closed 3 months ago

#7421 closed defect (bug) (fixed)

PHP Deprecated notice in Readme Parser

Reported by: rabmalin's profile rabmalin Owned by: dd32's profile dd32
Milestone: Priority: normal
Component: Plugin Directory Keywords:
Cc:

Description

PHP: 8.2

Ref: https://github.com/WordPress/wordpress.org/blob/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/readme/class-parser.php#L247

When checked with minimal text file, $line could be empty. So PHP notice is generated.

Example error message for reference:

Deprecated: str_contains(): Passing null to parameter #1 ($haystack) of type string is deprecated in /var/www/html/wp-content/plugins/plugin-check/vendor/afragen/wordpress-plugin-readme-parser/class-parser.php on line 247
Deprecated: str_contains(): Passing null to parameter #1 ($haystack) of type string is deprecated in /var/www/html/wp-content/plugins/plugin-check/vendor/afragen/wordpress-plugin-readme-parser/class-parser.php on line 247

Sample readme file:

=== Hello World ===

Change History (1)

#1 @dd32
3 months ago

  • Owner set to dd32
  • Resolution set to fixed
  • Status changed from new to closed

In 13148:

Plugin Directory: Readme Parser: Avoid a PHP Deprecation notice by always returning a string.

Fixes #7421.

Note: See TracTickets for help on using tickets.