note 57041 rejected from language.oop5.autoload by betz
| From: | betz@php.net | Date: | Mon, 26 Sep 2005 23:00:31 +0000 |
| Subject: | note 57041 rejected from language.oop5.autoload by betz | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-95834@lists.php.net to get a copy of this message | ||
Note Submitter: christopher dot klein at ecw dot de
----
Using __autoload in another project, I noticed the effect, that errors (it does not matter of which
type they are) are not longer displayed. I just get a white page.
<?php
function __autoload($className)
{
$arrPath = array('./classes/','./classes/smarty/');
$arrPrefix =
array('class','object','interface','config');
for ($i = 0, $m = sizeof($arrPath); $i < $m; $i++)
{
for ($i2 = 0, $m2 = sizeof($arrPrefix); $i2 < $m2; $i2++)
{
$szClassPath = $arrPath[$i].$arrPrefix[$i2].".".$className.".php5";
if (file_exists($szClassPath))
{
// Here is the problem: if you try to load a file which has a syntax error, the script
ends without error
// Read below
include_once($szClassPath);
return true;
}
}
}
die("Could not load $className");
}
?>
You have to add the following line to solve this problem (replace it for // Read below):
<?php
...
// Read below
error_reporting(E_ALL) // VERY important!
include_once($szClassPath);
...
?>