ID:               45904
 Updated by:       [EMAIL PROTECTED]
 Reported By:      laruence at yahoo dot com dot cn
-Status:           Open
+Status:           Bogus
 Bug Type:         Scripting Engine problem
 Operating System: rhel-4.x
 PHP Version:      5.2.6
 New Comment:

Please do not submit the same bug more than once. An existing
bug report already describes this very problem. Even if you feel
that your issue is somewhat different, the resolution is likely
to be the same. 

Thank you for your interest in PHP.

Duplicate of bug #45903


Previous Comments:
------------------------------------------------------------------------

[2008-08-25 03:50:16] laruence at yahoo dot com dot cn

sorry , but I found that the realy  reson is:

top_statement:
        statement
 ...
    |   class_declaration_statement     {
zend_do_early_binding(TSRMLS_C); }
...
;

while the :
             void zend_do_early_binding(TSRMLS_D){
...
...
                    if (zend_lookup_class(Z_STRVAL_P(parent_name),
Z_STRLEN_P(parent_name), &pce TSR
MLS_CC) == FAILURE) {
                        return;
                    }
...
...

}

so, early_binding couldn't add the class a in to class_table ,because
the class b is also a drived class and its parent class c is defined 
last in the script , so when zend_do_early_binding processing class b
declaration, it will not be able to find class c in class_table .

so the ZE delay the process until executing process ,  while the
declaration of class a is on the same way .

I think this must be the really reason ...

;)

------------------------------------------------------------------------

[2008-08-24 18:33:19] laruence at yahoo dot com dot cn

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 this bug report at http://bugs.php.net/?id=45904&edit=1

Reply via email to