Making WordPress.org

Opened 4 weeks ago

Last modified 4 weeks ago

#7749 new defect (bug)

Convert assignment statement in Parser class to make compatible to PHP 7.2

Reported by: rabmalin's profile rabmalin Owned by:
Milestone: Priority: normal
Component: Plugin Directory Keywords: close 2nd-opinion
Cc:

Description

We are using Readme Parser class in a plugin whose minimum supported PHP is 7.2.

In this class, following in the only statement which is not supported in PHP 7.2

I am creating this ticket requesting to rewrite following line of code to make it compatible to PHP 7.2

$this->warnings['contributor_ignored'] ??= [];

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

The null coalesce equal operator (??=) is not present in PHP version 7.3 or earlier (PHPCompatibility.Operators.NewOperators.t_coalesce_equalFound)

Change History (4)

#1 @Otto42
4 weeks ago

We don't need it to be compatible because we run PHP 7.4 on wordpress.org.

#2 @dd32
4 weeks ago

  • Keywords close 2nd-opinion added

I think I'd prefer to keep it targeting PHP 7.4, and PHP 8.1 in the not-too-distant-future.

Being able to re-use the plugin readme code in the plugin-check plugin is useful, I admit though.

This ticket was mentioned in Slack in #meta by dd32. View the logs.


4 weeks ago

#4 @afragen
4 weeks ago

I see the plugin readme parser as any other library with a requirement. If you want to use it unmodified, you may need to update the requirements of your project.

Also, like any other class you can extend it and write a modified version of the function for you needs. Yes, that is more work.

Note: See TracTickets for help on using tickets.