Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove trailing commas in parameters to avoid syntax error with some PHP versions (ex. 7.2.x) #604

Merged
merged 1 commit into from
Apr 25, 2024

Conversation

KZeni
Copy link
Contributor

@KZeni KZeni commented Apr 25, 2024

What?

Per the title of this PR, this simply removes 2 instances of trailing commas when listing out parameters as that causes a syntax error (resulting in a site-wide fatal server error) for sites using PHP 7.2.x (and potentially other versions.) These commas aren't being used for anything anyway while PHP was made to be oddly strict about these unlike arrays & unlike other PHP versions so it's best just not to include them. This was also mentioned at: https://wordpress.org/support/topic/fatal-server-error-on-certain-php-versions-with-0-9-0-plugin-version/

Why?

Fixes a potential syntax error that results in a fatal server error for PHP 7.2.x & potentially other PHP versions.

How?

Removing the trailing comma from parameters fixes the syntax error while the commas weren't doing anything anyway.

Testing Instructions

Having a WordPress site on PHP 7.2.x and then using the 0.9.0 release of this plugin should have a fatal server error come up as a result.

Changelog Entry

  • Fixed - Bug fix for specific PHP versions (removed trailing commas from parameters.)

Copy link
Collaborator

@kasparsd kasparsd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is great, thank you so much!

@kasparsd kasparsd merged commit 5ec52bb into WordPress:master Apr 25, 2024
1 check passed
@KZeni
Copy link
Contributor Author

KZeni commented Apr 25, 2024

Happy to help!

This was also mentioned over on the https://wordpress.org/support/topic/fatal-server-error-on-certain-php-versions-with-0-9-0-plugin-version/ support forum topic, but it might be worth mentioning here as well.

Hopefully, this is just a quick 0.9.1 (or even a 0.9.0.1 version) release fix so fewer sites update to the potentially problematic 0.9.0 version, and one can just be mindful of and/or test for trailing commas like this before releasing future versions. Alternatively, 0.9.1 (or 0.9.0.1) could be released as the last version that supports these older PHP versions (includes this quick fix) while then the next version release sets the PHP requirement to something above PHP 7.2 to avoid needing to worry about this (although that'd be more strict than WordPress' core requirements, currently.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants