Bug #54361 [Opn->Dup]: Wrong line number in fatal error for bad namespace reference
| From: | cmb@php.net | Date: | Mon, 19 Jul 2021 13:45:37 +0000 |
| Subject: | Bug #54361 [Opn->Dup]: Wrong line number in fatal error for bad namespace reference | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-235182@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=54361&edit=1
ID: 54361
Updated by: cmb@php.net
Reported by: robert at typo3 dot org
Summary: Wrong line number in fatal error for bad namespace
reference
-Status: Open
+Status: Duplicate
Type: Bug
Package: Class/Object related
Operating System: MacOSX
PHP Version: 5.3.6
-Assigned To:
+Assigned To: cmb
Block user comment: N
Private report: N
New Comment:
Closing as duplicate of bug #47405.
Previous Comments:
------------------------------------------------------------------------
[2017-03-02 18:35:56] mail at pmmaga dot net
Related to #47405
------------------------------------------------------------------------
[2011-03-23 17:58:39] robert at typo3 dot org
Description:
------------
When referring to a not existing namespace / class in a variable assignment of a
class (see code example), a fatal error is (correctly) triggered.
However, the error does not give a hint at where the problem actually lies but
refers to the location where the faulty class is instantiated.
Test script:
---------------
namespace FooNamespace {
class FooClass {
const MYCONST = 1;
}
}
namespace BarNamespace {
// this would prevent the fatal error:
# use FooNamespace as Foo;
class BarClass {
// the error is triggered by this line:
protected $variable = Foo\FooClass::MYCONST;
}
}
namespace {
// "Fatal error: Class 'BarNamespace\Foo\FooClass' not found in" the following
line:
$bar = new \BarNamespace\BarClass();
}
Expected result:
----------------
Fatal error: Class 'BarNamespace\Foo\FooClass' not found in test.php on line <line
number of the variable assignment in BarClass>
Actual result:
--------------
Fatal error: Class 'BarNamespace\Foo\FooClass' not found in test.php on line <line
number of new statement>
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=54361&edit=1