php-src/Zend/tests/this_in_extract.phpt
Nikita Popov e080fb6d92 Do not continue extract()ing after an exception has been thrown
Make behavior consistent with a loop of normal assignments.

This is not a big issue now, because $this is the only case that
may generate an error. However typed references introduce additional
error conditions, which would be silenced by this kind of behavior.
2018-07-03 22:45:35 +02:00

20 lines
306 B
PHP

--TEST--
$this re-assign in extract()
--FILE--
<?php
function foo() {
try {
extract(["this"=>42, "a"=>24]);
} catch (Error $e) {
echo $e->getMessage(), "\n";
}
var_dump($a);
}
foo();
?>
--EXPECTF--
Cannot re-assign $this
Notice: Undefined variable: a in %s on line %d
NULL