php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #57168 Unexpected PHP error for some condition
Submitted: 2006-08-01 18:44 UTC Modified: 2007-02-25 03:33 UTC
From: felix at zerve dot com Assigned:
Status: Closed Package: APC (PECL)
PHP Version: 4.4.1 OS: Mac OSX
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.
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: felix at zerve dot com
New email:
PHP Version: OS:

 

 [2006-08-01 18:44 UTC] felix at zerve dot com
Description:
------------
I am not sure if this is a design limitation of apc or if this can even be fixed. Because of apc php behaves differently when it comes to including class files and giving error messages for classes that have not been defined. This is an actual situation I came across in our codebase. I was able to provide a simplified code to reproduce. 

Reproduce code:
---------------
This involves 3 files
--- test.php ---
<?php
require_once( 'C.php' );
require_once( 'P.php' );
     
$t =& new C( );

?>

--- P..php ---
<?php

class P {
    function P( ) {
        echo 'inside p()';
    }
}

?>

-- C.php --
<?php

class C extends P {
    function C( ) {
        $p = get_parent_class( $this );
        $this->$p( );
    }
}

?>

Steps to reproduce:
If you run test.php with clear cache you would get this error as is expected:

 Class c: Cannot inherit from undefined class p on line 3 in C.php


But lets say we modify test.php to include P.php first and run test.php again so there is no error. 

Now P.php and C.php are both in the cache.

At this point modify test.php again to include C.php first followed by P.php. The error you get is:

 Call to undefined Function () at C.php line 6


Note: in the actual codebase I dont have to keep modifying the order of includes because the files are included form other places I always get the wrong error.



Expected result:
----------------
Depending at what point classes are cached the errors from php are different. I was expecting to get Cannot inherit undefined class all the time.


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2006-09-02 13:31 UTC] gopalv82 at yahoo dot com
Could you test this with current CVS ?

I think this is very similar to http://pecl.php.net/bugs/bug.php?id=8579
 [2007-02-25 03:33 UTC] rasmus@php.net
This should be fixed now.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Apr 27 18:01:35 2024 UTC