cvs: ZendEngine2 / zend_compile.c zend_language_parser.y /tests bug30961.phpt
| From: | Dmitry Stogov | Date: | Wed, 08 Jun 2005 06:49:01 +0000 |
| Subject: | cvs: ZendEngine2 / zend_compile.c zend_language_parser.y /tests bug30961.phpt | ||
| Groups: | php.zend-engine.cvs | ||
| Request: | Send a blank email to php-zend-engine-cvs+get-3754@lists.php.net to get a copy of this message | ||
dmitry Wed Jun 8 02:49:01 2005 EDT
Modified files:
/ZendEngine2 zend_compile.c zend_language_parser.y
/ZendEngine2/tests bug30961.phpt
Log:
Fixed bug #30961 (Wrong linenumber in ReflectionClass getStartLine())
http://cvs.php.net/diff.php/ZendEngine2/zend_compile.c?r1=1.630&r2=1.631&ty=u
Index: ZendEngine2/zend_compile.c
diff -u ZendEngine2/zend_compile.c:1.630 ZendEngine2/zend_compile.c:1.631
--- ZendEngine2/zend_compile.c:1.630 Tue Jun 7 14:11:56 2005
+++ ZendEngine2/zend_compile.c Wed Jun 8 02:49:00 2005
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: zend_compile.c,v 1.630 2005/06/07 18:11:56 dmitry Exp $ */
+/* $Id: zend_compile.c,v 1.631 2005/06/08 06:49:00 dmitry Exp $ */
#include <zend_language_parser.h>
#include "zend.h"
@@ -2579,8 +2579,8 @@
zend_initialize_class_data(new_class_entry, 1 TSRMLS_CC);
new_class_entry->filename = zend_get_compiled_filename(TSRMLS_C);
- new_class_entry->line_start = zend_get_compiled_lineno(TSRMLS_C);
- new_class_entry->ce_flags |= class_token->u.constant.value.lval;
+ new_class_entry->line_start = class_token->u.opline_num;
+ new_class_entry->ce_flags |= class_token->u.EA.type;
if (parent_class_name && parent_class_name->op_type != IS_UNUSED) {
doing_inheritance = 1;
http://cvs.php.net/diff.php/ZendEngine2/zend_language_parser.y?r1=1.157&r2=1.158&ty=u
Index: ZendEngine2/zend_language_parser.y
diff -u ZendEngine2/zend_language_parser.y:1.157 ZendEngine2/zend_language_parser.y:1.158
--- ZendEngine2/zend_language_parser.y:1.157 Sat Jun 4 12:16:18 2005
+++ ZendEngine2/zend_language_parser.y Wed Jun 8 02:49:00 2005
@@ -18,7 +18,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: zend_language_parser.y,v 1.157 2005/06/04 16:16:18 zeev Exp $ */
+/* $Id: zend_language_parser.y,v 1.158 2005/06/08 06:49:00 dmitry Exp $ */
/*
* LALR shift/reduce conflicts and how they are resolved:
@@ -302,9 +302,9 @@
class_entry_type:
- T_CLASS { $$.u.constant.value.lval = 0; }
- | T_ABSTRACT T_CLASS { $$.u.constant.value.lval = ZEND_ACC_EXPLICIT_ABSTRACT_CLASS; }
- | T_FINAL T_CLASS { $$.u.constant.value.lval = ZEND_ACC_FINAL_CLASS; }
+ T_CLASS { $$.u.opline_num = CG(zend_lineno); $$.u.EA.type = 0; }
+ | T_ABSTRACT T_CLASS { $$.u.opline_num = CG(zend_lineno); $$.u.EA.type =
ZEND_ACC_EXPLICIT_ABSTRACT_CLASS; }
+ | T_FINAL T_CLASS { $$.u.opline_num = CG(zend_lineno); $$.u.EA.type = ZEND_ACC_FINAL_CLASS; }
;
extends_from:
@@ -313,7 +313,7 @@
;
interface_entry:
- T_INTERFACE { $$.u.constant.value.lval = ZEND_ACC_INTERFACE; }
+ T_INTERFACE { $$.u.opline_num = CG(zend_lineno); $$.u.EA.type = ZEND_ACC_INTERFACE; }
;
interface_extends_list:
http://cvs.php.net/diff.php/ZendEngine2/tests/bug30961.phpt?r1=1.1&r2=1.2&ty=u
Index: ZendEngine2/tests/bug30961.phpt
diff -u /dev/null ZendEngine2/tests/bug30961.phpt:1.2
--- /dev/null Wed Jun 8 02:49:01 2005
+++ ZendEngine2/tests/bug30961.phpt Wed Jun 8 02:49:01 2005
@@ -0,0 +1,20 @@
+--TEST--
+Bug #30961 (Wrong linenumber in ReflectionClass getStartLine())
+--FILE--
+<?
+ class a
+ {
+ }
+
+ class b extends a
+ {
+ }
+
+ $ref1 = new ReflectionClass('a');
+ $ref2 = new ReflectionClass('b');
+ echo $ref1->getStartLine() . "\n";
+ echo $ref2->getStartLine() . "\n";
+?>
+--EXPECT--
+2
+6