mirror of
https://github.com/php/php-src.git
synced 2024-09-22 02:17:32 +00:00
902d64390e
Writing to a proprety that hasn't been declared is deprecated, unless the class uses the #[AllowDynamicProperties] attribute or defines __get()/__set(). RFC: https://wiki.php.net/rfc/deprecate_dynamic_properties
30 lines
556 B
PHP
30 lines
556 B
PHP
--TEST--
|
|
In $a->$b[Y]() and $a->X[Y]() both $a->$b[Y] and $a->X[Y] represent a global function name
|
|
--FILE--
|
|
<?php
|
|
class C {
|
|
public $functions;
|
|
}
|
|
|
|
function foo($a, $b) {
|
|
echo "Called global foo($a, $b)\n";
|
|
}
|
|
|
|
$name = 'functions';
|
|
|
|
$c = new C;
|
|
$c->functions[0] = 'foo';
|
|
$c->functions[1][2][3][4] = 'foo';
|
|
|
|
$c->$name[0](1, 2);
|
|
$c->$name[1][2][3][4](3, 4);
|
|
|
|
$c->functions[0](5, 6);
|
|
$c->functions[1][2][3][4](7, 8);
|
|
?>
|
|
--EXPECT--
|
|
Called global foo(1, 2)
|
|
Called global foo(3, 4)
|
|
Called global foo(5, 6)
|
|
Called global foo(7, 8)
|