Re: Backward Compatibility RFC - was Re: [PHP-DEV] Re: is_a() - again - a better fix
| From: | Stas Malyshev | Date: | Sun, 25 Sep 2011 03:53:27 +0000 |
| Subject: | Re: Backward Compatibility RFC - was Re: [PHP-DEV] Re: is_a() - again - a better fix | ||
| References: | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-55625@lists.php.net to get a copy of this message | ||
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. -- Stanislav Malyshev, Software Architect SugarCRM: http://www.sugarcrm.com/ (408)454-6900 ext. 227