diff --git a/src/Php/CompilerBase.php b/src/Php/CompilerBase.php index d0ec6159..2aa627e1 100644 --- a/src/Php/CompilerBase.php +++ b/src/Php/CompilerBase.php @@ -3151,7 +3151,7 @@ class CompilerBase extends \PhpAot\Core\Translator protected function parseGlobal(Node\Stmt\Global_ $v): string { foreach ($v->vars as $v) { - $name = $this->escapeVarName($v->name); + $name = $this->escapeVarName($this->parseVariable($v)); if (!$this->hasGlobalVar($name)) { $this->addGlobalVar($name, self::TYPE_VAR); } diff --git a/tests/core/lang/bug24499.phpt b/tests/core/lang/bug24499.phpt new file mode 100644 index 00000000..128b062a --- /dev/null +++ b/tests/core/lang/bug24499.phpt @@ -0,0 +1,27 @@ +--TEST-- +Bug #24499 (bogus handling of a public property as a private one) +--FILE-- +id = "bar"; + } +} + +function main() { + $id = new Id(); + $obj = new stdClass; + $obj->foo = "bar"; + $id->tester($obj); + print_r($obj); +} +?> +--EXPECT-- +stdClass Object +( + [foo] => bar + [id] => bar +) diff --git a/tests/core/lang/bug24652.phpt b/tests/core/lang/bug24652.phpt new file mode 100644 index 00000000..3bcea0e1 --- /dev/null +++ b/tests/core/lang/bug24652.phpt @@ -0,0 +1,31 @@ +--TEST-- +Bug #24652 (broken array_flip()) +--FILE-- + 0); + var_dump($f); + var_dump(array_key_exists(7, $f)); + var_dump(array_key_exists('7', $f)); + + print "----------\n"; + /* This doesn't */ + $f = array_flip(array('7')); + var_dump($f); + var_dump(array_key_exists(7, $f)); + var_dump(array_key_exists('7', $f)); +?> +--EXPECT-- +array(1) { + [7]=> + int(0) +} +bool(true) +bool(true) +---------- +array(1) { + [7]=> + int(0) +} +bool(true) +bool(true) diff --git a/tests/core/lang/bug24908.phpt b/tests/core/lang/bug24908.phpt new file mode 100644 index 00000000..41ee775e --- /dev/null +++ b/tests/core/lang/bug24908.phpt @@ -0,0 +1,20 @@ +--TEST-- +Bug #24908 (super-globals cannot be used in __destruct()) +--INI-- +variables_order=GPS +--FILE-- + +--EXPECT-- +OK diff --git a/tests/core/lang/bug55754.phpt b/tests/core/lang/bug55754.phpt new file mode 100644 index 00000000..c58ec917 --- /dev/null +++ b/tests/core/lang/bug55754.phpt @@ -0,0 +1,14 @@ +--TEST-- +Bug #55754 (Only variables should be passed by reference for ZEND_SEND_PREFER_REF params) +--FILE-- + "a")); +current(array(0 => "a")); +current($arr); + +echo "DONE"; + +?> +--EXPECT-- +DONE