Changeset 46568
- Timestamp:
- 10/22/2019 12:09:39 AM (5 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/plugin.php
r46451 r46568 471 471 if ( empty( $arg ) ) { 472 472 $arg[] = ''; 473 } elseif ( is_array( $arg[0] ) && 1 === count( $arg[0] ) && isset( $arg[0][0] ) && is_object( $arg[0][0] ) ) { 474 // Backward compatibility for PHP4-style passing of `array( &$this )` as action `$arg`. 475 $arg[0] = $arg[0][0]; 473 476 } 474 477 -
trunk/tests/phpunit/tests/actions.php
r42343 r46568 152 152 $argsvar3 = $a3->get_args(); 153 153 $this->assertEquals( array( $val1, $val2 ), array_pop( $argsvar3 ) ); 154 } 155 156 /** 157 * Tests PHP 4 notation for calling actions while passing in an object by reference. 158 * 159 * @ticket 48312 160 */ 161 function test_action_args_with_php4_syntax() { 162 $a = new MockAction(); 163 $tag = __FUNCTION__; 164 $val = new stdClass; 165 166 add_action( $tag, array( &$a, 'action' ) ); 167 // Ñall the action with PHP 4 notation for passing object by reference. 168 do_action( $tag, array( &$val ) ); 169 170 $call_count = $a->get_call_count(); 171 $argsvar = $a->get_args(); 172 $this->assertSame( array( $val ), array_pop( $argsvar ) ); 154 173 } 155 174
Note: See TracChangeset
for help on using the changeset viewer.