#39567 [Opn->Bgs]: Cannot find Class definition when there is one
| From: | tony2001@php.net | Date: | Tue, 21 Nov 2006 11:42:45 +0000 |
| Subject: | #39567 [Opn->Bgs]: Cannot find Class definition when there is one | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-105247@lists.php.net to get a copy of this message | ||
ID: 39567
Updated by: tony2001@php.net
Reported By: imkow at 163 dot com
-Status: Open
+Status: Bogus
Bug Type: Class/Object related
Operating System: WinXp sp2+Apache2.2+Mod_PHP
PHP Version: 5.2.0
New Comment:
Please read what I said in my previous comment.
Previous Comments:
------------------------------------------------------------------------
[2006-11-21 11:34:51] imkow at 163 dot com
require("file1.php");
$j= new A;
$k= new B;
class B extends A{}
I've changed the code to ensure class A is defined.
as shown above, only the line where $k in throws error..
------------------------------------------------------------------------
[2006-11-21 11:33:28] tony2001@php.net
Expected behaviour.
Class "B" cannot be declared in compile time, because class "A" is
declared in another file.
But in runtime, when you execute the line "$obj=new B;", the class "B"
doesn't exist yet.
------------------------------------------------------------------------
[2006-11-21 11:26:18] imkow at 163 dot com
require("F:/LXH/Webs/pware/file1.php");
a correction, it was file1.php, not file2.php
but im sure the problem is still there.
------------------------------------------------------------------------
[2006-11-21 11:21:27] imkow at 163 dot com
i have changed my code to absolute path.
require("F:/LXH/Webs/pware/file2.php");
$k= new B;
class B extends A{}
the problem is still there. a fatal error was thrown out.
------------------------------------------------------------------------
[2006-11-21 10:16:07] tony2001@php.net
Please change require("file1.php"); to
require("/absolute/path/to/file1.php"); and see if it works.
------------------------------------------------------------------------
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
http://bugs.php.net/39567
--
Edit this bug report at http://bugs.php.net/?id=39567&edit=1