[wp-trac] [WordPress Trac] #50343: [PHP 8] Fix deprecation notices for optional function parameters declared before required parameter.

WordPress Trac noreply at wordpress.org
Fri Aug 14 13:04:17 UTC 2020


#50343: [PHP 8] Fix deprecation notices for optional function parameters declared
before required parameter.
-------------------------------------------+-------------------------------
 Reporter:  ayeshrajans                    |       Owner:  SergeyBiryukov
     Type:  enhancement                    |      Status:  reviewing
 Priority:  normal                         |   Milestone:  5.6
Component:  General                        |     Version:
 Severity:  normal                         |  Resolution:
 Keywords:  has-patch php8 has-unit-tests  |     Focuses:  coding-standards
-------------------------------------------+-------------------------------

Comment (by ayeshrajans):

 Thanks for picking up this one, @jrf, it's nice to see we getting an early
 start for PHP 8!

 As for the approach of making these problematic functions drop their
 default values, PHP 7.1 and later throw `ArgumentCountError`< so users are
 already aware of this. However, for PHP 5.6 and 7.0 only raise a warning
 if the user does not pass a required parameter: https://3v4l.org/o1TKv

 I think dropping the default values can have non-zero number of users who
 might have ignored the warning, but get an exception in WordPress 5.6.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/50343#comment:9>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list