[wp-trac] [WordPress Trac] #60190: Drop PHP 4 support for arrays with 1 object element

WordPress Trac noreply at wordpress.org
Wed Feb 7 18:42:25 UTC 2024


#60190: Drop PHP 4 support for arrays with 1 object element
--------------------------------------+------------------------------
 Reporter:  kkmuffme                  |       Owner:  (none)
     Type:  defect (bug)              |      Status:  new
 Priority:  normal                    |   Milestone:  Awaiting Review
Component:  Plugins                   |     Version:  trunk
 Severity:  normal                    |  Resolution:
 Keywords:  has-patch has-unit-tests  |     Focuses:
--------------------------------------+------------------------------

Comment (by kkmuffme):

 As outlined in OP it will lead to a fatal if any callback uses PHP native
 types for array; you'll get:
 >Fatal error: Uncaught TypeError: ... must be of type array, stdClass
 given

 Now you could say: just use a union type array|object, but that is:
 a) only available since PHP 8+
 b) unnecessarily weakening the PHP type system to keep PHP 4 compat that
 has been deprecated since a decade at this point.

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


More information about the wp-trac mailing list