Re: [PHP-DEV] [RFC][Discussion] Objects can be declared falsifiable

2022-11-03 Thread Michał Marcin Brzuchalski
> > if ($response->getStatusCode() > 199 and $response->getStatusCode() < 300) > { > // do something with “true” - which has a range of 100 possibilities at > a granular level, which we could respond to differently - possible to > interact with $response > > } > // do something with “false” - whi

Re: [PHP-DEV] [RFC][Discussion] Objects can be declared falsifiable

2022-11-03 Thread Josh Bruce
> while declaring an object falsifiable changes the semantics of `if ($obj)`. Got me thinking, appreciate that. In PHP: false == empty == null (Originally the RFC was geared toward data objects being able to natively express emptiness when passed to empty() - might be beneficial for the S

Re: [PHP-DEV] [RFC] Destructuring Coalesce

2022-11-03 Thread Bob Weinand
> Am 03.11.2022 um 20:55 schrieb Tim Düsterhus : > > Hi > > On 10/16/22 23:11, Bob Weinand wrote: >> I've written a small RFC about adding coalesce ability to list() >> destructuring. >> This should enhance the ability to easily, concisely and readably >> destructure arrays with default values.

Re: [PHP-DEV] [RFC] Destructuring Coalesce

2022-11-03 Thread Tim Düsterhus
Hi On 10/16/22 23:11, Bob Weinand wrote: I've written a small RFC about adding coalesce ability to list() destructuring. This should enhance the ability to easily, concisely and readably destructure arrays with default values. https://wiki.php.net/rfc/destructuring_coalesce

Re: [PHP-DEV] [RFC] Destructuring Coalesce

2022-11-03 Thread Bob Weinand
Hey, > Am 16.10.2022 um 23:56 schrieb David Rodrigues : > > I like it! > > But what should happen if: > > [ $a ?? '123', $b ] = []; $a is assigned 123, $b emits undefined key error. > [ $a ?? '123', $b ] = [ 1 ]; $a is assigned 1, $b emits undefined key error. > [ $a ?? '123', $b ] = [ 1, 2

Re: [PHP-DEV] ARRAY_UNIQUE_IDENTICAL option

2022-11-03 Thread someniatko
> To solve this, I propose adding an ARRAY_UNIQUE_IDENTICAL option that > can be passed to array_uniques $flags which uses identical operator > (===) semantics. Internally it uses a new hashmap that allows using > arbitrary PHP values as keys to efficiently remove duplicates. This is > slightly ove

[PHP-DEV] ARRAY_UNIQUE_IDENTICAL option

2022-11-03 Thread Ilija Tovilo
Hi internals There's an open bug report that array_unique doesn't work for enums: https://github.com/php/php-src/issues/9775 This comes down to the fact that array_unique internally sorts the array before iterating over it to remove duplicates, and that enums are intentionally incomparable.

[PHP-DEV] Re: hello!

2022-11-03 Thread Christoph M. Becker
On 03.11.2022 at 11:33, 8ctopus wrote: > I would like to publish my first RFC: > > https://github.com/php/php-src/issues/9216#issuecomment-1212735419 > > I would be grateful if someone could grant me access or publish the RFC > on my behalf. RFC karma granted. Best of luck with the RFC! :) -- C

[PHP-DEV] hello!

2022-11-03 Thread 8ctopus
Hello everyone, I would like to publish my first RFC: https://github.com/php/php-src/issues/9216#issuecomment-1212735419 I would be grateful if someone could grant me access or publish the RFC on my behalf. Sincerely, David aka 8ctopus -- PHP Internals - PHP Runtime Development Mailing List

[PHP-DEV] PHP 7.4.33 Released!

2022-11-03 Thread Derick Rethans
The PHP development team announces the immediate availability of PHP 7.4.33. This is security release that fixes an OOB read due to insufficient input validation in imageloadfont(), and a buffer overflow in hash_update() on long parameter. All PHP 7.4 users are encouraged to upgrade to this versi

Re: [PHP-DEV] [RFC][Discussion] Objects can be declared falsifiable

2022-11-03 Thread Claude Pache
> Le 3 nov. 2022 à 02:51, Josh Bruce a écrit : > > Similar to: > > function x(?SomeType $arg): ?SomeOtherType > > Instead of: > > function x(SomeType|null $arg): SomeType|null > > Both are the same thing under the hood. The big difference between `?SomeType` shortcut and falsifiable object