Re: [PHP-DEV] array_reduce callback key

2024-07-16 Thread Levi Morrison
On Tue, Jul 16, 2024 at 5:17 PM Bilge wrote: > > Hi Internals, > > I just ran into a case where I needed the array key in an array_reduce() > callback, but I can't access it :( > > So I wrote a PR to fix it: https://github.com/php/php-src/pull/14986 > > What do you think? Does this need an RFC? >

Re: [PHP-DEV] array_reduce callback key

2024-07-16 Thread Bilge
On Wed, 17 Jul 2024, 01:29 mickmackusa, wrote: > It is untrue that you "can't access it"; you just need to use an array of > keys as the input array. > >> It is absolutely true and your workaround is just that; a workaround that doesn't work at all when you also need the value. Cheers, Bilge

Re: [PHP-DEV] array_reduce callback key

2024-07-16 Thread mickmackusa
This is not the first time that a developer needs access to the input array's keys within the callback of array_reduce(). It is untrue that you "can't access it"; you just need to use an array of keys as the input array. Some frameworks already have the feature of key access built into their metho

[PHP-DEV] array_reduce callback key

2024-07-16 Thread Bilge
Hi Internals, I just ran into a case where I needed the array key in an array_reduce() callback, but I can't access it :( So I wrote a PR to fix it: https://github.com/php/php-src/pull/14986 What do you think? Does this need an RFC? Cheers, Bilge

[PHP-DEV] Json error - better message

2024-07-16 Thread juan carlos morales
Hello Internals again: I created this pull request: https://github.com/php/php-src/pull/14672 To have better error messages when decoding a JSON in php using the json_last_error_msg() function. With this change I pretend to have a message like: "Syntax error, at character 0 near content: blah"

Re: [PHP-DEV] [RFC] Lazy Objects

2024-07-16 Thread Nicolas Grekas
Hi there, Le mar. 16 juil. 2024 à 10:13, Nicolas Grekas a écrit : > > > Le lun. 15 juil. 2024 à 21:42, Tim Düsterhus a écrit : > >> Hi >> >> On 7/15/24 09:25, Nicolas Grekas wrote: >> > Testing is actually a good domain where resetting lazy objects might >> open >> > interesting use cases. >> >

Re: [PHP-DEV] [RFC] Deprecations for PHP 8.4

2024-07-16 Thread Christoph M. Becker
Hi Tim! On 15.07.2024 at 23:50, Tim Düsterhus wrote: >> That doesn't mean that I'm against the uniqid() deprecation, especially >> if the deprecation message is clear on what to use instead. > > I will make sure to write useful migration docs, helping users making an > educated choice for an alte

Re: [PHP-DEV] [RFC] Lazy Objects

2024-07-16 Thread Nicolas Grekas
Le lun. 15 juil. 2024 à 21:42, Tim Düsterhus a écrit : > Hi > > On 7/15/24 09:25, Nicolas Grekas wrote: > > Testing is actually a good domain where resetting lazy objects might open > > interesting use cases. > > This reminded me about zenstruck/foundry, which leverages the > > LazyProxyTrait to

Re: [PHP-DEV] [RFC] Deprecations for PHP 8.4

2024-07-16 Thread Rob Landers
On Tue, Jul 16, 2024, at 01:08, Rob Landers wrote: > > > On Mon, Jul 15, 2024, at 23:29, Tim Düsterhus wrote: >> Hi >> >> On 7/15/24 16:12, Rob Landers wrote: >> > This always gets me. "safer" doesn't have a consistent meaning. For >> >> Yes it does. SHA-256 is safer than MD5. And on modern C