php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #44653 Irritating warning concerning non-compound name in use statement.
Submitted: 2008-04-06 13:26 UTC Modified: 2008-04-09 08:57 UTC
From: jreich at jreich dot com Assigned: dmiry (profile)
Status: Closed Package: Scripting Engine problem
PHP Version: 5.3CVS-2008-04-06 (snap) OS:
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem:
38 - 30 = ?
Subscribe to this entry?

 
 [2008-04-06 13:26 UTC] jreich at jreich dot com
Description:
------------
Using a non-compound name in a use statement results in a warning that 
states non-compound names in use statement would have no effect which 
isn't true as the following reproduce code shows.

Reproduce code:
---------------
<?php // a.php
namespace Test1;
function fooBar() { echo 'Test1::fooBar()' . PHP_EOL; }

namespace Test2;
use Test1;
Test1::fooBar();

<?php // b.php
namespace Test1;
function fooBar() { echo 'Test1::fooBar()' . PHP_EOL; }

namespace Test2;
Test1::fooBar();


Expected result:
----------------
No warning or same behavior with and without use statement.

Actual result:
--------------
Executing a.php results in "Warning: The use statement with non-compound 
name 'Test1' has no effect in [...]".
Executing b.php results in "Fatal error: Class 'Test2::Test1' not found 
in [...]".





Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2008-04-09 08:57 UTC] dmitry@php.net
Fixed name resolution for the second case (b.php), however warning for the first case (a.php) is not removed.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Apr 20 03:01:28 2024 UTC