diff --git a/Zend/tests/line_const_in_array.phpt b/Zend/tests/line_const_in_array.phpt new file mode 100644 index 00000000000..181f67e3da6 --- /dev/null +++ b/Zend/tests/line_const_in_array.phpt @@ -0,0 +1,21 @@ +--TEST-- +Use of __LINE__ in arrays +--FILE-- + +--EXPECT-- +array(3) { + [0]=> + int(4) + [1]=> + int(5) + [2]=> + int(6) +} diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c index e242bac951e..5d3ee24c84f 100644 --- a/Zend/zend_compile.c +++ b/Zend/zend_compile.c @@ -4917,7 +4917,7 @@ static zend_bool zend_try_ct_eval_magic_const(zval *zv, zend_ast *ast TSRMLS_DC) switch (ast->attr) { case T_LINE: - ZVAL_LONG(zv, CG(zend_lineno)); + ZVAL_LONG(zv, ast->lineno); break; case T_FILE: ZVAL_STR_COPY(zv, CG(compiled_filename));