mirror of
https://github.com/php/php-src.git
synced 2024-09-21 18:07:23 +00:00
3c68f38fda
This restricts allowed usage of $GLOBALS, with the effect that plain PHP arrays can no longer contain INDIRECT elements. RFC: https://wiki.php.net/rfc/restrict_globals_usage Closes GH-6487.
24 lines
437 B
PHP
24 lines
437 B
PHP
--TEST--
|
|
$GLOBALS cannot be passed by reference (runtime error)
|
|
--FILE--
|
|
<?php
|
|
|
|
function by_ref(&$ref) {}
|
|
try {
|
|
by_ref($GLOBALS);
|
|
} catch (Error $e) {
|
|
echo $e->getMessage(), "\n";
|
|
}
|
|
|
|
try {
|
|
by_ref2($GLOBALS);
|
|
} catch (Error $e) {
|
|
echo $e->getMessage(), "\n";
|
|
}
|
|
function by_ref2(&$ref) {}
|
|
|
|
?>
|
|
--EXPECT--
|
|
by_ref(): Argument #1 ($ref) cannot be passed by reference
|
|
by_ref2(): Argument #1 ($ref) cannot be passed by reference
|