Edit report at https://bugs.php.net/bug.php?id=53508&edit=1
ID: 53508
Updated by: stas@php.net
Reported by: exsystemchina at gmail dot com
Summary: Class not found caused by require_once
-Status: Open
+Status: Not a bug
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:
Sorry, but your problem does not imply a bug in PHP itself. For a
list of more appropriate places to ask for help using PHP, please
visit http://www.php.net/support.php as this bug system
is not the
appropriate forum for asking support questions. Due to the volume
of reports we can not explain in detail here why your report is not
a bug. The support channels will be able to provide an explanation
for you.
Thank you for your interest in PHP.
TObject is not yet defined at the time TMustBeWrong line is executed, since
require is executed before TObject definition is executed. I would suggest
cleaning up the code and getting includes (requires) in proper order.
Previous Comments:
------------------------------------------------------------------------
[2010-12-22 06:47:31] exsystemchina at gmail dot com
and something important i forgot to mention:
THIS WILL ONLY HAPPEN WHEN RUNNING THE SCRIPT, everything's all right when
debugging.
------------------------------------------------------------------------
[2010-12-20 03:55:08] exsystemchina at gmail dot com
no cacher is installed.
------------------------------------------------------------------------
[2010-12-20 03:34:25] kalle@php.net
You don't happen to have any opcode cachers like APC installed?
------------------------------------------------------------------------
[2010-12-14 13:17:34] exsystemchina at gmail dot com
//System.php
<?php
require_once 'Utilities.php';
class TJustTest {
public function __construct() {
var_dump(get_declared_classes());
}
}
interface IInterface {
public function Supports($AInterface);
}
class TObject implements IInterface {
public function Supports($AInterface) {
echo 'hi';
}
}
class TJustAnotherTest {
public function Foo() {
echo 'foo';
}
}
?>
//Utilities.php
<?php
require_once 'System.php';
class TSomethingBoring {
public function Boring() {
echo 'really boring';
}
}
$a=new TJustTest();
class TMustBeWrong extends TObject {
function Tragedy() {
echo 'this will not be seen.';
}
}
?>
Just run System.php to see the fatal error with other classes before TObject loaded successfully
inside System.php
------------------------------------------------------------------------
[2010-12-14 13:14:52] exsystemchina at gmail dot com
ok, i have just know that a login is needed to download the zip file.....
now i have shorten the buggy code.
------------------------------------------------------------------------
The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
https://bugs.php.net/bug.php?id=53508--
Edit this bug report at https://bugs.php.net/bug.php?id=53508&edit=1