Bug #54361 [NEW]: Wrong line number in fatal error for bad namespace reference

From: Date: Wed, 23 Mar 2011 16:58:40 +0000
Subject: Bug #54361 [NEW]: Wrong line number in fatal error for bad namespace reference
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-159729@lists.php.net to get a copy of this message
From: Operating system: MacOSX PHP version: 5.3.6 Package: Class/Object related Bug Type: Bug Bug description:Wrong line number in fatal error for bad namespace reference 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 bug report at http://bugs.php.net/bug.php?id=54361&edit=1 -- Try a snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=54361&r=trysnapshot52 Try a snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=54361&r=trysnapshot53 Try a snapshot (trunk): http://bugs.php.net/fix.php?id=54361&r=trysnapshottrunk Fixed in SVN: http://bugs.php.net/fix.php?id=54361&r=fixed Fixed in SVN and need be documented: http://bugs.php.net/fix.php?id=54361&r=needdocs Fixed in release: http://bugs.php.net/fix.php?id=54361&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=54361&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=54361&r=needscript Try newer version: http://bugs.php.net/fix.php?id=54361&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=54361&r=support Expected behavior: http://bugs.php.net/fix.php?id=54361&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=54361&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=54361&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=54361&r=globals PHP 4 support discontinued: http://bugs.php.net/fix.php?id=54361&r=php4 Daylight Savings: http://bugs.php.net/fix.php?id=54361&r=dst IIS Stability: http://bugs.php.net/fix.php?id=54361&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=54361&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=54361&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=54361&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=54361&r=mysqlcfg

« previous php.bugs (#159729) next »