php-src/Zend/tests/bug48693.phpt
Dmitry Stogov 1c94ff0595 Implement engine exceptions
RFC: https://wiki.php.net/rfc/engine_exceptions_for_php7

Pending changes regarding naming of BaseException and whether it
should be an interface.
2015-03-09 14:01:32 +01:00

46 lines
976 B
PHP

--TEST--
Bug #48693 (Double declaration of __lambda_func when lambda wrongly formatted)
--FILE--
<?php
try {
$x = create_function('', 'return 1; }');
} catch (ParseException $e) {
echo "$e\n\n";
}
try {
$y = create_function('', 'function a() { }; return 2;');
} catch (ParseException $e) {
echo "$e\n\n";
}
try {
$z = create_function('', '{');
} catch (ParseException $e) {
echo "$e\n\n";
}
try {
$w = create_function('', 'return 3;');
} catch (ParseException $e) {
echo "$e\n\n";
}
var_dump(
$y(),
$w()
);
?>
--EXPECTF--
exception 'ParseException' with message 'syntax error, unexpected '}', expecting end of file' in %sbug48693.php(4) : runtime-created function:1
Stack trace:
#0 %sbug48693.php(4): create_function('', 'return 1; }')
#1 {main}
exception 'ParseException' with message 'syntax error, unexpected end of file' in %sbug48693.php(14) : runtime-created function:1
Stack trace:
#0 %sbug48693.php(14): create_function('', '{')
#1 {main}
int(2)
int(3)