Re: [PHP-DEV] [RFC] Re: Decoding HTML and the Ambiguous Ampersand

2024-08-16 Thread Dennis Snell
> On Aug 16, 2024, at 6:53 PM, Rob Landers wrote: > > Hey Dennis, > > This looks like top posting because you’ve got a lot to read — and well > written — but I want to reply to some points inline. Rob, no worries! I love your questions and I love being able to work together again, even in s

Re: [PHP-DEV] Should there be a `get_declared_enums()` function ?

2024-08-16 Thread Juliette Reinders Folmer
On 17-8-2024 6:26, Ayesh Karunaratne wrote: I think the `get_declared_enums` is small enough to be considered a minor change given we don't change any engine internals. Given the positive response on the mailing list, I think we can have this in PHP 8.4 as well, subject to RMs approval of cours

Re: [PHP-DEV] Should there be a `get_declared_enums()` function ?

2024-08-16 Thread Juliette Reinders Folmer
Hi Mike, There is one problem I can see with this approach though: since PHP 7.4, the return value of `get_declared_classes()` (and friends) does not guarantee any particular order anymore [2]. So, an `array_slice($symbols, $n)` may not get you the _latest_ classes loaded, so I think this w

Re: [PHP-DEV] Should there be a `get_declared_enums()` function ?

2024-08-16 Thread Mike Schinkel
Hi Juliette, > On Aug 16, 2024, at 9:25 PM, Juliette Reinders Folmer > wrote: > > On 17-8-2024 2:00, Mike Schinkel wrote: >> To everyone on this thread and thus nobody in specific (hence my top post): >> >> Given that get_declared_*() populates a new ZEND_HASH each time the function >> is cal

Re: [PHP-DEV] Should there be a `get_declared_enums()` function ?

2024-08-16 Thread Ayesh Karunaratne
> > I'm presuming it's too late for PHP 8.4, what with feature freeze having come > & gone this week. > > Based on the mostly supportive responses on the list, I wonder whether an RFC > is needed. If so, I'd be happy to create an initial draft (for PHP 8.5). > Thank you! We now have the Release

Re: [PHP-DEV] Time-out Posting to PHP Internals List

2024-08-16 Thread Kris Craig
On Fri, Aug 16, 2024 at 3:37 PM Rob Landers wrote: > > > On Fri, Aug 16, 2024, at 22:16, Kris Craig wrote: > > > > On Fri, Aug 16, 2024 at 8:11 AM Derick Rethans wrote: > > Hi, > > In the last months, you have had numerous suggestions to keep it civil > on the mailing list, in the "C++ Enhanceme

Re: [PHP-DEV] [RFC] Re: Decoding HTML and the Ambiguous Ampersand

2024-08-16 Thread Rob Landers
Hey Dennis, This looks like top posting because you’ve got a lot to read — and well written — but I want to reply to some points inline. On Fri, Aug 16, 2024, at 20:43, Dennis Snell wrote: > >On Fri, Aug 16, 2024, at 02:59, Dennis Snell wrote > > Thanks for the question, Rob, I hope this finds

Re: [PHP-DEV] Should there be a `get_declared_enums()` function ?

2024-08-16 Thread Juliette Reinders Folmer
On 17-8-2024 2:00, Mike Schinkel wrote: To everyone on this thread and thus nobody in specific (hence my top post): Given that get_declared_*() populates a new ZEND_HASH each time the function is called[1] — which for classes can easily be hundreds of strings — would there be any appetite to:

Re: [PHP-DEV] Should there be a `get_declared_enums()` function ?

2024-08-16 Thread Juliette Reinders Folmer
On 16-8-2024 17:01, Ayesh Karunaratne wrote: I went ahead and created PR https://github.com/php/php-src/pull/15443 along with tests, UPGRADE notice, etc. I think having a `get_declared_enums` function will be helpful. The implementation is simple and straightforward too. Thanks for creating

Re: [PHP-DEV] String enums & __toString()

2024-08-16 Thread John Coggeshall
On Aug 16 2024, at 6:49 pm, Rob Landers wrote: > > That being said, I would like to be able to use | and & on integer enums more > than I would strings as stringables. Something like “flags” mode in C#. Maybe > even make “flag” a backing type of enums. It would make a ton of json flags > much

Re: [PHP-DEV] Time-out Posting to PHP Internals List

2024-08-16 Thread Juliette Reinders Folmer
On 17-8-2024 0:50, Christoph M. Becker wrote: On 17.08.2024 at 00:36, Rob Landers wrote: But otherwise, I think it is healthy for it to be public. Voices silently silenced, even for a good reason, are never a good thing. Also, it gives people a chance to advocate for the banned or object to t

Re: [PHP-DEV] String enums & __toString()

2024-08-16 Thread John Coggeshall
> To the original question, there's two reasons that __toString() was > deliberately omitted from enums: > > 1. To discourage their use as "fancy strings". Enums are their own type, > independent of any other. Making them usable as 95% strings partially defeats > their purpose. I disagree with

Re: [PHP-DEV][Discussion] Should All String Functions Become Multi-Byte Safe?

2024-08-16 Thread youkidearitai
2024年8月17日(土) 9:17 Mike Schinkel : > > > On Aug 16, 2024, at 8:02 PM, Rowan Tommins [IMSoP] > > wrote: > > On 17 August 2024 00:25:13 BST, Mike Schinkel wrote: > >> I am not sure I agree with you that adding Unicode support is the wrong > >> angle, per se. > >> > >> A strong argument could be m

Re: [PHP-DEV][Discussion] Should All String Functions Become Multi-Byte Safe?

2024-08-16 Thread Mike Schinkel
> On Aug 16, 2024, at 8:02 PM, Rowan Tommins [IMSoP] > wrote: > On 17 August 2024 00:25:13 BST, Mike Schinkel wrote: >> I am not sure I agree with you that adding Unicode support is the wrong >> angle, per se. >> >> A strong argument could be made that Unicode support is a necessary but not

Re: [PHP-DEV][Discussion] Should All String Functions Become Multi-Byte Safe?

2024-08-16 Thread Rowan Tommins [IMSoP]
On 17 August 2024 00:25:13 BST, Mike Schinkel wrote: >I am not sure I agree with you that adding Unicode support is the wrong angle, >per se. > >A strong argument could be made that Unicode support is a necessary but not >sufficient building block for "internationalization support." IOW, if

Re: [PHP-DEV] Should there be a `get_declared_enums()` function ?

2024-08-16 Thread Mike Schinkel
To everyone on this thread and thus nobody in specific (hence my top post): Given that get_declared_*() populates a new ZEND_HASH each time the function is called[1] — which for classes can easily be hundreds of strings — would there be any appetite to: 1. Add an optional parameter — e.g. `get

Re: [PHP-DEV][Discussion] Should All String Functions Become Multi-Byte Safe?

2024-08-16 Thread Rowan Tommins [IMSoP]
On 16 August 2024 23:11:18 BST, Nick Lockheart wrote: >I used the rather broad title "Should All String Functions Become >Multi-Byte Safe" because there are many smaller related topics, but my >intention was to discuss multi-byte in general I think it was probably not the best choice, because

Re: [PHP-DEV][Discussion] Should All String Functions Become Multi-Byte Safe?

2024-08-16 Thread Mike Schinkel
Hi Nick, > On Aug 16, 2024, at 6:11 PM, Nick Lockheart wrote: > > I wanted to reply generally to this and not to any person in > particular, as I'm the one who started the thread. > > I used the rather broad title "Should All String Functions Become > Multi-Byte Safe" because there are many sma

Re: [PHP-DEV][Discussion] Should All String Functions Become Multi-Byte Safe?

2024-08-16 Thread Mike Schinkel
> On Aug 16, 2024, at 3:36 PM, Rowan Tommins [IMSoP] > wrote: > On 16 August 2024 19:44:22 BST, Mike Schinkel wrote: >> Let me see if I understand your argument correctly? You are asserting that >> Unicode is "too complex" to be handled in the standard library so that >> complexity should ins

Re: [PHP-DEV] Time-out Posting to PHP Internals List

2024-08-16 Thread Christoph M. Becker
On 17.08.2024 at 00:36, Rob Landers wrote: > On Fri, Aug 16, 2024, at 22:16, Kris Craig wrote: > >> On Fri, Aug 16, 2024 at 8:11 AM Derick Rethans wrote: >> >>> Hi, >>> >>> In the last months, you have had numerous suggestions to keep it civil >>> on the mailing list, in the "C++ Enhancements" th

Re: [PHP-DEV] String enums & __toString()

2024-08-16 Thread Rob Landers
On Fri, Aug 16, 2024, at 21:57, John Coggeshall wrote: >> Didja really? >> >> https://wiki.php.net/rfc/auto-implement_stringable_for_string_backed_enums > I swear I did. > > That said, looking at that RFC it's a slightly different take than what I am > suggesting. This RFC suggests that `stri

Re: [PHP-DEV] String enums & __toString()

2024-08-16 Thread Larry Garfield
On Fri, Aug 16, 2024, at 5:01 PM, Bilge wrote: > On 16/08/2024 22:51, Gina P. Banyard wrote: >> On Friday, 16 August 2024 at 22:01, Bilge wrote: >>> >>> >>> On Fri, 16 Aug 2024, 20:57 John Coggeshall, wrote: I'm not seeing an obvious upside to forbidding straight out `__toString()`

Re: [PHP-DEV] [DISCUSSION] Class Constant Enums?

2024-08-16 Thread Larry Garfield
On Fri, Aug 16, 2024, at 1:31 PM, Arvids Godjuks wrote: > Hello Larry, > I feel obliged to remind about the 80/20 rule where the last 20% of > progress ends up being 80% of all the work. And from the discussion > it's already looking like there are some major questions and caveats > and engine

Re: [PHP-DEV] Time-out Posting to PHP Internals List

2024-08-16 Thread Rob Landers
On Fri, Aug 16, 2024, at 22:16, Kris Craig wrote: > > > On Fri, Aug 16, 2024 at 8:11 AM Derick Rethans wrote: >> Hi, >> >> In the last months, you have had numerous suggestions to keep it civil >> on the mailing list, in the "C++ Enhancements" thread [1,2,3,4,5,6], and >> multiple other thr

Re: [PHP-DEV][Discussion] Should All String Functions Become Multi-Byte Safe?

2024-08-16 Thread Nick Lockheart
I wanted to reply generally to this and not to any person in particular, as I'm the one who started the thread. I used the rather broad title "Should All String Functions Become Multi-Byte Safe" because there are many smaller related topics, but my intention was to discuss multi-byte in general, a

Re: [PHP-DEV] String enums & __toString()

2024-08-16 Thread Bilge
On 16/08/2024 22:51, Gina P. Banyard wrote: On Friday, 16 August 2024 at 22:01, Bilge wrote: On Fri, 16 Aug 2024, 20:57 John Coggeshall, wrote: I'm not seeing an obvious upside to forbidding straight out |__toString()| I tend to agree, but Crell will drive by in a minute to drop

Re: [PHP-DEV] String enums & __toString()

2024-08-16 Thread Gina P. Banyard
On Friday, 16 August 2024 at 22:01, Bilge wrote: > On Fri, 16 Aug 2024, 20:57 John Coggeshall, wrote: > >> I'm not seeing an obvious upside to forbidding straight out __toString() > > I tend to agree, but Crell will drive by in a minute to drop some > philosophical nonsense about why we're all

Re: [PHP-DEV] Time-out Posting to PHP Internals List

2024-08-16 Thread Christian Schneider
Am 16.08.2024 um 22:16 schrieb Kris Craig : > On Fri, Aug 16, 2024 at 8:11 AM Derick Rethans wrote: > >> You have therefore been given a 3-month timeout, which will be enforced >> by blocking you from sending email to the php.net domain, including >> subdomains. >> > This message kinda freaked

Re: [PHP-DEV] String enums & __toString()

2024-08-16 Thread Faizan Akram Dar
On Fri, Aug 16, 2024, 11:22 PM Bilge wrote: > > > On Fri, 16 Aug 2024, 20:57 John Coggeshall, wrote: > >> >> I'm not seeing an obvious upside to forbidding straight out __toString() >> > > I tend to agree, but Crell will drive by in a minute to drop some > philosophical nonsense about why we're

Re: [PHP-DEV] Time-out Posting to PHP Internals List

2024-08-16 Thread Kris Craig
On Fri, Aug 16, 2024 at 8:11 AM Derick Rethans wrote: > Hi, > > In the last months, you have had numerous suggestions to keep it civil > on the mailing list, in the "C++ Enhancements" thread [1,2,3,4,5,6], and > multiple other threads [7,8,9], and by many individuals. Despite that, > you did cont

Re: [PHP-DEV] String enums & __toString()

2024-08-16 Thread Bilge
On Fri, 16 Aug 2024, 20:57 John Coggeshall, wrote: > > I'm not seeing an obvious upside to forbidding straight out __toString() > I tend to agree, but Crell will drive by in a minute to drop some philosophical nonsense about why we're all wrong :^) Cheers, Bilge

Re: [PHP-DEV] String enums & __toString()

2024-08-16 Thread John Coggeshall
> Didja really? > > https://wiki.php.net/rfc/auto-implement_stringable_for_string_backed_enums I swear I did. That said, looking at that RFC it's a slightly different take than what I am suggesting. This RFC suggests that string enums automatically implement Stringable . I am pointing out that i

Re: [PHP-DEV] String enums & __toString()

2024-08-16 Thread Eugene Sidelnyk
> > Didja really? > > https://wiki.php.net/rfc/auto-implement_stringable_for_string_backed_enums Why has it been withdrawn?

Re: [PHP-DEV] String enums & __toString()

2024-08-16 Thread Bilge
On 16/08/2024 20:39, John Coggeshall wrote: Hey all, I poked around a bit in the Enum RFCs and I could find (maybe I missed) what's up with this: Didja really? https://wiki.php.net/rfc/auto-implement_stringable_for_string_backed_enums

[PHP-DEV] String enums & __toString()

2024-08-16 Thread John Coggeshall
Hey all, I poked around a bit in the Enum RFCs and I could find (maybe I missed) what's up with this: enum Foo:string implements \Stringable { case FOO = 'bar'; public function __toString() { return $this->value; } } PHP Fatal error: Enum Foo cannot include magic method __toString It seems to m

Re: [PHP-DEV][Discussion] Should All String Functions Become Multi-Byte Safe?

2024-08-16 Thread Rowan Tommins [IMSoP]
On 16 August 2024 19:44:22 BST, Mike Schinkel wrote: >Let me see if I understand your argument correctly? You are asserting that >Unicode is "too complex" to be handled in the standard library so that >complexity should instead be shouldered individually by each and every PHP >developer who

Re: [PHP-DEV][Discussion] Should All String Functions Become Multi-Byte Safe?

2024-08-16 Thread Mike Schinkel
> On Aug 12, 2024, at 4:25 PM, Rowan Tommins [IMSoP] > wrote: > > On 12/08/2024 17:37, Mike Schinkel wrote: >> A really standout paragraph from that link is: >> >> "IMO, the whole situation is a shame. Unicode should be >> in the stdlib of every language by default. It’s the lingua >> franca of

[PHP-DEV] [RFC] Re: Decoding HTML and the Ambiguous Ampersand

2024-08-16 Thread Dennis Snell
>On Fri, Aug 16, 2024, at 02:59, Dennis Snell wrote: >> >>> On Jul 9, 2024, at 4:55 PM, Dennis Snell wrote: >>> >>> Greetings all, >>> >>> The `html_entity_decode( … ENT_HTML5 … )` function has a number of issues >>> that I’d like to correct. >>> >>> - It’s missing 720 of HTML5’s specified na

Re: [PHP-DEV] [DISCUSSION] Class Constant Enums?

2024-08-16 Thread Arvids Godjuks
On Fri, 16 Aug 2024 at 17:18, Larry Garfield wrote: > On Fri, Aug 16, 2024, at 6:35 AM, Alexandru Pătrănescu wrote: > > Hi Nick, > >> > >> Is there any interest in having enums as class constants? > >> > >> I'm often finding cases where I would like to have an enum inside of a > >> class, but don

Re: [PHP-DEV] [DISCUSSION] Class Constant Enums?

2024-08-16 Thread Arvids Godjuks
On Fri, 16 Aug 2024 at 04:37, Nick Lockheart wrote: > Hi, > > Is there any interest in having enums as class constants? > > I'm often finding cases where I would like to have an enum inside of a > class, but don't want a free-floating enum that's basically like > another class. > > When dealing w

Re: [PHP-DEV] [DISCUSSION] Class Constant Enums?

2024-08-16 Thread John Bafford
On Aug 16, 2024, at 10:17, Larry Garfield wrote: > > I would have to research to see if other languages did this, but one option > would be to allow an inner class to extend an outer class even if it's final, > which would essentially give us sealed classes for free: > > final class Outer > {

Re: [PHP-DEV] Should there be a `get_declared_enums()` function ?

2024-08-16 Thread Nicolas Grekas
On Fri, 16 Aug 2024, 16:46 Christoph M. Becker, wrote: > On 16.08.2024 at 17:11, Nicolas > > > > And here is a one liner: > > > > function get_declared_enums() { > > return array_filter(get_declared_classes(), 'enum_exists'); > > } > > Nice! > > Are you suggesting that there is n

Re: [PHP-DEV] Should there be a `get_declared_enums()` function ?

2024-08-16 Thread Bilge
On Fri, 16 Aug 2024, 16:46 Christoph M. Becker, wrote: > On 16.08.2024 at 17:11, Nicolas > > > > And here is a one liner: > > > > function get_declared_enums() { > > return array_filter(get_declared_classes(), 'enum_exists'); > > } > > Nice! > > Are you suggesting that there is n

Re: [PHP-DEV] Should there be a `get_declared_enums()` function ?

2024-08-16 Thread Christoph M. Becker
On 16.08.2024 at 17:01, Ayesh Karunaratne wrote: >> Porting this to C is left as an excercise for the reader. ;) Hint: >> > > I went ahead and created PR https://github.com/php

Re: [PHP-DEV] Should there be a `get_declared_enums()` function ?

2024-08-16 Thread Christoph M. Becker
On 16.08.2024 at 17:11, Nicolas Grekas wrote: >> Should a `get_declared_enums()` function be added ? >> >> Here we go: >> >> function get_declared_enums() { >> $enums = []; >> $exts = get_loaded_extensions(false); >> foreach ($exts as $ext) { >> $re = new Re

Re: [PHP-DEV] Should there be a `get_declared_enums()` function ?

2024-08-16 Thread Nicolas Grekas
> Should a `get_declared_enums()` function be added ? > > Here we go: > > function get_declared_enums() { > $enums = []; > $exts = get_loaded_extensions(false); > foreach ($exts as $ext) { > $re = new ReflectionExtension($ext); > $classes = $re->g

[PHP-DEV] Time-out Posting to PHP Internals List

2024-08-16 Thread Derick Rethans
Hi, In the last months, you have had numerous suggestions to keep it civil on the mailing list, in the "C++ Enhancements" thread [1,2,3,4,5,6], and multiple other threads [7,8,9], and by many individuals. Despite that, you did continue with ad hominems and related belligerent language, borderi

Re: [PHP-DEV] Should there be a `get_declared_enums()` function ?

2024-08-16 Thread Ayesh Karunaratne
> Porting this to C is left as an excercise for the reader. ;) Hint: > > I went ahead and created PR https://github.com/php/php-src/pull/15443 along with tests, UPGRADE notice,

Re: [PHP-DEV] Re: Decoding HTML and the Ambiguous Ampersand

2024-08-16 Thread Rob Landers
On Fri, Aug 16, 2024, at 02:59, Dennis Snell wrote: > >> On Jul 9, 2024, at 4:55 PM, Dennis Snell wrote: >> >> Greetings all, >> >> The `html_entity_decode( … ENT_HTML5 … )` function has a number of issues >> that I’d like to correct. >> >> - It’s missing 720 of HTML5’s specified named cha

Re: [PHP-DEV] [DISCUSSION] Class Constant Enums?

2024-08-16 Thread Rob Landers
On Fri, Aug 16, 2024, at 16:17, Larry Garfield wrote: > On Fri, Aug 16, 2024, at 6:35 AM, Alexandru Pătrănescu wrote: > > Hi Nick, > >> > >> Is there any interest in having enums as class constants? > >> > >> I'm often finding cases where I would like to have an enum inside of a > >> class, but d

Re: [PHP-DEV] [DISCUSSION] Class Constant Enums?

2024-08-16 Thread Larry Garfield
On Fri, Aug 16, 2024, at 6:35 AM, Alexandru Pătrănescu wrote: > Hi Nick, >> >> Is there any interest in having enums as class constants? >> >> I'm often finding cases where I would like to have an enum inside of a >> class, but don't want a free-floating enum that's basically like >> another clas

Re: [PHP-DEV] [DISCUSSION] Class Constant Enums?

2024-08-16 Thread Alexandru Pătrănescu
Hi Nick, > > Is there any interest in having enums as class constants? > > I'm often finding cases where I would like to have an enum inside of a > class, but don't want a free-floating enum that's basically like > another class. > > .. > > class SSHClient { > >public const enum CommandR

Re: [PHP-DEV] Should there be a `get_declared_enums()` function ?

2024-08-16 Thread Christoph M. Becker
On 15.08.2024 at 03:51, Juliette Reinders Folmer wrote: > Should a `get_declared_enums()` function be added ? Here we go: function get_declared_enums() { $enums = []; $exts = get_loaded_extensions(false); foreach ($exts as $ext) { $re = new ReflectionExten

Re: [PHP-DEV] Should there be a `get_declared_enums()` function ?

2024-08-16 Thread Alexandru Pătrănescu
Hey Juliette, > Should a `get_declared_enums()` function be added ? > Yes And should the `get_declared_classes()` function be adjusted to exclude > enums ? > No You listed these entities: classes, interfaces, traits and enums. But while there is a clear differentiation between what is conside