note 85779 added to language.oop5.autoload
| From: | jbarker at erepublic dot com | Date: | Wed, 17 Sep 2008 15:34:05 +0000 |
| Subject: | note 85779 added to language.oop5.autoload | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-144479@lists.php.net to get a copy of this message | ||
In a subclass, I was trying to call an overridden parent method with an arbitrary number of
arguments:
<?
call_user_func_array(array('parent', 'someNonStaticMethod'), $args);
?>
It turns out this triggers an E_STRICT level warning. So I changed to this:
<?
call_user_func_array(array($this, 'parent::someNonStaticMethod'), $args);
?>
This doesn't trigger any warnings, but it has the undesirable (if not downright buggy) effect
of calling my __autoload() function with the argument 'parent'. I had to modify
__autoload() to handle this special situation:
<?
function __autoload($cls)
{
if ('parent' != $cls)
{
require("class.$cls.php");
}
}
?>
Tested on Linux with PHP 5.1.6 and 5.2.5.
----
Server IP: 209.41.74.194
Probable Submitter: 209.63.134.99
----
Manual Page -- http://www.php.net/manual/en/language.oop5.autoload.php
Edit -- https://master.php.net/note/edit/85779
Del: integrated -- https://master.php.net/note/delete/85779/integrated
Del: useless -- https://master.php.net/note/delete/85779/useless
Del: bad code -- https://master.php.net/note/delete/85779/bad+code
Del: spam -- https://master.php.net/note/delete/85779/spam
Del: non-english -- https://master.php.net/note/delete/85779/non-english
Del: in docs -- https://master.php.net/note/delete/85779/in+docs
Del: other reasons-- https://master.php.net/note/delete/85779
Reject -- https://master.php.net/note/reject/85779
Search -- https://master.php.net/manage/user-notes.php