Bug #70457 [Opn]: Wrong line number for E_NOTICE - undefined constant in class
| From: | yohgaki@php.net | Date: | Tue, 08 Sep 2015 09:20:34 +0000 |
| Subject: | Bug #70457 [Opn]: Wrong line number for E_NOTICE - undefined constant in class | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-195869@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=70457&edit=1
ID: 70457
Updated by: yohgaki@php.net
Reported by: daniel dot jaenecke at sedo dot com
-Summary: Wrong line number for E_NOTICE
+Summary: Wrong line number for E_NOTICE - undefined constant
in class
Status: Open
Type: Bug
-Package: *General Issues
+Package: Scripting Engine problem
-Operating System: Linux
+Operating System: Any
-PHP Version: 5.6.13
+PHP Version: Any
Block user comment: N
Private report: N
New Comment:
https://3v4l.org/DpCPp
PHP has been emitting the error like this for a long time.
Previous Comments:
------------------------------------------------------------------------
[2015-09-08 08:46:58] daniel dot jaenecke at sedo dot com
Description:
------------
A notice complaining about an undefined constant assigned to a class property is reported for the
wrong line number.
I could reproduce this with the provided snippet for versions 5.3, 5.5 and 5.6
Test script:
---------------
<?php
class MyClass
{
private $var1 = ANOTHER_NONE_EXISTING_CONSTANT;
private $var2 = 1;
}
$obj = new MyClass();
Expected result:
----------------
A notice for the line where the undefined constant is being used, in this case Notice: Use of
undefined constant NONE_EXISTING_GLOBAL_CONSTANT [â¦] in line 6
Actual result:
--------------
Notice: Use of undefined constant ANOTHER_NONE_EXISTING_CONSTANT - assumed
'ANOTHER_NONE_EXISTING_CONSTANT' in /home/daniel/tmp/php-linenumber-bug/code.php on line
11
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=70457&edit=1