Le lundi 14 mars 2022, 18:18:55 CET Mark Randall a écrit :
I have started the vote for promoting undefined variable access to throw
an Error exception.The vote will run for 2 weeks until March 28th 2022.
This does not mention properties, are they concerned by the change? What about array keys?
Côme
Le lundi 14 mars 2022, 18:18:55 CET Mark Randall a écrit :
I have started the vote for promoting undefined variable access to throw
an Error exception.The vote will run for 2 weeks until March 28th 2022.
This does not mention properties, are they concerned by the change? What about array keys?
The RFC states:
| If the code does not currently emit a “Warning: Undefined variable
| $varname” then it is out of scope for this RFC. This RFC does NOT
| apply to array indexes.
That explicitly excludes undefined array indexes, and apparently also
excludes undefined properties (which raise "Warning: Undefined property:")
--
Christoph M. Becker
Christoph M. Becker wrote on 15/3/22 19:17:
Le lundi 14 mars 2022, 18:18:55 CET Mark Randall a écrit :
I have started the vote for promoting undefined variable access to throw
an Error exception.The vote will run for 2 weeks until March 28th 2022.
https://wiki.php.net/rfc/undefined_variable_error_promotion
This does not mention properties, are they concerned by the change? What about array keys?
The RFC states:| If the code does not currently emit a “Warning: Undefined variable
| $varname” then it is out of scope for this RFC. This RFC does NOT
| apply to array indexes.That explicitly excludes undefined array indexes, and apparently also
excludes undefined properties (which raise "Warning: Undefined property:")
AFAIU error promotion for undefined properties has already been covered
by the Deprecate Dynamic Properties RFC
https://wiki.php.net/rfc/deprecate_dynamic_properties, which will
start throwing errors in 9.0.
On Tue, Mar 15, 2022 at 2:08 PM Miguel Rosales mrosalessueiro@gmail.com
wrote:
The RFC states:
| If the code does not currently emit a “Warning: Undefined variable
| $varname” then it is out of scope for this RFC. This RFC does NOT
| apply to array indexes.That explicitly excludes undefined array indexes, and apparently also
excludes undefined properties (which raise "Warning: Undefined
property:")AFAIU error promotion for undefined properties has already been covered
by the Deprecate Dynamic Properties RFC
https://wiki.php.net/rfc/deprecate_dynamic_properties, which will
start throwing errors in 9.0.
What I'm hearing is that we also need an RFC for promoting 'Undefined
index...' warnings to Errors as well.
-Sara
What I'm hearing is that we also need an RFC for promoting 'Undefined
index...' warnings to Errors as well.
We do. If it would pass or not is another matter, it would need someone
braver than I to take it up.
I think there's some other engine stragglers, e.g. foreach must be type
array|object comes to mind, that should really be an exception, maybe
array to string conversion too.
Who knows, maybe PHP 9 can be the version that removes remove all
warnings from the zend engine.
Am 15.03.2022 um 20:07 schrieb Miguel Rosales mrosalessueiro@gmail.com:
Christoph M. Becker wrote on 15/3/22 19:17:
That explicitly excludes undefined array indexes, and apparently also
excludes undefined properties (which raise "Warning: Undefined property:")AFAIU error promotion for undefined properties has already been covered by the Deprecate Dynamic Properties RFC <https://wiki.php.net/rfc/deprecate_dynamic_properties https://wiki.php.net/rfc/deprecate_dynamic_properties>, which will start throwing errors in 9.0.
That RFC covers the creation of undefined properties, not the reading of undefined properties.
- Chris