#47100 [Opn]: Magic method __call() does not work when class is named __call

From: Date: Wed, 14 Jan 2009 17:54:45 +0000
Subject: #47100 [Opn]: Magic method __call() does not work when class is named __call
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-132868@lists.php.net to get a copy of this message
ID: 47100 User updated by: dreadlabs at gmail dot com Reported By: dreadlabs at gmail dot com Status: Open Bug Type: Unknown/Other Function Operating System: Ubuntu PHP Version: 5.2.8 New Comment: Personally, i dont see why you would raise a fatal error when using magic methods for class names, you're not conflicting with anything, it should allow you to use it as normal. Previous Comments: ------------------------------------------------------------------------ [2009-01-14 17:42:53] crrodriguez at opensuse dot org Interesting.. in reality it IMHO should abort with a fatal error when classes are named __construct, __destruct, __call, __callStatic, __get, __set, __isset, __unset, __sleep, __wakeup, __toString, __set_state and __clone. ------------------------------------------------------------------------ [2009-01-14 15:11:04] dreadlabs at gmail dot com Description: ------------ I created a class named __call, within that class i created the magic method __call. I then instantiated the __call class and tried to call a non-existent method. I then got a missing argument error from PHP, instead of it using the __call method. Reproduce code: --------------- <?php class __call { public function __call($method, $args){ echo $method."\n"; } } $obj = new __call; $obj->test(); ?> Expected result: ---------------- test Actual result: -------------- Warning: Missing argument 1 for __call::__call(), called in /home/tam/test.php on line 15 and defined in /home/tam/test.php on line 5 Warning: Missing argument 2 for __call::__call(), called in /home/tam/test.php on line 15 and defined in /home/tam/test.php on line 5 ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=47100&edit=1

« previous php.bugs (#132868) next »