summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDmitry Stogov <dmitry@php.net>2005-06-08 06:49:01 +0000
committerDmitry Stogov <dmitry@php.net>2005-06-08 06:49:01 +0000
commit0a44789bf3e8b3b6c70c4bd8c07367a9a62cc3bd (patch)
treea6842f3e280a734f3736f79d9bf88bc9422f1a2d
parent79ca149b75753afa1954aa5812077e2de6664eb9 (diff)
downloadphp-git-0a44789bf3e8b3b6c70c4bd8c07367a9a62cc3bd.tar.gz
Fixed bug #30961 (Wrong linenumber in ReflectionClass getStartLine())
-rw-r--r--Zend/zend_compile.c4
-rw-r--r--Zend/zend_language_parser.y8
-rwxr-xr-xext/reflection/tests/bug30961.phpt20
3 files changed, 26 insertions, 6 deletions
diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c
index 76d057c54b..494c62a5bd 100644
--- a/Zend/zend_compile.c
+++ b/Zend/zend_compile.c
@@ -2579,8 +2579,8 @@ void zend_do_begin_class_declaration(znode *class_token, znode *class_name, znod
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;
diff --git a/Zend/zend_language_parser.y b/Zend/zend_language_parser.y
index b5cf6ae9fe..69286cfb04 100644
--- a/Zend/zend_language_parser.y
+++ b/Zend/zend_language_parser.y
@@ -302,9 +302,9 @@ unticked_class_declaration_statement:
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 @@ extends_from:
;
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:
diff --git a/ext/reflection/tests/bug30961.phpt b/ext/reflection/tests/bug30961.phpt
new file mode 100755
index 0000000000..78067471d4
--- /dev/null
+++ b/ext/reflection/tests/bug30961.phpt
@@ -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