On Wed, Jul 17, 2024, at 9:01 AM, Bilge wrote:
> On 17/07/2024 01:41, Levi Morrison wrote:
>> Adding arguments to a function can mess up internal callbacks, btw, so I
>> don't like modifying the
>> existing function.
> Which internal callbacks can be messed up by this change? They clearly
> aren'
On 17/07/2024 01:41, Levi Morrison wrote:
Adding arguments to a function can mess up internal callbacks, btw, so I don't
like modifying the
existing function.
Which internal callbacks can be messed up by this change? They clearly
aren't tested, as the build is passing.
Cheers,
Bilge
It would make sense for it to be the last argument. My first thought was also
that PHP doesn't usually care if you add extra arguments, but "internal
callbacks" made me think they were C callbacks, and in that case I don't
really know.
On Wed, Jul 17, 2024 at 10:08 AM Rob Landers wrote:
>
> On We
On Wed, Jul 17, 2024, at 09:55, Lily Bergonzat wrote:
> While it *is* indeed a workaround, you can very easily
> access the values of the array from the keys, since that
> literally is what the keys are for.
>
> While I also think it's weird that not all php array functions
> with callbacks do pas
While it *is* indeed a workaround, you can very easily
access the values of the array from the keys, since that
literally is what the keys are for.
While I also think it's weird that not all php array functions
with callbacks do pass the key as an argument, and while
I also stumbled upon that prob
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?
>
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
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
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