[wp-trac] [WordPress Trac] #47438: do_action will convert "single array object" as "object"
WordPress Trac
noreply at wordpress.org
Thu May 30 19:42:28 UTC 2019
#47438: do_action will convert "single array object" as "object"
--------------------------+-----------------------------
Reporter: erikdemarco | Owner: (none)
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: General | Version: 5.1.1
Severity: normal | Keywords:
Focuses: |
--------------------------+-----------------------------
{{{
/* Correct if $object is not object*/
$orders = array();
$orders[] = 'abc';
do_action( 'action123', $orders);
add_action('action123', 'func123');
function func123($orders){
//$orders will be array here (CORRECT)
}
/* BUG: if $orders is an object */
$orders = array();
$orders[]=new stdClass();
$orders->name='Order1';
do_action( 'action123', $orders);
add_action('action123', 'func123');
function func123($orders){
//$orders will be non-array here (BUG?)
}
}}}
Note:
This will run correctly if $orders[] is not object
--
Ticket URL: <https://core.trac.wordpress.org/ticket/47438>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list