Bug #20496
closed
LogicException is thrown if spl_autoload() fails with PHP 5.2.0
Added by Joris Willems over 15 years ago.
Updated over 14 years ago.
Category:
Database API (Doctrine DBAL)
Description
PHP Fatal error: Uncaught exception 'LogicException' with message 'Class ux_t3lib_DB could not be loaded' in /home/mygarden/typo3_src-4.3.0alpha3/t3lib/class.t3lib_autoloader.php:109 Stack trace: #0 /home/mygarden/typo3_src-4.3.0alpha3/t3lib/class.t3lib_autoloader.php(109): spl_autoload('ux_t3lib_DB') #1 [internal function]: t3lib_autoloader::autoload('ux_t3lib_DB') #2 [internal function]: spl_autoload_call('ux_t3lib_DB') #3 /home/mygarden/typo3_src-4.3.0alpha3/t3lib/class.t3lib_div.php(4829):
(issue imported from #M11176)
Files
Same Error on a fresh Installation.
PHP Version 5.2.0-8+etch15
Version of php: PHP 5.2.0-8+etch11
So we are both running Debian 4.0 ( Etch)
I do not know how to reproduce. Please give details.
FYI I'm using all pending patches (in core-list) for DBAL:
I was not able to reproduce this behaviour neither.
However, it seems that spl_autoload() throws an exception when a class could not be loaded on some systems. I've wrapped the fallback to spl_autoload() with try/catch.
Please test the attached patch and tell me, if DBAL still works on your system. Thanks!
Patch works fine. Thanks!
For Reproducing: I use a Debian Etch Installation with Usermin/Virtualmin Default Configuration.
Ok... I could reproduce this on a live server with
PHP 5.2.0-8+etch13 (cli) (built: Oct 2 2008 08:26:18)
Seems to be a PHP or Debian issue with spl_autoload() - I'm not using DBAL on the mentioned system.
I have the same.
Debian etch, php 5.2.0+dfsg-8+etch15, php running as fastcgi under apache...
Problem arises with alpha3 : alpha2 runs well (at least the start).
a very basic typo3 installation...
/Ch
Upd: but patch helps - I get the install page... :-)
More infos:
in class.t3lib_div.php we have a function:
protected function getClassName($className) {
return (class_exists($className) && class_exists('ux_' . $className) ? self::getClassName('ux_' . $className) : $className);
}
theese two variations work (between the {}):
return $className;
or
return (class_exists($className) && class_exists('ux_' . $className, false) ? self::getClassName('ux_' . $className) : $className);
Hi Christian,
the class_exists() with the second parameter to false might be a valid thing - however, the problem here is related to the exception thrown by spl_autoload() in PHP 5.2.0/Debian.
If an extension would just check for any class by e.g. class_exists('someOtherClass') the same error would occur.
Thus, using try/catch to prevent the LogicException to be thrown is the only way here.
Committed to SVN Trunk (rev. 5518)
Also available in: Atom
PDF