From: Nikita Popov Date: Sun, 12 Oct 2014 18:54:45 +0000 (+0200) Subject: Ensure __LINE__ is always accurate X-Git-Tag: POST_NATIVE_TLS_MERGE^2~75^2~1 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=0b09ba84b912be90c06d8d5ffab55bf850c3070b;p=php Ensure __LINE__ is always accurate --- diff --git a/Zend/tests/line_const_in_array.phpt b/Zend/tests/line_const_in_array.phpt new file mode 100644 index 0000000000..181f67e3da --- /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 e242bac951..5d3ee24c84 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));