php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #1851 Scripting Engine problem
Submitted: 1999-07-23 15:09 UTC Modified: 1999-07-26 17:17 UTC
From: chagenbu at wso dot williams dot edu Assigned:
Status: Closed Package: Scripting Engine problem
PHP Version: 4.0 Beta 1 OS: RedHat Linux 6.0
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: chagenbu at wso dot williams dot edu
New email:
PHP Version: OS:

 

 [1999-07-23 15:09 UTC] chagenbu at wso dot williams dot edu
(I sent this to the dev list before, but I haven't heard anything so I figured I'd better do the right thing and enter it in the bugs database)

Ok, this one's a bit bizarre. PHP4 Beta 1, running as an apache module
(1.3.6) on RH 6.0, compiled with imap support.                                                                                                                      
Here's the test script:

test.php3:

<?php
include 'class.inc';
require 'class2.inc';
$foo = new Bar2();
echo 'foo';
?>


class.inc:

<?php
class Bar {
  function Bar () {
  }                                                                                                                                                                 
}                                                                                                         ?>


class2.inc:

<?php
class Bar2 extends Bar {
  var $parent;
  function Bar2 () {
    $this->Bar();
  }
}
?>

In php3, this works fine. In php4, I get:
Fatal error: Class bar2: Cannot inherit from undefined class bar in

class2.inc on line 7

If both classes are required, both included, *or* the first required and the
second included, it works fine. It only happens when the include comes first.

Is this unavoidable due to require() being evaluated before parsing the file? But that can't be completely true since you can use a variable as an argument to require()...?

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [1999-07-26 17:17 UTC] zeev at cvs dot php dot net
Fixed - thanks for the detailed report!
 
PHP Copyright © 2001-2017 The PHP Group
All rights reserved.
Last updated: Sun Nov 19 01:31:42 2017 UTC