Hello everybody! At the moment the *get_class *function has three possible behaviors - *get_class* is called with the instance of the class and return the name of the class name of the instance; - *get_class* is called without any parameters inside a class and return the containing class name - *get_class* is called without any parameters outside a class, trigger a warning complaining about this and return false
At the state of art of PHP the second behavior is not needed anymore because the name of the containing class can be easily obtained via *__CLASS__ or via get_class($this)* or via *get_called_class() *when extending a class in a static method. Moreover *get_class* without any parameters is a possible source of bugs in situations like this: *$result = $repository->find(100);* *echo get_class($result);* If *$result* is *null* the output of *get_class* is the name of the containing class instead of the name of the object I wanted. I would like to a change to the *get_class* behavior in order to support only the first behavior, unfortunately this is a huge BC, so we could start triggering a deprecation warning at first. What do you think? I'm missing something? References: Implementation of *get_class* http://lxr.php.net/xref/PHP_MASTER/Zend/zend_builtin_functions.c#995 Thanks Lorenzo