Browse Source

Ensure __LINE__ is always accurate

pull/865/merge
Nikita Popov 12 years ago
parent
commit
0b09ba84b9
  1. 21
      Zend/tests/line_const_in_array.phpt
  2. 2
      Zend/zend_compile.c

21
Zend/tests/line_const_in_array.phpt

@ -0,0 +1,21 @@
--TEST--
Use of __LINE__ in arrays
--FILE--
<?php
var_dump([
__LINE__,
__LINE__,
__LINE__,
]);
?>
--EXPECT--
array(3) {
[0]=>
int(4)
[1]=>
int(5)
[2]=>
int(6)
}

2
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));

Loading…
Cancel
Save