On 17/02/2022 23:28, Mark Randall wrote:
I present:
https://wiki.php.net/rfc/undefined_variable_error_promotion
It would be good to have a "Scope" or "Unaffected Functionality" section
here, because there are a number of closely related things which were
also raised from Notice to Warning in 8.0:
- undefined array keys
- undefined object properties
- array access on a non-array
- property access on a non-object
I think it is sensible to discuss those separately, but it would be good
to make that clear.
Similarly, it would be good to have more discussion of what "accessing"
means, as the current examples are quite narrow, only showing direct use
and the ++ operator. Other functionality potentially affected:
- passing the variable to a function, presumably excluding by-reference
parameters which don't currently warn
- all the combined assignment operators -
https://www.php.net/manual/en/language.operators.assignment.php
- the array append operator ($a[] = 42;) does NOT currently give an
undefined variable Warning
- variable variables, e.g. "$b = 'a'; echo $$b;"
- the compact() pseudo-function
There's probably others that I've missed.
Regards,
--
Rowan Tommins
[IMSoP]
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: https://www.php.net/unsub.php