php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #11073 parent::Function() does not work if parent class is included
Submitted: 2001-05-23 21:47 UTC Modified: 2001-11-11 06:11 UTC
From: symetrie at online dot fr Assigned:
Status: Closed Package: Class/Object related
PHP Version: 4.0.4pl1 OS: Linux SuSE 6.4
Private report: No CVE-ID: None
 [2001-05-23 21:47 UTC] symetrie at online dot fr
test1.php contains :
<?php
class a {
  function MyFunct($i, $j, $k='defaut_k') {
    echo " in a ";
  }
}
?>

test2.php contains
<?php
include("test1.php");

class b extends a {
  function MyFunct($i, $j, $k='defaut_k') {
    echo " in b ";
    parent::MyFunct($i,$j,$k); // does not work
// got : Fatal error: No parent class available in this context in ...
    a::MyFunct($i,$j,$k); // works
  }
}

whereas first example presented here works fine for me :
http://www.php.net/manual/en/keyword.parent.php

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2001-10-21 19:24 UTC] sniper@php.net
Works for me with PHP 4.1.0RC1.
Try from: http://www.php.net/~ssb/php-4.1.0RC1.tar.gz

--Jani

 [2001-11-11 06:11 UTC] sander@php.net
No feedback. Closing.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Apr 23 17:01:31 2024 UTC