note 57041 added to language.oop5.autoload

From: Date: Thu, 22 Sep 2005 09:31:00 +0000
Subject: note 57041 added to language.oop5.autoload
Groups: php.notes 
Request: Send a blank email to php-notes+get-95589@lists.php.net to get a copy of this message
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); ... ?> ---- Manual Page -- http://www.php.net/manual/en/language.oop5.autoload.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+57041 Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+57041&report=yes&reason=added+to+the+manual Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+57041&report=yes&reason=bad+code Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+57041&report=yes&reason=spam Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+57041&report=yes&reason=useless Delete: non-english -- http://master.php.net/manage/user-notes.php?action=delete+57041&report=yes&reason=non-english Delete: already in docs -- http://master.php.net/manage/user-notes.php?action=delete+57041&report=yes&reason=already+in+docs Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+57041&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+57041&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#95589) next »