Re: [PHP-DEV] Access property of object stored in a constant

2023-08-19 Thread Larry Garfield
On Sat, Aug 19, 2023, at 4:21 AM, Claude Pache wrote: > At the time I filed https://github.com/php/php-src/issues/10497, I was > merely exploring the potential of the new ability to have an object in > a constant. The potential use I had back in my head was the following. > Currently, I store

Re: [PHP-DEV] Access property of object stored in a constant

2023-08-19 Thread Ilija Tovilo
Hi Juliette > > Since https://wiki.php.net/rfc/new_in_initializers we can store > > objects in global constants. However, we may not actually read or > > write to the properties of those objects without first fetching the > > constant into a local variable. > > > > const a = new stdClass; > >

Re: [PHP-DEV] Access property of object stored in a constant

2023-08-18 Thread Juliette Reinders Folmer
On 18-8-2023 17:27, Ilija Tovilo wrote: Hi everyone Since https://wiki.php.net/rfc/new_in_initializers we can store objects in global constants. However, we may not actually read or write to the properties of those objects without first fetching the constant into a local variable. const a =

[PHP-DEV] Access property of object stored in a constant

2023-08-18 Thread Ilija Tovilo
Hi everyone Since https://wiki.php.net/rfc/new_in_initializers we can store objects in global constants. However, we may not actually read or write to the properties of those objects without first fetching the constant into a local variable. const a = new stdClass; a->b = 42; // Fatal error: