| 
        php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login | 
 PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits             
             [2017-03-02 18:35 UTC] mail at pmmaga dot net
  [2021-07-19 13:45 UTC] cmb@php.net
 
-Status:      Open
+Status:      Duplicate
-Assigned To:
+Assigned To: cmb
  [2021-07-19 13:45 UTC] cmb@php.net
  | 
    |||||||||||||||||||||||||||||||||||||
            
                 
                Copyright © 2001-2025 The PHP GroupAll rights reserved.  | 
        Last updated: Tue Nov 04 10:00:02 2025 UTC | 
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>