com php-src: Improve accuracy of opline lineno information: Zend/tests/bug72101.phpt Zend/zend_compile.c

[email protected] (Nikita Popov)
Newsgroups php.cvs
Message-ID <[email protected]>
Commit:    e433c23b96e81340cd0e2d0b4b7f5fce7f72a931
Author:    Nikita Popov <[email protected]>         Sat, 15 Apr 2017 18:06:42 +0200
Parents:   0beccc51f1bf44fb3efeb1131f8c86eb7dc5014f
Branches:  PHP-7.0 PHP-7.1 master

Link:       http://git.php.net/?p=php-src.git;a=commitdiff;h=e433c23b96e81340cd0e2d0b4b7f5fce7f72a931

Log:
Improve accuracy of opline lineno information

If compile_var() was used instead of compile_expr() we did not
update the current lineno.

Changed paths:
  M  Zend/tests/bug72101.phpt
  M  Zend/zend_compile.c


Diff:
diff --git a/Zend/tests/bug72101.phpt b/Zend/tests/bug72101.phpt
index a04425c..8782b8e 100644
--- a/Zend/tests/bug72101.phpt
+++ b/Zend/tests/bug72101.phpt
@@ -79,7 +79,7 @@ Stack trace:
 #0 %sbug72101.php(8): {closure}(2, 'Parameter 1 to ...', '%s', 8, Array)
 #1 %sbug72101.php(27): PHPUnit_Framework_MockObject_Stub_ReturnCallback->invoke(Object(PHPUnit_Framework_MockObject_Invocation_Static))
 #2 %sbug72101.php(19): PHPUnit_Framework_MockObject_Matcher->invoked(Object(PHPUnit_Framework_MockObject_Invocation_Static))
-#3 %sbug72101.php(51): PHPUnit_Framework_MockObject_InvocationMocker->invoke(Object(PHPUnit_Framework_MockObject_Invocation_Static))
+#3 %sbug72101.php(52): PHPUnit_Framework_MockObject_InvocationMocker->invoke(Object(PHPUnit_Framework_MockObject_Invocation_Static))
 #4 %sbug72101.php(72): Mock_MethodCallbackByReference_7b180d26->bar(0, 0, 0)
 #5 {main}
   thrown in %sbug72101.php on line 61
diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c
index f3c04b9..9e0621d 100644
--- a/Zend/zend_compile.c
+++ b/Zend/zend_compile.c
@@ -7314,6 +7314,8 @@ void zend_compile_expr(znode *result, zend_ast *ast) /* {{{ */
 
 void zend_compile_var(znode *result, zend_ast *ast, uint32_t type) /* {{{ */
 {
+	CG(zend_lineno) = zend_ast_get_lineno(ast);
+
 	switch (ast->kind) {
 		case ZEND_AST_VAR:
 			zend_compile_simple_var(result, ast, type, 0);
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.