ID: 41137 User updated by: amadeusz dot jasak at gmail dot com Reported By: amadeusz dot jasak at gmail dot com Status: Bogus Bug Type: Feature/Change Request Operating System: - PHP Version: 5.2.1 New Comment:
So, maybe new function for checking interface implementation for classes?? Like bool is_implementing(mixed $class_or_object, string $interface) Previous Comments: ------------------------------------------------------------------------ [2007-04-19 15:01:33] [EMAIL PROTECTED] quoting the manual (http://php.net/is_a): "bool is_a ( object $object, string $class_name ) Checks if the given object is of this class or has this class as one of its parents." 'foo' is not an object (it is a string), and therefore is_a() returns false. is_a('foo', 'foo') is also false for the same reason. ------------------------------------------------------------------------ [2007-04-19 06:31:39] amadeusz dot jasak at gmail dot com Description: ------------ is_a function will be works if first argument is class name and next argument is interface name. Currently it isn't working... I can't check for class (not object) is implementing some interface Reproduce code: --------------- <?php inteface factory { public static function _factory($params); } class foo implements factory { public static function _factory($params) { $t = new foo(); return $t; // Sweet use of factory ;) } } var_dump ( is_a('foo', 'factory'), // Currently return false, but true is expected is_a($foo = new foo(), 'factory') // It is working but it isn't practicly ); ?> Expected result: ---------------- bool(true) bool(true) Actual result: -------------- bool(false) bool(true) ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=41137&edit=1