|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2007-03-01 10:03 UTC] habeck at gmx dot de
Description:
------------
I have also problems with __autoload on windows 2003 apache 2.2.4/php 5.2.1. The following function does not what it did in apache 2.0.x and earlier versions of php:
function __autoload($class_name) {
require_once(KH_APP_LIBPATH.$class_name.'.php');
}
The errormessage:
PHP Fatal error: require_once(): Failed opening required 'D:/xxx/xxx/.php' (include_path='./;D:/xxx/xxx/') in D:\xxx\xxx\index.php on line 6
So there seems to be no value for $classname.
Reproduce code:
---------------
function __autoload($class_name) {
require_once(KH_APP_LIBPATH.$class_name.'.php');
}
Expected result:
----------------
Opening the classfile: D:/xxx/xxx/blah.php
Actual result:
--------------
PHP Fatal error: require_once(): Failed opening required 'D:/xxx/xxx/.php' (include_path='./;D:/xxx/xxx/') in D:\xxx\xxx\index.php on line 6
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Tue Nov 04 17:00:01 2025 UTC |
There are three files: autoload-file (test.php): <?php function __autoload($class_name) { require_once($class_name.'.php'); } $txt = 'config.xml'; $o = new blah($txt); $o->sayHallo(); ?> class-file (blah.php): <?php class blah { private $var; function __construct($var = '') { $this->var = simplexml_load_file($var, '', LIBXML_NOCDATA+LIBXML_COMPACT); } function sayHallo() { print('hallo world!'); } } ?> xml-file (config.xml): <?xml version="1.0" encoding="UTF-8" standalone="yes" ?> <config> <templates> </templates> </config> error comment: I have tried to find out where the error occurs and it seems that the empty second parameter in the function call "simplexml_load_file" overrides the variable value of $class_name.