Re: [PHP-DEV] [RFC] Random Extension 3.0

2021-09-08 Thread Go Kudo
Hi Nikita, sorry for the late reply. This is a difficult problem. For now, MT19937 is left for compatibility. In other words, if you don't need compatibility, there is no benefit to using it. What about implementing both a new MT and a compatible MT? A compatible MT would have the following signa

Re: [PHP-DEV] [RFC] Never For Argument Types

2021-09-08 Thread Andreas Hennings
On Sat, 14 Aug 2021 at 15:05, Larry Garfield wrote: > > On Sat, Aug 14, 2021, at 7:48 AM, G. P. B. wrote: > > On Sat, 14 Aug 2021 at 10:55, Deleu wrote: > > > > > Hi Jordan, > > > > > > Does it make sense to explain in the RFC the difference between never and > > > mixed in this context? The RFC

[PHP-DEV] Re: Option for array_column() to preserve keys.

2021-09-08 Thread Ben Ramsey
Ben Ramsey wrote on 9/8/21 16:31:> We originally had a patch for this while PHP 5.5 was still in beta, but > we decided against merging it, and I can't remember why. :-) > This looks like part of the thread. I'm not sure where the rest of it is: https://externals.io/message/67113 Cheers, Ben

Re: [PHP-DEV] Alias stdClass to DynamicObject?

2021-09-08 Thread Mike Schinkel
> On Sep 8, 2021, at 4:59 PM, Rowan Tommins wrote: >> I assume we would also disallow dynamic properties in anonymous classes too, >> right? After all, they are just statically declared classes that the >> developer do not assign a name. > > The difference I see is that stdClass/DynamicObject a

[PHP-DEV] Re: Option for array_column() to preserve keys.

2021-09-08 Thread Ben Ramsey
Andreas Hennings wrote on 9/7/21 19:19: > Hello internals, > > The function array_column() would be much more useful if there was an > option to preserve the original array keys. > I can create an RFC, but I think it is better to first discuss the options. > > This is requested in different place

Re: [PHP-DEV] Alias stdClass to DynamicObject?

2021-09-08 Thread Andreas Hennings
On Wed, 8 Sept 2021 at 23:00, Rowan Tommins wrote: > > On 08/09/2021 16:37, Mike Schinkel wrote: > > > All future code that needs to refer to the class name will still refer to > > `stdClass`, so we won't be gaining much by creating an alias. > > > Just to be clear, the only code that would need

Re: [PHP-DEV] Alias stdClass to DynamicObject?

2021-09-08 Thread Rowan Tommins
On 08/09/2021 16:37, Mike Schinkel wrote: All future code that needs to refer to the class name will still refer to `stdClass`, so we won't be gaining much by creating an alias. Just to be clear, the only code that would need to change is code that dynamically gets *out* the class name, fro

Re: [PHP-DEV] Alias stdClass to DynamicObject?

2021-09-08 Thread Andreas Hennings
Wow! I notice that ArrayObject already does everything we would need for json_encode(). assert(json_encode(new ArrayObject([5])) === '{"0":5}'); However, it does so in a very strange way, not using any of the public methods, but also not using dynamic properties. It seems there is a hard-coded in

Re: [PHP-DEV] Alias stdClass to DynamicObject?

2021-09-08 Thread Andreas Hennings
On Wed, 8 Sept 2021 at 18:33, Lynn wrote: > > On Wed, Sep 8, 2021 at 5:38 PM Mike Schinkel wrote: > > > A couple more things; add a `JSON_OUTPUT_DYNAMIC_OBJECT` flag to output to > > DynamicObject for `json_decode()`, add a 3rd parameter for flags to > > var_export() for the same reason, a `'ret

Re: [PHP-DEV] Alias stdClass to DynamicObject?

2021-09-08 Thread Lynn
On Mon, Sep 6, 2021 at 5:28 PM Nikita Popov wrote: > What do people think about adding such an alias? Is this worthwhile? > What if `DynamicObject` becomes an interface instead of an alias? In the future `stdClass` could be deprecated and replaced by anonymous classes using the `DynamicObject` i

Re: [PHP-DEV] Alias stdClass to DynamicObject?

2021-09-08 Thread Lynn
On Wed, Sep 8, 2021 at 5:38 PM Mike Schinkel wrote: > A couple more things; add a `JSON_OUTPUT_DYNAMIC_OBJECT` flag to output to > DynamicObject for `json_decode()`, add a 3rd parameter for flags to > var_export() for the same reason, a `'return_dynamic_object'` option for > `unserialize()`, and

Re: [PHP-DEV] Alias stdClass to DynamicObject?

2021-09-08 Thread Mike Schinkel
> On Sep 8, 2021, at 5:44 AM, Rowan Tommins wrote: >> Is it just a special-cases that will cause as much confusion for developers >> trying to understand why there are too names for the same thing as it will >> help those who will better understand the new name > > That is certainly a risk, and

Re: [PHP-DEV] Option for array_column() to preserve keys.

2021-09-08 Thread Andreas Hennings
$source['a0']['b01'] = 5;On Wed, 8 Sept 2021 at 16:48, Andreas Hennings wrote: > > On Wed, 8 Sept 2021 at 16:10, Andreas Hennings wrote: > > > > Thanks for the feedback so far! > > > > On Wed, 8 Sept 2021 at 10:13, Marco Pivetta wrote: > > > > > > Heyo, > > > > > > On Wed, 8 Sep 2021, 02:19 Andr

Re: [PHP-DEV] Option for array_column() to preserve keys.

2021-09-08 Thread Andreas Hennings
On Wed, 8 Sept 2021 at 16:10, Andreas Hennings wrote: > > Thanks for the feedback so far! > > On Wed, 8 Sept 2021 at 10:13, Marco Pivetta wrote: > > > > Heyo, > > > > On Wed, 8 Sep 2021, 02:19 Andreas Hennings, wrote: > >> > >> Hello internals, > >> > >> The function array_column() would be much

Re: [PHP-DEV] Option for array_column() to preserve keys.

2021-09-08 Thread Andreas Hennings
Thanks for the feedback so far! On Wed, 8 Sept 2021 at 10:13, Marco Pivetta wrote: > > Heyo, > > On Wed, 8 Sep 2021, 02:19 Andreas Hennings, wrote: >> >> Hello internals, >> >> The function array_column() would be much more useful if there was an >> option to preserve the original array keys. >>

Re: [PHP-DEV] Alias stdClass to DynamicObject?

2021-09-08 Thread Rowan Tommins
On 08/09/2021 11:08, Nicolas Grekas wrote: I'm reading the discussion about the side of the alias. Can't we solve these concerns by making DynamicObject extend stdClass instead of aliasing? That wouldn't allow an stdClass object to get through the DynamicObject typehint, but that shouldn't be a

Re: [PHP-DEV] Alias stdClass to DynamicObject?

2021-09-08 Thread Nicolas Grekas
> In the thread for deprecation of dynamic properties, Rowan suggested that > we alias "stdClass" to "DynamicObject" in > https://externals.io/message/115800#115802. I wanted to split this > discussion off into a separate thread, as this can be decided > independently. > > The rationale for this is

Re: [PHP-DEV] Alias stdClass to DynamicObject?

2021-09-08 Thread Rowan Tommins
On 08/09/2021 09:45, Mike Schinkel wrote: So I am trying to get around what this would actually mean in practice, and what the ramifications would be. The proposal is that the new name is an "alias" - the same class, but with two names. So the following would all create exactly the same obje

Re: [PHP-DEV] Alias stdClass to DynamicObject?

2021-09-08 Thread Mike Schinkel
> On Sep 6, 2021, at 11:28 AM, Nikita Popov wrote: > > Hi internals, > > In the thread for deprecation of dynamic properties, Rowan suggested that > we alias "stdClass" to "DynamicObject" in > https://externals.io/message/115800#115802. I wanted to split this > discussion off into a separate t

Re: [PHP-DEV] Alias stdClass to DynamicObject?

2021-09-08 Thread Rowan Tommins
On 07/09/2021 17:15, Marc Bennewitz wrote: * It's a class -> Why do we suffix it with "Object"? Classes are generally named to make sense when you have an instance: a class called "HttpRequest" is not saying that the *class* is a request, but that every *instance* is one, as in "$myRequest

Re: [PHP-DEV] [RFC] [VOTE] is_literal

2021-09-08 Thread Stephen Reay
> On 8 Sep 2021, at 13:33, Claude Pache wrote: > > > >> Le 7 sept. 2021 à 11:49, Craig Francis a écrit : >> >> >> Obviously I'd still like libraries to be able to protect everyone from >> introducing Injection Vulnerabilities (as the majority of programmers don't >> use static analysis),

Re: [PHP-DEV] Option for array_column() to preserve keys.

2021-09-08 Thread Guilliam Xavier
Yes please! This has been requested multiple times, for instance: - https://bugs.php.net/bug.php?id=64493 - https://bugs.php.net/bug.php?id=66435 - https://bugs.php.net/bug.php?id=73735 Regards, -- Guilliam Xavier

Re: [PHP-DEV] Option for array_column() to preserve keys.

2021-09-08 Thread Marco Pivetta
Heyo, On Wed, 8 Sep 2021, 02:19 Andreas Hennings, wrote: > Hello internals, > > The function array_column() would be much more useful if there was an > option to preserve the original array keys. > I can create an RFC, but I think it is better to first discuss the options. > New function, pleas