Re: [PHP-DEV] [Vote] Partial Function Application

2021-06-18 Thread Hamza Ahmad
HI Larry Garfield, Do you have a plan to further extend this rfc? I mean, what if one could typecast place holders? Broadly speaking, what if one could perform some operations, such as arithmetic, bitwise, and type cast as said above? `$foo = bar((type) ?);` `$foo = bar(? & 0xFF);` Best Hamza

Re: [PHP-DEV] [Vote] Partial Function Application

2021-06-18 Thread Patrick ALLAERT
Le sam. 19 juin 2021 à 01:41, Benjamin Eberlei a écrit : > On Wed, Jun 16, 2021 at 6:17 PM Larry Garfield > wrote: > > > Hi folks. The vote for the Partial Function Application RFC is now open, > > and will run until 30 June. > > > > https://wiki.php.net/rfc/partial_function_application > > >

Re: [PHP-DEV] [Vote] Partial Function Application

2021-06-18 Thread Benjamin Eberlei
On Wed, Jun 16, 2021 at 6:17 PM Larry Garfield wrote: > Hi folks. The vote for the Partial Function Application RFC is now open, > and will run until 30 June. > > https://wiki.php.net/rfc/partial_function_application > > Of particular note, a few people had asked about using ...? instead of ...

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

2021-06-18 Thread Rowan Tommins
On 18/06/2021 22:16, Derick Rethans wrote: strftime is infected by thread unsafe locales, which is plenty of reason to deprecate it, with additional pro reasons for doing so being its disparate functionality among different os-es and libc's. Deprecation also doesn't mean removal, which won't

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

2021-06-18 Thread Derick Rethans
On 18 June 2021 19:33:09 BST, Rowan Tommins wrote: >On 15/06/2021 11:53, Nikita Popov wrote: >> Feedback on the proposed deprecations is appreciated. Personally, the >two >> I'm unsure about are "get_class(), get_parent_class() and >> get_called_class() without argument" which are mostly

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

2021-06-18 Thread Rowan Tommins
On 15/06/2021 11:53, Nikita Popov wrote: Feedback on the proposed deprecations is appreciated. Personally, the two I'm unsure about are "get_class(), get_parent_class() and get_called_class() without argument" which are mostly stylistic in nature, and "strftime() and gmtstrftime()", where the

Re: [PHP-DEV] [RFC] is_literal

2021-06-18 Thread Joe Watkins
Refcounted* not recounted ... Predictive text on phone ... Cheers Joe On Friday, 18 June 2021, Joe Watkins wrote: > Just to explain this tracking of longs. > > We can track strings because there's space to do that in GC info which > recounted types all have. > > Where things aren't recounted

Re: [PHP-DEV] [RFC] is_literal

2021-06-18 Thread Joe Watkins
Just to explain this tracking of longs. We can track strings because there's space to do that in GC info which recounted types all have. Where things aren't recounted there is no usable space on the value to store the literal flag without disabling some internal assumptions about type flags. We

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

2021-06-18 Thread Craig Francis
On Fri, 18 Jun 2021 at 15:47, Bruce Weirdan wrote: > One would be potential denial of service prevention (e.g. with enormous > `LIMIT` value where only a limited set of ints was intended. > [...] Here you really *don't* want $allowed_ids to include user input. The developer is writing this

Re: [PHP-DEV] Simple support question, about object equality

2021-06-18 Thread Pierre
Le 18/06/2021 à 18:08, Nikita Popov a écrit : == comparison on objects is a == comparison on the properties. Whether the properties are private doesn't (and shouldn't) matter. Regards, Nikita Thanks a lot for your answer. This raises more question in my mind: I need to rephrase here. My

Re: [PHP-DEV] Simple support question, about object equality

2021-06-18 Thread Nikita Popov
On Fri, Jun 18, 2021 at 5:57 PM Pierre wrote: > This code: > > > declare(strict_types=1); > > class Foo > { > public string $foo; > > public function __construct( > string $foo > ) { > $this->foo = $foo; > } > } > > $a = new Foo('bar'); > $b = new

Re: [PHP-DEV] Simple support question, about object equality

2021-06-18 Thread Pierre
OK sorry for the noise, I missed this https://www.php.net/manual/en/language.oop5.object-comparison.php Fun fact, writing PHP since PHP 3, and I never knew this. Doesn't it seems like a dangerous behavior ? Regards, -- Pierre -- PHP Internals - PHP Runtime Development Mailing List To

[PHP-DEV] Simple support question, about object equality

2021-06-18 Thread Pierre
This code: foo = $foo;     } } $a = new Foo('bar'); $b = new Foo('buzz'); $c = new Foo('bar'); echo "\$a == \$b: "; var_dump($a == $b); echo "\$a == \$c: "; var_dump($a == $c); echo "\$a != \$b: "; var_dump($a != $b); echo "\$a != \$c: "; var_dump($a != $c); echo "\$a === \$b: "; var_dump($a

Re: [PHP-DEV] [RFC][DISCUSSION] Match expression v2

2021-06-18 Thread Guilliam Xavier
On Fri, Jun 18, 2021 at 4:24 PM Larry Garfield wrote: > On Thu, Jun 17, 2021, at 1:49 PM, Mark Tomlin wrote: > > Please excuse the year long bump, but I was hoping to draw some more > > attention to the implicit "match (true)" case. I'm just a regular user of > > PHP, nothing too fancy, just one

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

2021-06-18 Thread Bruce Weirdan
On Fri, Jun 18, 2021 at 4:53 PM Craig Francis wrote: > While philosophically more pure, there is actually no extra security > benefit for excluding integers. One would be potential denial of service prevention (e.g. with enormous `LIMIT` value where only a limited set of ints was intended, like

[PHP-DEV] Checking that Closure is static

2021-06-18 Thread Дмитрий Елисеев
Hello! When I use a static anonymous function as an HTTP-action in some frameworks like: $app = new App(); $app->get('/', static function () { return new Response('Hello!); }) I get a warning "Cannot bind an instance to a static closure" in every $closure->bind($container) call inside of the

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

2021-06-18 Thread Dik Takken
On 18-06-2021 13:25, Pierre wrote: > Le 18/06/2021 à 12:45, Guilliam Xavier a écrit : >> IIUC, with the addition of integers, the function will return true for >> e.g. >> `'SELECT * FROM foo LIMIT ' . (int)$limit` even if $limit doesn't come >> from >> a "static" value (e.g. random_int() or even

Re: [PHP-DEV] [RFC][DISCUSSION] Match expression v2

2021-06-18 Thread Larry Garfield
On Thu, Jun 17, 2021, at 1:49 PM, Mark Tomlin wrote: > Please excuse the year long bump, but I was hoping to draw some more > attention to the implicit "match (true)" case. I'm just a regular user of > PHP, nothing too fancy, just one of the many, many people around the world > who use PHP. When I

Re: [PHP-DEV] [Vote] Partial Function Application

2021-06-18 Thread Nikita Popov
On Wed, Jun 16, 2021 at 6:17 PM Larry Garfield wrote: > Hi folks. The vote for the Partial Function Application RFC is now open, > and will run until 30 June. > > https://wiki.php.net/rfc/partial_function_application > > Of particular note, a few people had asked about using ...? instead of ...

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

2021-06-18 Thread Craig Francis
On Fri, 18 Jun 2021 at 12:25 pm, Pierre wrote: > Le 18/06/2021 à 12:45, Guilliam Xavier a écrit : > > IIUC, with the addition of integers, the function will return true for > e.g. > > `'SELECT * FROM foo LIMIT ' . (int)$limit` even if $limit doesn't come > from > > a "static" value (e.g.

Re: [PHP-DEV] [RFC] is_literal

2021-06-18 Thread Mike Schinkel
> On Jun 18, 2021, at 8:30 AM, Mike Schinkel wrote: > > >> On Jun 18, 2021, at 7:22 AM, Craig Francis > > wrote: >> >> On Fri, 18 Jun 2021 at 11:45 am, Guilliam Xavier > > >> wrote: >> >>> IIUC, with the addition of

Re: [PHP-DEV] [RFC] is_literal

2021-06-18 Thread Mike Schinkel
> On Jun 18, 2021, at 7:22 AM, Craig Francis wrote: > > On Fri, 18 Jun 2021 at 11:45 am, Guilliam Xavier > wrote: > >> IIUC, with the addition of integers, the function will return true for e.g. >> `'SELECT * FROM foo LIMIT ' . (int)$limit` even if $limit doesn't come from >> a "static" value

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

2021-06-18 Thread Pierre
Le 18/06/2021 à 12:45, Guilliam Xavier a écrit : IIUC, with the addition of integers, the function will return true for e.g. `'SELECT * FROM foo LIMIT ' . (int)$limit` even if $limit doesn't come from a "static" value (e.g. random_int() or even `$_GET['limit']`) OK I get it. I followed the

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

2021-06-18 Thread Craig Francis
On Fri, 18 Jun 2021 at 11:45 am, Guilliam Xavier wrote: > IIUC, with the addition of integers, the function will return true for e.g. > `'SELECT * FROM foo LIMIT ' . (int)$limit` even if $limit doesn't come from > a "static" value (e.g. random_int() or even `$_GET['limit']`) Yes, that’s

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

2021-06-18 Thread Andreas Leathley
On 18.06.21 08:00, Craig Francis wrote: As there’s been no issues raised with supporting integers, and doing so will help adoption, the implementation will be updated to allow them. Now to choose the name, with the options is_known() from Joe and is_trusted() from Moritz:

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

2021-06-18 Thread Guilliam Xavier
On Fri, Jun 18, 2021 at 12:10 PM Pierre wrote: > Le 18/06/2021 à 08:00, Craig Francis a écrit : > > As there’s been no issues raised with supporting integers, and doing so > > will help adoption, the implementation will be updated to allow them. > > > > Now to choose the name, with the options

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

2021-06-18 Thread Craig Francis
On Fri, 18 Jun 2021 at 9:48 am, Marc Bennewitz wrote: > Not sure but what happens if you have like a DB connection in big5, > sjis, ... and add an integer as ASCII char into it? But that's the only > edge case I can think of. The integer character code points are the same in all three. PHP

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

2021-06-18 Thread Pierre
Le 18/06/2021 à 08:00, Craig Francis a écrit : As there’s been no issues raised with supporting integers, and doing so will help adoption, the implementation will be updated to allow them. Now to choose the name, with the options is_known() from Joe and is_trusted() from Moritz:

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

2021-06-18 Thread Pierre
Le 18/06/2021 à 11:41, Craig Francis a écrit : Hi Pierre, On Monday we had the discussion about types: https://externals.io/message/114835#114846 The RFCs Future Scope was updated to note the suggestion from someniatko and Matthew about how this could be a type in the future (Joe has also

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

2021-06-18 Thread Craig Francis
On Fri, 18 Jun 2021 at 8:48 am, Pierre wrote: > Le 18/06/2021 à 08:00, Craig Francis a écrit : > > Keep in mind it might also become a dedicated type in the future. > > Hello, > > If so, why the question should not be about the type name instead ? It > might raises different concerns and new

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

2021-06-18 Thread Marc Bennewitz
On 18.06.21 08:00, Craig Francis wrote: On Wed, 16 Jun 2021 at 18:24, Craig Francis wrote: On Sat, 12 Jun 2021 at 18:00, Craig Francis wrote: I'd like to start the discussion on the is_literal() RFC: https://wiki.php.net/rfc/is_literal Following up on the is_literal() RFC, thanks for

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

2021-06-18 Thread Pierre
Le 18/06/2021 à 08:00, Craig Francis a écrit : Keep in mind it might also become a dedicated type in the future. Hello, If so, why the question should not be about the type name instead ? It might raises different concerns and new arguments to this discussion ? What is this type ? What

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

2021-06-18 Thread Paul Crovella
On Thu, Jun 17, 2021 at 11:01 PM Craig Francis wrote: > > As there’s been no issues raised with supporting integers, and doing so > will help adoption, the implementation will be updated to allow them. > > Now to choose the name, with the options is_known() from Joe and > is_trusted() from

[PHP-DEV] Re: [RFC] is_literal

2021-06-18 Thread Craig Francis
On Wed, 16 Jun 2021 at 18:24, Craig Francis wrote: > On Sat, 12 Jun 2021 at 18:00, Craig Francis > wrote: > >> I'd like to start the discussion on the is_literal() RFC: >> https://wiki.php.net/rfc/is_literal >> > > Following up on the is_literal() RFC, thanks for the feedback. It looks > like