#31562 [NEW]: __autoload() problem with static variables
From: aalbre99 at student dot hia dot no
Operating system: Windows XP
PHP version: 5.0.3
PHP Bug Type: Zend Engine 2 problem
Bug description: __autoload() problem with static variables
Description:
------------
Autoload is not invoked for missing class when using static variables (no
other reference to the class in same file).
Ex. (test.php):
function __autoload($className) {
require_once("class_files/" . $className . ".php");
}
$myVar = MyClass::$classVar;
//This will not invoke the __autoload() procedure...
//Adding (in the top):
//require_once("class_files/ErrorFetcher.php");
//"fixes" the problem
Reproduce code:
---------------
//(test.php)
function __autoload($className) {
require_once("class_files/" . $className . ".php");
}
$myVar = MyClass::$classVar;
//MyClass is described in class_files/MyClass.php...
Expected result:
----------------
No error...
Actual result:
--------------
Fatal error: Class 'MyClass' not found in test.php on line xx
--
Edit bug report at http://bugs.php.net/?id=31562&edit=1
--
Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=31562&r=trysnapshot4
Try a CVS snapshot (php5.0): http://bugs.php.net/fix.php?id=31562&r=trysnapshot50
Try a CVS snapshot (php5.1): http://bugs.php.net/fix.php?id=31562&r=trysnapshot51
Fixed in CVS: http://bugs.php.net/fix.php?id=31562&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=31562&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=31562&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=31562&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=31562&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=31562&r=support
Expected behavior: http://bugs.php.net/fix.php?id=31562&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=31562&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=31562&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=31562&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=31562&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=31562&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=31562&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=31562&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=31562&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=31562&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=31562&r=mysqlcfg
Thread (12 messages)
- aalbre99 at student dot hia dot no
- jed@php.net#31562 [Opn->Fbk]: __autoload() problem with static variables
- aalbre99 at student dot hia dot no#31562 [Opn]: __autoload() problem with static variables
- aalbre99 at student dot hia dot no#31562 [Opn]: __autoload() problem with static variables
- aalbre99 at student dot hia dot no#31562 [Fbk->Opn]: __autoload() problem with static variables
- aalbre99 at student dot hia dot no#31562 [Opn]: __autoload() problem with static variables
- aalbre99 at student dot hia dot no#31562 [Opn]: __autoload() problem with static variables
- aalbre99 at student dot hia dot no#31562 [Fbk->Opn]: __autoload() problem with static variables
- helly@php.net#31562 [Opn->Csd]: __autoload() problem with static variables
- sniper@php.net#31562 [Opn->Fbk]: __autoload() problem with static variables
- liujingfeng at snda dot comBug #31562 [Com]: __autoload() problem with static variables
- youcontrol at foxmail dot comBug #31562 [Com]: __autoload() problem with static variables