Re: [PHP-DEV] Undefined variables and the array append operator

2022-03-30 Thread Robert Landers
On Tue, Mar 29, 2022 at 9:44 PM Rowan Tommins wrote: > > Hi all, > > If $foo is not defined, statements such as $foo += 1 and $foo .= 'blah' > raise "undefined variable" Warnings in PHP 8, and will throw Errors in > PHP 9. However, the very similar looking $foo[] = 1 succeeds silently. > > This

Re: [PHP-DEV] Typed constants revisited

2022-03-30 Thread Mark Niebergall
Alex, On Tue, Mar 29, 2022 at 10:35 PM Alexandru Pătrănescu wrote: > Hey Mark, > > > On Wed, Mar 30, 2022 at 6:03 AM Mark Niebergall > wrote: > >> >> I have updated the RFC https://wiki.php.net/rfc/typed_class_constants >> with >> more details and examples from this thread, and updated the RFC

[PHP-DEV] Re: Undefined variables and the array append operator

2022-03-30 Thread Björn Larsson via internals
Den 2022-03-29 kl. 21:44, skrev Rowan Tommins: Hi all, If $foo is not defined, statements such as $foo += 1 and $foo .= 'blah' raise "undefined variable" Warnings in PHP 8, and will throw Errors in PHP 9. However, the very similar looking $foo[] = 1 succeeds silently. This seems odd to me,

Re: [PHP-DEV] Re: Undefined variables and the array append operator

2022-03-30 Thread Hans Henrik Bergan
> RFC. There are other inconsistencies as well now, depending on how the undefined variable comes to exist absolutely, but shouldn't try to do too much in a single rfc, wouldn't want it to be rejected for the wrong reasons ^^ On Wed, 30 Mar 2022 at 12:17, Björn Larsson via internals <

[PHP-DEV] ZEND_VM_HOT is ZEND_COLD?

2022-03-30 Thread Su, Tao
Dear PHP Internals, I am looking at zend_vm_execute.h file and found some lines of code which I do not quite get. Who can help tell that why we should have ZEND_COLD attribute in ZEND_VM_HOT line definition, or I can simply ignore it as it is trivial? Thanks. # if (ZEND_VM_KIND ==

Re: [PHP-DEV] Undefined variables and the array append operator

2022-03-30 Thread Rowan Tommins
On 30/03/2022 15:32, Guilliam Xavier wrote: On the other hand, I agree that `$undefined[] = $x` looks like a bug... are both cases the exact same opcode? Some very good points raised in this thread about how many different closely-related cases there are here. I shall have to think clearly

Re: [PHP-DEV] Undefined variables and the array append operator

2022-03-30 Thread Claude Pache
> Le 29 mars 2022 à 21:44, Rowan Tommins a écrit : > > Hi all, > > If $foo is not defined, statements such as $foo += 1 and $foo .= 'blah' raise > "undefined variable" Warnings in PHP 8, and will throw Errors in PHP 9. > However, the very similar looking $foo[] = 1 succeeds silently. > >

Re: [PHP-DEV] Undefined variables and the array append operator

2022-03-30 Thread Guilliam Xavier
Hi Rowan, Not really a "compelling reason why we should keep this inconsistency", but I have occasionally relied on array autovivification *for sub-dimensions*, e.g.: ``` function f(iterable $xs) { $map = []; // initialization! foreach ($xs as $x) { // $map[foo($x)] ??= []; not

Re: [PHP-DEV] Undefined variables and the array append operator

2022-03-30 Thread Peter Bowyer
On Wed, 30 Mar 2022 at 15:33, Guilliam Xavier wrote: > Not really a "compelling reason why we should keep this inconsistency", but > I have occasionally relied on array autovivification *for sub-dimensions*, > I rely on this often when remapping data for analysis. These scripts are run a

Re: [PHP-DEV] Typed constants revisited

2022-03-30 Thread Alexandru Pătrănescu
Hey Mark, On Wed, Mar 30, 2022 at 4:01 PM Mark Niebergall wrote: > Alex, > > On Tue, Mar 29, 2022 at 10:35 PM Alexandru Pătrănescu > wrote: > >> Hey Mark, >> >> >> On Wed, Mar 30, 2022 at 6:03 AM Mark Niebergall >> wrote: >> >>> >>> I have updated the RFC

Re: [PHP-DEV] Typed constants revisited

2022-03-30 Thread Guilliam Xavier
Hi Mark, I have updated the RFC https://wiki.php.net/rfc/typed_class_constants with >>> more details and examples from this thread, and updated the RFC status to >>> Under Discussion. Hopefully the updated RFC helps answer questions and >>> clarifies what the proposal includes. >>> >> Thanks (I

Re: [PHP-DEV] Undefined variables and the array append operator

2022-03-30 Thread Larry Garfield
On Wed, Mar 30, 2022, at 9:11 AM, Claude Pache wrote: >> Le 29 mars 2022 à 21:44, Rowan Tommins a écrit : >> >> Hi all, >> >> If $foo is not defined, statements such as $foo += 1 and $foo .= 'blah' >> raise "undefined variable" Warnings in PHP 8, and will throw Errors in PHP >> 9. However,

Re: [PHP-DEV] Typed constants revisited

2022-03-30 Thread Mark Niebergall
Alex, On Wed, Mar 30, 2022 at 7:47 AM Alexandru Pătrănescu wrote: > Hey Mark, > > On Wed, Mar 30, 2022 at 4:01 PM Mark Niebergall > wrote: > >> Alex, >> >> On Tue, Mar 29, 2022 at 10:35 PM Alexandru Pătrănescu >> wrote: >> >>> Hey Mark, >>> >>> >>> On Wed, Mar 30, 2022 at 6:03 AM Mark

Re: [PHP-DEV] Typed constants revisited

2022-03-30 Thread Mark Niebergall
Guilliam, On Wed, Mar 30, 2022 at 7:50 AM Guilliam Xavier wrote: > Hi Mark, > > I have updated the RFC https://wiki.php.net/rfc/typed_class_constants with more details and examples from this thread, and updated the RFC status to Under Discussion. Hopefully the updated RFC helps

Re: [PHP-DEV] Typed constants revisited

2022-03-30 Thread Guilliam Xavier
> Ah yes, I hadn't considered expanding this RFC to namespaced and global > constants. Let me mull over implementation syntax for those and include > them in the RFC. My initial reaction is to not include those in this RFC, > keeping the scope to just class constants. If there is value in typing >