xref: /PHP-7.4/Zend/tests/bug48693.phpt (revision eaeecc52)
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--
34Deprecated: Function create_function() is deprecated in %s on line %d
35ParseError: syntax error, unexpected '}', expecting end of file in %sbug48693.php(4) : runtime-created function:1
36Stack trace:
37#0 %sbug48693.php(4): create_function('', 'return 1; }')
38#1 {main}
39
40
41Deprecated: Function create_function() is deprecated in %s on line %d
42
43Deprecated: Function create_function() is deprecated in %s on line %d
44ParseError: syntax error, unexpected end of file in %sbug48693.php(14) : runtime-created function:1
45Stack trace:
46#0 %sbug48693.php(14): create_function('', '{')
47#1 {main}
48
49
50Deprecated: Function create_function() is deprecated in %s on line %d
51int(2)
52int(3)
53