xref: /PHP-7.0/Zend/tests/bug48693.phpt (revision e97d5fab)
1--TEST--
2Bug #48693 (Double declaration of __lambda_func when lambda wrongly formatted)
3--FILE--
4<?php
5
6try {
7	$x = create_function('', 'return 1; }');
8} catch (ParseError $e) {
9	echo "$e\n\n";
10}
11try {
12	$y = create_function('', 'function a() { }; return 2;');
13} catch (ParseError $e) {
14	echo "$e\n\n";
15}
16try {
17	$z = create_function('', '{');
18} catch (ParseError $e) {
19	echo "$e\n\n";
20}
21try {
22	$w = create_function('', 'return 3;');
23} catch (ParseError $e) {
24	echo "$e\n\n";
25}
26
27var_dump(
28	$y(),
29	$w()
30);
31
32?>
33--EXPECTF--
34ParseError: syntax error, unexpected '}', expecting end of file in %sbug48693.php(4) : runtime-created function:1
35Stack trace:
36#0 %sbug48693.php(4): create_function('', 'return 1; }')
37#1 {main}
38
39ParseError: syntax error, unexpected end of file in %sbug48693.php(14) : runtime-created function:1
40Stack trace:
41#0 %sbug48693.php(14): create_function('', '{')
42#1 {main}
43
44int(2)
45int(3)
46