Skip to content

Commit eaeecc5

Browse files
committed
Deprecate create_function()
1 parent fbeb900 commit eaeecc5

26 files changed

+119
-42
lines changed

Zend/tests/anonymous_func_001.phpt

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,24 +12,43 @@ for ($i = 0; $i < 10; $i++) {
1212
}
1313

1414
?>
15-
--EXPECT--
15+
--EXPECTF--
16+
Deprecated: Function create_function() is deprecated in %s on line %d
1617
int(0)
1718
int(0)
19+
20+
Deprecated: Function create_function() is deprecated in %s on line %d
1821
int(1)
1922
int(1)
23+
24+
Deprecated: Function create_function() is deprecated in %s on line %d
2025
int(2)
2126
int(2)
27+
28+
Deprecated: Function create_function() is deprecated in %s on line %d
2229
int(3)
2330
int(3)
31+
32+
Deprecated: Function create_function() is deprecated in %s on line %d
2433
int(4)
2534
int(4)
35+
36+
Deprecated: Function create_function() is deprecated in %s on line %d
2637
int(5)
2738
int(5)
39+
40+
Deprecated: Function create_function() is deprecated in %s on line %d
2841
int(6)
2942
int(6)
43+
44+
Deprecated: Function create_function() is deprecated in %s on line %d
3045
int(7)
3146
int(7)
47+
48+
Deprecated: Function create_function() is deprecated in %s on line %d
3249
int(8)
3350
int(8)
51+
52+
Deprecated: Function create_function() is deprecated in %s on line %d
3453
int(9)
3554
int(9)

Zend/tests/anonymous_func_002.phpt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@ var_dump($arr[$test(1)]);
1111
var_dump($arr[$test(0)]() == $arr);
1212

1313
?>
14-
--EXPECT--
14+
--EXPECTF--
15+
Deprecated: Function create_function() is deprecated in %s on line %d
16+
17+
Deprecated: Function create_function() is deprecated in %s on line %d
1518
int(2)
1619
bool(true)

Zend/tests/anonymous_func_003.phpt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,6 @@ try {
1111
}
1212

1313
?>
14-
--EXPECT--
14+
--EXPECTF--
15+
Deprecated: Function create_function() is deprecated in %s on line %d
1516
bool(true)

Zend/tests/bug48693.phpt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,15 +31,22 @@ var_dump(
3131

3232
?>
3333
--EXPECTF--
34+
Deprecated: Function create_function() is deprecated in %s on line %d
3435
ParseError: syntax error, unexpected '}', expecting end of file in %sbug48693.php(4) : runtime-created function:1
3536
Stack trace:
3637
#0 %sbug48693.php(4): create_function('', 'return 1; }')
3738
#1 {main}
3839

40+
41+
Deprecated: Function create_function() is deprecated in %s on line %d
42+
43+
Deprecated: Function create_function() is deprecated in %s on line %d
3944
ParseError: syntax error, unexpected end of file in %sbug48693.php(14) : runtime-created function:1
4045
Stack trace:
4146
#0 %sbug48693.php(14): create_function('', '{')
4247
#1 {main}
4348

49+
50+
Deprecated: Function create_function() is deprecated in %s on line %d
4451
int(2)
4552
int(3)

Zend/tests/closure_025.phpt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,6 @@ $a = create_function('$x', 'return function($y) use ($x) { return $x * $y; };');
88
var_dump($a(2)->__invoke(4));
99

1010
?>
11-
--EXPECT--
11+
--EXPECTF--
12+
Deprecated: Function create_function() is deprecated in %s on line %d
1213
int(8)

Zend/tests/exception_012.phpt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ $func();
1313
--EXPECTHEADERS--
1414
Content-type: text/html; charset=UTF-8
1515
--EXPECTF--
16+
Deprecated: Function create_function() is deprecated in %s on line %d
17+
1618
Fatal error: Uncaught AssertionError: assert(false) in %sexception_012.php(%d) : runtime-created function:%d
1719
Stack trace:
1820
#0 %sexception_012.php(%d) : runtime-created function(%d): assert(false, 'assert(false)')

Zend/tests/instanceof_001.phpt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ var_dump("$a" instanceof stdClass);
2222
--EXPECTF--
2323
bool(true)
2424
bool(true)
25+
26+
Deprecated: Function create_function() is deprecated in %s on line %d
2527
bool(true)
2628
bool(true)
2729
bool(false)

Zend/zend_builtin_functions.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -368,7 +368,7 @@ static const zend_function_entry builtin_functions[] = { /* {{{ */
368368
ZEND_FE(get_declared_interfaces, arginfo_zend__void)
369369
ZEND_FE(get_defined_functions, arginfo_zend__void)
370370
ZEND_FE(get_defined_vars, arginfo_zend__void)
371-
ZEND_FE(create_function, arginfo_create_function)
371+
ZEND_DEP_FE(create_function, arginfo_create_function)
372372
ZEND_FE(get_resource_type, arginfo_get_resource_type)
373373
ZEND_FE(get_resources, arginfo_get_resources)
374374
ZEND_FE(get_loaded_extensions, arginfo_get_loaded_extensions)

ext/opcache/tests/bug68252.phpt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,5 +16,6 @@ function a() {
1616
create_function('', 'var_dump("22");');
1717

1818
a();
19-
--EXPECT--
19+
--EXPECTF--
20+
Deprecated: Function create_function() is deprecated in %s on line %d
2021
okey

ext/pcre/tests/preg_replace_callback2.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ var_dump(preg_replace_callback('@\b\w{1,2}\b@', 'g', array('a b3 bcd', 'v' => 'a
1919

2020
var_dump(preg_replace_callback('~\A.~', 'g', array(array('xyz'))));
2121

22-
var_dump(preg_replace_callback('~\A.~', create_function('$m', 'return strtolower($m[0]);'), 'ABC'));
22+
var_dump(preg_replace_callback('~\A.~', function($m) { return strtolower($m[0]); }, 'ABC'));
2323
?>
2424
--EXPECTF--
2525
array(3) {

0 commit comments

Comments
 (0)