From: laruence at yahoo dot com dot cn
Operating system: rhel-4.x
PHP version: 5.2.6
PHP Bug Type: Scripting Engine problem
Bug description: extends from a class which is extends from another cause
executor failed
Description:
------------
I found when I extends from a class which is also extended from a class
cause 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 , it cause executor failed.
after I tracing the parser, I found the reason maybe:
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 itself
to class_table.
so ,I think this should be a bug, am I wrong?
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
--
Edit bug report at http://bugs.php.net/?id=45904&edit=1
--
Try a CVS snapshot (PHP 5.2):
http://bugs.php.net/fix.php?id=45904&r=trysnapshot52
Try a CVS snapshot (PHP 5.3):
http://bugs.php.net/fix.php?id=45904&r=trysnapshot53
Try a CVS snapshot (PHP 6.0):
http://bugs.php.net/fix.php?id=45904&r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=45904&r=fixedcvs
Fixed in release:
http://bugs.php.net/fix.php?id=45904&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=45904&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=45904&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=45904&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=45904&r=support
Expected behavior: http://bugs.php.net/fix.php?id=45904&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=45904&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=45904&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=45904&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=45904&r=php4
Daylight Savings: http://bugs.php.net/fix.php?id=45904&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=45904&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=45904&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=45904&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=45904&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=45904&r=mysqlcfg