[Discussion] Promoting declare failure notices to exceptions?
| From: | Mark Randall | Date: | Sat, 14 Mar 2020 20:19:39 +0000 |
| Subject: | [Discussion] Promoting declare failure notices to exceptions? | ||
| Groups: | php.internals | ||
| Request: | Send a blank email to internals+get-109020@lists.php.net to get a copy of this message | ||
Greetings,
I have created a PR that will throw exceptions when using define()
with invalid types or when trying to redefine.
Trying to redefine a constant or define a bad constant would throw a
ValueError on the name parameter, trying to pass an unsupported type
would give a TypeError on the value parameter.
Normal promotions are fairly run of the mill, however for some utterly
bizarre reason the existing behaviour is to print a notice and not a
warning as with almost all other functions that are failing.
Is there a good reason not to promote these to exceptions?
https://github.com/php/php-src/pull/5265
--
Mark Randall
marandall@php.net