Edit report at http://bugs.php.net/bug.php?id=53508&edit=1
ID: 53508
Comment by: exsystemchina at gmail dot com
Reported by: exsystemchina at gmail dot com
Summary: Class not found caused by require_once
Status: Open
Type: Bug
Package: Scripting Engine problem
Operating System: Mac OS X 10.6
PHP Version: 5.3.3
Block user comment: N
Private report: N
New Comment:
I found that if I put require_once at the end of the php file, the fatal
error
won't appear any more... just inspired by another bug report.
Previous Comments:
------------------------------------------------------------------------
[2010-12-09 15:47:56] exsystemchina at gmail dot com
Description:
------------
A weird bug, appears only when the script contains require_once:
A class is defined with an interface implemented, but the PHP
interpreter produces
a fatal error saying class not defined. But everything goes well if the
class
doesn't implemented an interface.
Test script:
---------------
Download this file, and unzip it:
http://files.cnblogs.com/ExSystem/FrameworkDSW.zip
Make sure your php include_path contains the parent directory of
FrameworkDSW, and to set error reporting level to E_ALL in case.
Run FrameworkDSW\System.php, and get the fatal error.
****And only the classes defined before the declaration of TObject
inside System.php are declared succesfully(I guess it by invoking
get_declared_classes()).
Then modify the line 285 of System.php to
class TObject {
rather than
class TObject implements IInterface {
and run it again, to see the difference.
****And all the classes inside System.php are declared successfully.
Expected result:
----------------
<Nothing>
Actual result:
--------------
<br />
<b>Fatal error</b>: Class 'TObject' not found in
<b>{your_include_path}\FrameworkDSW\Utilities.php</b> on line
<b>81</b><br />
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/bug.php?id=53508&edit=1