mirror of
https://github.com/php/php-src.git
synced 2026-04-27 10:16:41 +02:00
52d3d0d8d7
Add support for new expressions inside parameter default values, static variable initializers, global constant initializers and attribute arguments. RFC: https://wiki.php.net/rfc/new_in_initializers Closes GH-7153.
19 lines
631 B
PHP
19 lines
631 B
PHP
--TEST--
|
|
New not allowed in class constant
|
|
--FILE--
|
|
<?php
|
|
|
|
// New in class constants (and static properties) brings up evaluation order questions: When
|
|
// should the (potentially side-effecting) new expression be evaluated? Evaluating it when the
|
|
// class is declared would break references to classes that are declared later in the same
|
|
// file. On the other hand, the current lazy evaluation of initializers is somewhat ill-defined
|
|
// when we start considering side-effecting expressions.
|
|
|
|
class Test {
|
|
const X = new stdClass;
|
|
}
|
|
|
|
?>
|
|
--EXPECTF--
|
|
Fatal error: New expressions are not supported in this context in %s on line %d
|