Re: [PHP-DEV] Allow objects in define()

2021-06-15 Thread Nikita Popov
On Tue, Jun 15, 2021 at 8:44 AM Claude Pache wrote: > > > > Not sure about specific use cases, for me the important aspect here is to > avoid arbitrary restrictions. For example, define() accepts resources, and > this is used for some core constants like STDIN, STDOUT, STDERR. > > > Per the docum

Re: [PHP-DEV] Allow objects in define()

2021-06-14 Thread Maxime Veber
> > Not sure about specific use cases, for me the important aspect here is to > > avoid arbitrary restrictions. For example, define() accepts resources, > and > > this is used for some core constants like STDIN, STDOUT, STDERR. > > > > Per the documentation [1], defining resource constants is suppo

Re: [PHP-DEV] Allow objects in define()

2021-06-14 Thread Claude Pache
> > Not sure about specific use cases, for me the important aspect here is to > avoid arbitrary restrictions. For example, define() accepts resources, and > this is used for some core constants like STDIN, STDOUT, STDERR. > Per the documentation [1], defining resource constants is supposed to

Re: [PHP-DEV] Allow objects in define()

2021-06-14 Thread Paul Dragoonis
On Mon, Jun 14, 2021 at 7:47 PM Larry Garfield wrote: > On Mon, Jun 14, 2021, at 9:35 AM, Nikita Popov wrote: > > Hi internals, > > > > With the introduction of enums, it's now possible for constants to hold > > objects. However, this works only when using the `const X = Y` syntax, > not > > when

Re: [PHP-DEV] Allow objects in define()

2021-06-14 Thread Larry Garfield
On Mon, Jun 14, 2021, at 9:35 AM, Nikita Popov wrote: > Hi internals, > > With the introduction of enums, it's now possible for constants to hold > objects. However, this works only when using the `const X = Y` syntax, not > when using `define('X', Y)`, which still excludes objects. > > I've subm

Re: [PHP-DEV] Allow objects in define()

2021-06-14 Thread Marco Pivetta
On Mon, Jun 14, 2021 at 5:02 PM Nikita Popov wrote: > In the future, we're going to switch these resources to be objects, so > allowing them in constants would be necessary at that point at least. > Actually, we already encountered this as a BC issue when switching some > other resource types to

Re: [PHP-DEV] Allow objects in define()

2021-06-14 Thread Nikita Popov
On Mon, Jun 14, 2021 at 4:42 PM Marco Pivetta wrote: > Hey NikiC, > > On Mon, Jun 14, 2021, 16:35 Nikita Popov wrote: > >> Hi internals, >> >> With the introduction of enums, it's now possible for constants to hold >> objects. However, this works only when using the `const X = Y` syntax, not >>

Re: [PHP-DEV] Allow objects in define()

2021-06-14 Thread Marco Pivetta
Hey NikiC, On Mon, Jun 14, 2021, 16:35 Nikita Popov wrote: > Hi internals, > > With the introduction of enums, it's now possible for constants to hold > objects. However, this works only when using the `const X = Y` syntax, not > when using `define('X', Y)`, which still excludes objects. > > I'v

[PHP-DEV] Allow objects in define()

2021-06-14 Thread Nikita Popov
Hi internals, With the introduction of enums, it's now possible for constants to hold objects. However, this works only when using the `const X = Y` syntax, not when using `define('X', Y)`, which still excludes objects. I've submitted https://github.com/php/php-src/pull/7149 to relax the restrict