Re: [RFC] Undefined Variable Error Promotion

From: Date: Tue, 22 Feb 2022 11:32:48 +0000
Subject: Re: [RFC] Undefined Variable Error Promotion
References: 1 2  Groups: php.internals 
Request: Send a blank email to internals+get-117114@lists.php.net to get a copy of this message
On 18/02/2022 11:23, Rowan Tommins wrote:
- undefined array keys - undefined object properties - array access on a non-array - property access on a non-object
I'd encourage those to be discussed, but they are unrelated to this RFC. I think most of them would pass fairly easily, but undefined array keys is out the outlier and has a reasonable chance of being rejected at this time. However, with their being 4 years before the launch of 9.0 (and the next opportunity to change it) opinion may change between now and then. I've updated the RFC to define accessing a variable as attempting to read its value for use in an expression without accounting for the possibility of it being unset. I have also included the warning message to narrow this down further, and noted that things which account for undefined variables such as isset, empty and null coalesce will remain unaffected. If there's am existing formal definition someone wishes to contribute, I'd be happy to update it. One thing maybe worth mentioning is that while most operators such as ++, +=, .= etc will be covered by this change, $undefined[] = 1; will not be. Mark Randall

« previous php.internals (#117114) next »