Re: [PHP-DEV] RFC: Support Closures in constant expressions

2024-11-04 Thread Gina P. Banyard
On Monday, 4 November 2024 at 20:32, Larry Garfield wrote: > On Mon, Nov 4, 2024, at 6:06 AM, Tim Düsterhus wrote: > > > > Here's another brainteaser: > > > > function foo( > > string $bar, > > Closure $baz = static fn () => $bar, > > ) { > > var_dump($baz()); > > } > > > > foo('captured'); >

Re: [PHP-DEV] RFC: Support Closures in constant expressions

2024-11-04 Thread Larry Garfield
On Mon, Nov 4, 2024, at 6:06 AM, Tim Düsterhus wrote: > Hi > > Am 2024-10-31 07:16, schrieb Larry Garfield: >> Hm. It would never occur to me to use a function for a non-class >> constant in the first place, so I don't know. :-) Frankly I can't >> recall the last time I used a non-class constan

Re: [PHP-DEV] [RFC] [Discussion] Persistent CurlShareHandle objects

2024-11-04 Thread Jakub Zelenka
On Mon, Nov 4, 2024 at 2:21 PM Jakub Zelenka wrote: > Hi, > > On Wed, Oct 9, 2024 at 10:18 PM Eric Norris > wrote: > >> Hello all, >> >> After receiving some feedback about >> https://github.com/php/php-src/pull/15603, I'm formally proposing an >> RFC to add persistent curl share handles here: >

Re: [PHP-DEV] RFC: Support Closures in constant expressions

2024-11-04 Thread Tim Düsterhus
Hi Am 2024-10-30 09:31, schrieb Alexandru Pătrănescu: So, why not allow capturing, since anyway the only place to capture are constants and static variables? Static variables already support arbitrary expressions since https://wiki.php.net/rfc/arbitrary_static_variable_initializers. The RFC

Re: [PHP-DEV] [RFC] [Discussion] Persistent CurlShareHandle objects

2024-11-04 Thread Jakub Zelenka
Hi, On Wed, Oct 9, 2024 at 10:18 PM Eric Norris wrote: > Hello all, > > After receiving some feedback about > https://github.com/php/php-src/pull/15603, I'm formally proposing an > RFC to add persistent curl share handles here: > https://wiki.php.net/rfc/curl_share_persistence > > I think what's

Re: [PHP-DEV] RFC: Support Closures in constant expressions

2024-11-04 Thread Tim Düsterhus
Hi Am 2024-11-04 13:33, schrieb Rob Landers: What would you expect the semantics of that script to be? Isn't this semantically equivalent to: Perhaps? That's the question I am asking. Given that this is not a valid PHP program as of now, it would as least be debatable how this is supposed

Re: [PHP-DEV] RFC: Support Closures in constant expressions

2024-11-04 Thread Tim Düsterhus
Hi Am 2024-10-31 15:16, schrieb Gina P. Banyard: I very much like this feature, a bit sad that it doesn't support First Class Callable syntax, but I understand the increased complexity this would add. We hope to follow-up with a separate RFC for that, once we figured out the technical implem

Re: [PHP-DEV] RFC: Support Closures in constant expressions

2024-11-04 Thread Rob Landers
On Mon, Nov 4, 2024, at 13:06, Tim Düsterhus wrote: > Hi > > Am 2024-10-31 07:16, schrieb Larry Garfield: > > Hm. It would never occur to me to use a function for a non-class > > constant in the first place, so I don't know. :-) Frankly I can't > > recall the last time I used a non-class con

Re: [PHP-DEV] RFC: Support Closures in constant expressions

2024-11-04 Thread Tim Düsterhus
Hi Am 2024-10-31 08:22, schrieb Rob Landers: To be honest, I thought it was a rhetorical question since the example is a runtime error (passing string to a function that takes an array), That clearly was a typo / copy-paste mistake / whatever you would like to call it. but on this note, we

Re: [PHP-DEV] RFC: Support Closures in constant expressions

2024-11-04 Thread Tim Düsterhus
Hi Am 2024-10-31 07:16, schrieb Larry Garfield: Hm. It would never occur to me to use a function for a non-class constant in the first place, so I don't know. :-) Frankly I can't recall the last time I used a non-class constant period. :-) That said, PHP consts are already a bit squishy, an

Re: [PHP-DEV] [RFC] [Discussion] Persistent CurlShareHandle objects

2024-11-04 Thread Tim Düsterhus
Hi Am 2024-11-01 21:07, schrieb Eric Norris: really any major issues that this can cause. We already support curl share handles via curl_share_init, and adding persistence doesn't fundamentally change the issues you may have with reusing a curl Yes, it does. See the reply that I just sent in t

Re: [PHP-DEV] RFC: Support Closures in constant expressions

2024-11-04 Thread Tim Düsterhus
Hi Am 2024-10-30 13:06, schrieb Rob Landers: This looks interesting, but I notice it says that the closure can access “private properties”: This means that Closures in property default values may access private properties, methods, and class constants of the class where they are defined I

Re: [PHP-DEV] RFC: Support Closures in constant expressions

2024-11-04 Thread Tim Düsterhus
Hi Am 2024-10-30 10:58, schrieb Michał Marcin Brzuchalski: Personally, I'd expect short-closures be available as well, did you though about maybe reusing `const` token instead of `static` to make the information visually available for users? We do not believe the cost-benefit ratio is worth

Re: [PHP-DEV] [VOTE] Add persistent curl share handles

2024-11-04 Thread Tim Düsterhus
Hi Am 2024-10-28 16:31, schrieb Eric Norris: I think it's interesting to note that within a request, users are still vulnerable to accidentally over-sharing cookies. It's unclear to Yes. me why we would draw the line at persistence, considering it would be opt-in. That is, even if you're not