php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #45903 extends from a class which is extends from another cause complie failed
Submitted: 2008-08-24 13:52 UTC Modified: 2008-08-24 18:28 UTC
Votes:1
Avg. Score:1.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: laruence at yahoo dot com dot cn Assigned:
Status: Closed Package: Compile Failure
PHP Version: 5.2.6 OS: rhel-4.x
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: laruence at yahoo dot com dot cn
New email:
PHP Version: OS:

 

 [2008-08-24 13:52 UTC] laruence at yahoo dot com dot cn
Description:
------------
I found when I extends from a class which is also extended from a class case the complie failed .

the parsing process:
starr:
    top_statement_list
;

top_statement_list:
        top_statement_list 
.... //有省略
;


top_statement:
.... //有省略
    |   class_declaration_statement   
 .... //有省略
;

class_declaration_statement:
        unticked_class_declaration_statement 
;

unticked_class_declaration_statement:
        class_entry_type T_STRING extends_from
.... //有省略
;

class_entry_type:
        T_CLASS
.... //有省略
;

extends_from:
        /* empty */   
    |   T_EXTENDS fully_qualified_class_name
.... //有省略
;
fully_qualified_class_name:
        T_STRING { zend_do_fetch_class(&$$, &$1 TSRMLS_CC); }
;

but if class with named fully_qualified_class_name is also a inherited class , there must be some mechanism to guaranteed the fully_qualified_class_name to be processed first...
class 

Reproduce code:
---------------
<?php
class a extends b {
};
class b extends c{
};
class c{
};
?>

Expected result:
----------------
PHP Fatal error:  Class 'b' not found in /home/xinchen/1.php on line 2
Fatal error: Class 'b' not found in /home/xinchen/1.php on line 2

Actual result:
--------------
http://www.laruence.com/2008/08/24/427.html

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2008-08-24 13:58 UTC] laruence at yahoo dot com dot cn
change the os desc.
 [2008-08-24 14:01 UTC] laruence at yahoo dot com dot cn
fixed the misspell........

cause => case
 [2008-08-24 17:50 UTC] laruence at yahoo dot com dot cn
need verified again.
 [2008-08-24 17:53 UTC] laruence at yahoo dot com dot cn
open
 [2008-08-24 18:26 UTC] laruence at yahoo dot com dot cn
while, after I tracing again ,I found the reason.

when opcode ZEND_FETCH_CLASS(op2 is b) which is used to generated class a was executed.  the class b was not in the class table yet, because class b is a drived class too ,it also  need ZEND_DECLARE_INHERITED_CLASS belong to its to be executed for add class itself to class_table.

so ,I think this should be a bug, am I wrong?
 [2008-08-24 18:28 UTC] laruence at yahoo dot com dot cn
closed
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Dec 05 02:01:30 2024 UTC