Drop php4 support for do action first arg array object type in favor of better support of PHP7+ native types#5839
Conversation
b57f606 to
d7c7c28
Compare
Test using WordPress PlaygroundThe changes in this pull request can previewed and tested using a WordPress Playground instance. WordPress Playground is an experimental project that creates a full WordPress instance entirely within the browser. Some things to be aware of
For more details about these limitations and more, check out the Limitations page in the WordPress Playground documentation. |
johnbillion
left a comment
There was a problem hiding this comment.
Can you provide some new unit tests that demonstrate the benefit of this change? What can be done after this change that can't be done currently?
d7c7c28 to
a8e2d9e
Compare
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the Core Committers: Use this line as a base for the props when committing in SVN: To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
6da0392 to
f9bff26
Compare
f9bff26 to
25ed69e
Compare
|
Yes, I added a test now (which would result in a fatal error without this PR on standard WP 6.5) |
| } | ||
|
|
||
| if ( empty( $arg ) ) { | ||
| if ( array() === $arg ) { |
There was a problem hiding this comment.
Probably missing something but this change doesn't seem to be part of the trac ticket?
This changes the behavior for false, null, 0, etc. (all things considered "empty" in PHP). After this patch $arg will not be an empty string in these cases, right? Thinking this is a potentially big back-compat break, and also not part of the proposed fix as in the trac ticket.
If this is intentional please open a new ticket with reasoning why this is needed and tests to confirm the back-compat issues it may introduce.
There was a problem hiding this comment.
$arg is a variadic parameter which means it'll only ever be an array. This change could have been made as part of r46322.
Drop PHP 4 support for
do_actionwith 1 array argument where the array contains only 1 element, in favor of better support for PHP 7+ native typesTrac ticket: https://core.trac.wordpress.org/ticket/60190