Edit report at https://bugs.php.net/bug.php?id=53727&edit=1
ID: 53727 Comment by: jbondc at openmv dot com Reported by: mattknight at xymail dot co dot uk Summary: Inconsistent behavior of is_subclass_of with interfaces Status: Closed Type: Bug Package: Class/Object related Operating System: Gentoo x86_64 PHP Version: 5.3.5 Assigned To: dmitry Block user comment: N Private report: N New Comment: This patch also modifies the is_a() api by allowing a string as a first argument. That seems wrong to me within the 5.3 branch. Previous Comments: ------------------------------------------------------------------------ [2011-07-15 15:17:18] phi...@php.net Automatic comment from SVN on behalf of philip Revision: http://svn.php.net/viewvc/?view=revision&revision=313271 Log: Updated is_a() and is_subclass_of() tests as per the removed E_WARNING from r313162 which was inspired by discussion after r312904 and PHP Bug #53727 ------------------------------------------------------------------------ [2011-07-04 11:00:53] dmi...@php.net This bug has been fixed in SVN. Snapshots of the sources are packaged every three hours; this change will be in the next snapshot. You can grab the snapshot at http://snaps.php.net/. Thank you for the report, and for helping us make PHP better. ------------------------------------------------------------------------ [2011-07-04 10:55:39] dmi...@php.net Automatic comment from SVN on behalf of dmitry Revision: http://svn.php.net/viewvc/?view=revision&revision=312904 Log: Fixed bug #53727 (Inconsistent behavior of is_subclass_of with interfaces) ------------------------------------------------------------------------ [2011-06-30 18:45:09] ralph at smashlabs dot com Dmitry, The patch called fix-is_subclass_of-PHP_5_3.diff does the following: * Alters the existing Zend/tests/is_a.phpt to alter the bad expectation, * Adds a new test file for is_subclass_of() as Zend/tests/is_subclass_of.phpt * Finally alters is_a_impl() in the following ways: * If an object was provided as the first parameter, and we are inside of an is_subclass_of call (known by the flag only_subclass), then assign the class entry of the object * Next, determine if the instance_ce provided is the same class entry as that we are testing against (parameter 2 of the is_subclass_of() call ... if it is, return false * Now that we know the instance_ce is not the same as the class entry for the test class, allow is_a_impl to pass these class entries to instanceof_function, and return that value It is pretty straight forward, and any way I look at it, there are few consequences to this patch. Thanks, Ralph ------------------------------------------------------------------------ [2011-01-13 09:13:50] mattknight at xymail dot co dot uk Yes, it would also be fine to return false when comparing against an ancestral interface, just so long as the behaviour is consistent. Expected result: ---------------- false true false true ------------------------------------------------------------------------ The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at https://bugs.php.net/bug.php?id=53727 -- Edit this bug report at https://bugs.php.net/bug.php?id=53727&edit=1