On Wed, Jan 28, 2015 at 4:42 PM, Rowan Collins <rowan.coll...@gmail.com>
wrote:

> Ferenc Kovacs wrote on 28/01/2015 12:13:
>
>>
>>     E_DEPRECATED is likely to be even more ignored than E_NOTICE, so
>>     would be a step backwards; my whole assumption is that most people
>>     getting the message are not using a deprecated feature, but
>>     accidentally mis-typing a constant or keyword. I'd be happy with
>>     raising it to E_WARNING to make it more noticeable, though, if we
>>     don't think removing the functionality is acceptable.
>>
>>
>> turn it into E_WARNING if we are planning to keep the feature, turn it
>> into E_DEPRECATED if we want to remove the feature later on.
>>
>
> I see absolutely no advantage in changing this into E_DEPRECATED, as it's
> even more likely to be hidden or ignored than E_NOTICE.
>

removing a feature (which is present in the language since 4.0, probably
even previously) without marking it deprecated first would be a rude move
imo.
so if we want to remove it, I can't see any other way.


>
> There are actually two parts to the message: that you used an undefined
> constant, and that PHP interpreted this as you wanting a string. If you
> really intended a string, then "deprecated" is relevant; but if you
> intended a keyword or constant, then there is nothing to deprecate, it's
> just an error.
>

yeah, the problem is that we can't tell, what was the intention from the
author, so while I can see how this behavior can cause huge WTF moments for
our users (http://3v4l.org/QW8qV), but there are still a bunch of code out
there relying on it.
having a php version where it is E_DEPRECATED allows people to upgrade to
that version, log the deprecated messages and fix their code.
(ofc. you can also try to detect this specific usage with static analysis,
but that would still miss dynamic usages like eval).


>
> If we want to keep the string fallback for now, how about we raise the
> severity to E_WARNING, and change the message to mention deprecation?
> e.g.
> Warning: Use of undefined constant foo - assumed 'foo', but this behaviour
> will change in a future version


I don't like mixing the deprecation notice in the string but maybe it's
just me.

-- 
Ferenc Kovács
@Tyr43l - http://tyrael.hu

Reply via email to