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

Reply via email to