This post originated from an RSS feed registered with PHP Buzz
by Alan Knowles.
Original Post: removing that stupid is_a warning.
Feed Title: Smoking toooo much PHP
Feed URL: http://www.akbkhome.com/blog.php/RSS.xml
Feed Description: More than just a blog :)
My new pet hate about PHP5 is currently the rather stupid warning: "Strict Standards: is_a(): Deprecated. Please use the instanceof operator in"
Why on earth is that in there? instance of requires that the class or interface you are testing against exists. That means loading code that may not actually be used if you are using negative testing.
That shouts out ineffeciency, and doesnt really give you and readibility or particularly major gains in terms of code doing the testing for you.
It's about the only warning that PHP4 code emits when running under E_STRICT if you disable it when loading the code.
here is the simple patch to get rid of this crazyness..
--- zend_builtin_functions.c 1 Feb 2005 19:05:56 -0000 1.256 +++ zend_builtin_functions.c 17 Mar 2005 08:20:42 -0000 @@ -672,7 +672,6 @@ Returns true if the object is of this class or has this class as one of its parents */ ZEND_FUNCTION(is_a) { - zend_error(E_STRICT, "is_a(): Deprecated. Please use the instanceof operator"); is_a_impl(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0); } /* }}} */