File tree Expand file tree Collapse file tree 3 files changed +24
-1
lines changed Expand file tree Collapse file tree 3 files changed +24
-1
lines changed Original file line number Diff line number Diff line change @@ -13,6 +13,8 @@ PHP NEWS
13
13
using OPcache). (timwolla)
14
14
. Fixed bug GH-19480 (error_log php.ini cannot be unset when open_basedir is
15
15
configured). (nielsdos)
16
+ . Fixed bug GH-19719 (Allow empty statements before declare(strict_types)).
17
+ (nielsdos)
16
18
17
19
- Curl:
18
20
. Fix cloning of CURLOPT_POSTFIELDS when using the clone operator instead
Original file line number Diff line number Diff line change
1
+ --TEST--
2
+ GH-19719: Allow empty expressions before declare(strict_types)
3
+ --FILE--
4
+ <?php
5
+ // e.g some comments
6
+ ?>
7
+ <?php
8
+
9
+ declare (strict_types=1 );
10
+
11
+ function takesInt (int $ x ) {}
12
+
13
+ try {
14
+ takesInt ('42 ' );
15
+ } catch (Error $ e ) {
16
+ echo $ e ->getMessage (), "\n" ;
17
+ }
18
+
19
+ ?>
20
+ --EXPECTF--
21
+ takesInt(): Argument #1 ($x) must be of type int, string given, called in %s on line %d
Original file line number Diff line number Diff line change @@ -7008,7 +7008,7 @@ static void zend_compile_declare(zend_ast *ast) /* {{{ */
7008
7008
} else if (zend_string_equals_literal_ci (name , "strict_types" )) {
7009
7009
zval value_zv ;
7010
7010
7011
- if (FAILURE == zend_is_first_statement (ast , /* allow_nop */ 0 )) {
7011
+ if (FAILURE == zend_is_first_statement (ast , /* allow_nop */ true )) {
7012
7012
zend_error_noreturn (E_COMPILE_ERROR , "strict_types declaration must be "
7013
7013
"the very first statement in the script" );
7014
7014
}
You can’t perform that action at this time.
0 commit comments