Re: I this a bug in PHP 7.1.9?

From: Date: Mon, 04 Sep 2017 00:48:48 +0000
Subject: Re: I this a bug in PHP 7.1.9?
References: 1  Groups: php.internals 
Request: Send a blank email to internals+get-100360@lists.php.net to get a copy of this message
From doc: http://php.net/manual/en/language.variables.scope.php > Note: Static variables may be declared as seen in the examples above. From PHP 5.6 you can assign values to these variables which are the result of expressions, but you can't use any function here, what will cause a parse error. 2017-09-03 21:27 GMT-03:00 Jefferson Gonzalez <jgmdev@gmail.com>: > I upgraded my PHP version on a server from 7.0 to latest 7.1.9 and got > this strange behaviour, did something changed on the core language or is > this a bug? > > PHP sample code: > ------------------------------------------ > <?php > > function test() > { > static $staticValue = test2(); > > return $staticValue; > } > > function test2() > { > return array(); > } > > print_r(test()); > > ------------------------------------------ > > Output: > > PHP Fatal error: Constant expression contains invalid operations in > test.php on line 5 > > Fatal error: Constant expression contains invalid operations in test.php > on line 5 > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php > > -- David Rodrigues

« previous php.internals (#100360) next »