mirror of
https://github.com/php/php-src.git
synced 2024-12-14 20:33:36 +08:00
c9f27ee422
TypeException stays as-is for now because it uses messages that are incompatible with the way exception messages are displayed. closure_038.phpt and a few others now show that we're generating too many exceptions for compound operations on undefined properties -- this needs to be fixed in a followup.
34 lines
691 B
PHP
34 lines
691 B
PHP
--TEST--
|
|
Closure 019: Calling lambda using $GLOBALS and global $var
|
|
--FILE--
|
|
<?php
|
|
|
|
$lambda = function &(&$x) {
|
|
return $x = $x * $x;
|
|
};
|
|
|
|
function test() {
|
|
global $lambda;
|
|
|
|
$y = 3;
|
|
var_dump($GLOBALS['lambda']($y));
|
|
var_dump($lambda($y));
|
|
var_dump($GLOBALS['lambda'](1));
|
|
}
|
|
|
|
test();
|
|
|
|
?>
|
|
--EXPECTF--
|
|
Notice: Only variable references should be returned by reference in %sclosure_019.php on line 4
|
|
int(9)
|
|
|
|
Notice: Only variable references should be returned by reference in %sclosure_019.php on line 4
|
|
int(81)
|
|
|
|
Fatal error: Uncaught exception 'EngineException' with message 'Cannot pass parameter 1 by reference' in %s:%d
|
|
Stack trace:
|
|
#0 %s(%d): test()
|
|
#1 {main}
|
|
thrown in %s on line %d
|