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
1313 using OPcache). (timwolla)
1414 . Fixed bug GH-19480 (error_log php.ini cannot be unset when open_basedir is
1515 configured). (nielsdos)
16+ . Fixed bug GH-19719 (Allow empty statements before declare(strict_types)).
17+ (nielsdos)
1618
1719- Curl:
1820 . 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) /* {{{ */
70087008 } else if (zend_string_equals_literal_ci (name , "strict_types" )) {
70097009 zval value_zv ;
70107010
7011- if (FAILURE == zend_is_first_statement (ast , /* allow_nop */ 0 )) {
7011+ if (FAILURE == zend_is_first_statement (ast , /* allow_nop */ true )) {
70127012 zend_error_noreturn (E_COMPILE_ERROR , "strict_types declaration must be "
70137013 "the very first statement in the script" );
70147014 }
You can’t perform that action at this time.
0 commit comments