1--TEST--
2New not allowed in property
3--FILE--
4<?php
5
6// New in (non-static) properties is a particularly tricky case. The initializer needs to be
7// evaluated on each object construction. Currently, the places where this can happen is
8// during object creation, or as part of the constructor. Doing this during object creation
9// can issues for use-cases such as serialization or generally anything that is effectively
10// based on newInstanceWithoutConstructor(). Handling this via the constructor is more
11// promising, but requires injecting code in the constructor, which may require adding a
12// constructor which is not explicitly declared, which may also require a child class to
13// call a constructor that has not been explicitly declared, otherwise properties may be
14// left uninitialized. A third option is another mechanism between object creation and
15// constructor invocation. Overall, the best way to address this is not clear right now.
16
17class Test {
18    public $prop = new stdClass;
19}
20
21?>
22--EXPECTF--
23Fatal error: New expressions are not supported in this context in %s on line %d
24