Make WordPress Core

Changes between Initial Version and Version 2 of Ticket #60190


Ignore:
Timestamp:
01/04/2024 06:44:57 AM (13 months ago)
Author:
sabernhardt
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #60190

    • Property Keywords has-patch has-unit-tests added
  • Ticket #60190 – Description

    initial v2  
    11
    2 ```php
     2{{{#!php
    33do_action( 'foo', array( (object) null ) );
    44
    55function foo_cb( array $arg ) {}
    66add_action( 'foo', 'foo_cb' );
    7 ```
     7}}}
    88
    99This will fail with a fatal error in PHP 7+, since `do_action` (as the only one, this isn't an issue with `apply_filters` or `do_action_ref_array`) will convert arrays with only 1 object into that object.
    10 The reason for that is some PHP 4 legacy behavior, see https://core.trac.wordpress.org/ticket/48312
     10The reason for that is some PHP 4 legacy behavior, see #48312
    1111
    1212It's time to drop this PHP 4 support, as this prevent using native types in callback functions in cases where the argument is an array of objects.