php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #11589 classes and includes
Submitted: 2001-06-20 14:59 UTC Modified: 2001-06-21 10:51 UTC
From: lenar at dotcom dot ee Assigned:
Status: Closed Package: Scripting Engine problem
PHP Version: 4.0.5 OS: Debian/Linux
Private report: No CVE-ID: None
 [2001-06-20 14:59 UTC] lenar at dotcom dot ee
First, my stripped down code that works:
<?
class a {
    function make($params) {
    }
}
class b extends a {
    function make() {
        echo "WORKS OK";
    }
}
class c extends b {
    function make($params) {
        parent::make();
    }
}
class d extends c {
    function make($params) {
        parent::make($params);
    }
}

$d = new d();
$d->make("whatever");
?>

now, when i remove the definition of class 'a' to another file and include
the file like this:

file1.php:

<?
class a {
    function make($params) {
    }
}
?>

file2.php:

<?
include "./file1.php"; // or require - no difference

class b extends a {
  function make() {
   echo "WORKS OK";
  }
}

class c extends b {
 function make($params) { // this gets called forever !!!! and generating
warnings
    parent::make();
  }
}

class d extends c {
 function make($params) {
   parent::make($params);
  }
}

$d = new d();
$d->make("whatever");
?>

then i get message 'Warning: Missing argument 1 for make()' ... the code is same ... but working differently. at least with my php 4.0.5. so i think this is a bug.

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2001-06-21 08:24 UTC] lenar at dotcom dot ee
The bug exists in 4.0.6 RC3
 [2001-06-21 10:51 UTC] zeev@php.net
This has been fixed in CVS (it will be a part of 4.0.7, 4.0.6 has already been packaged).

Thanks for the report!
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Apr 25 13:01:30 2024 UTC