|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2010-07-07 15:19 UTC] fede at ciudades dot com
Description:
------------
On some PHP scripts I get:
PHP Fatal error: Internal Zend error - Missing class
information for in /foo/bar.php on line X
It does not happen with APC dissabled
Reproduce code:
---------------
class foo {
...
...
...
}
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sun Oct 26 15:00:01 2025 UTC |
Do you have any code which includes the same class multiple times with include? like if(...) { class foo {}; } If you do, then that breaks under high load. http://notmysock.org/blog/php/inclusion-checks read.Same Error happend. * Error message --- PHP Fatal error: Internal Zend error - Missing class information for in /foobar/xoops_trust_path/wizin/src/Wizin_Util.class.php on line 24 --- * Code: Xoops Cube Legacy 2.1.7 + wiz moble HD 0.43 --- if (! class_exists('Wizin_Util')) { require dirname(__FILE__) . '/Wizin.class.php'; /** * Wizin framework utility class * * @access public * */ class Wizin_Util { /** * return string for something salt * * @param string $salt * @return string $prefix */ function --- line 23,24 are --- class Wizin_Util { --- * The way I fixed this problem Delete the white space between ! and class_exists * Enviroment CentOS 6.3 * PHP version PHP 5.3.16 (cli) (built: Aug 16 2012 13:52:03) Copyright (c) 1997-2012 The PHP Group Zend Engine v2.3.0, Copyright (c) 1998-2012 Zend Technologies with Suhosin v0.9.29, Copyright (c) 2007, by SektionEins GmbHThis may not be fixable. As Gopal mentioned in this bug, this is probably happening because the same class is defined both dynamically and non- dynamically. By that I mean, if you have: if(condition) { class Foo { ... } } and at the same time you have a top-level class Foo {} definition in another file. It would depend which file is hit first after a server restart on whether or not you see this error. The only reliable solution is not to write code like that. It really isn't a good idea to have the same class defined in multiple places anyway.Scenario that recreates this message / bug: Implement a spl_autoload_register() function and in class files requiring a parent class (dependencies). This occured for me after upgrading from PHP 4 to PHP 5.3 and implementing autoload. Example: <?php require "dependency/parent_class.php"; if (!class_exists("child_class", false)) { class child_class extends parent_class { // stuff } } In another file, implement the spl_autoload_register function and make it call the class.