Sorry, never even noticed instanceof got fixed (in 5.1) with undefined
classes. Since it did not work when introduced, i just assumed it would
stay that way.......
Anyway, It's a pretty good justification for phased "Announced" long
term depreciation plan
in 5.4 is_a() usage called without a third argument shows depreciated
warning pointing to a message that you should use instanceof (as it has
worked ok since 5.1)
Then changing the behavior in 5.5 / 1yr+ and changing the default to
true is a BC plan.
Only downside is that users of is_a() for class string/autoload testing
have to put true at the end, and eventually can remove it after a few years.
Regards
Alan
On Sunday, September 25, 2011 11:53 AM, Stas Malyshev wrote:
Hi!
On 9/24/11 7:00 PM, Alan Knowles wrote:
Obviously I'd be keen to see this fix applied to 5.4 as the standard use
case for is_a() is mixed return testing as '$x instanceof "somestring"'
does not work.
There is no reason to do $x instanceof "somestring" as you can do just
$x instanceof Class. And for 99% of cases I've seen the second
argument of is_a was constant - which means this code was plain wrong,
there's no reason to use is_a in such case. In case you do have to use
is_a - namely, when you have variable arguments - it would be rather
strange if first argument wouldn't support string as class name, but
the second one would, and moreover, is_subclass_of also would.
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php