php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #47379 After defining namespace using curly brace, we can't have any statement then
Submitted: 2009-02-13 04:01 UTC Modified: 2009-02-13 21:15 UTC
From: vivekanandan8 at yahoo dot com Assigned:
Status: Not a bug Package: *Programming Data Structures
PHP Version: 5.3.0beta1 OS: debian linux
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:
46 - 38 = ?
Subscribe to this entry?

 
 [2009-02-13 04:01 UTC] vivekanandan8 at yahoo dot com
Description:
------------
when defining the namespace using the curly brace,no statement can't be accepted after the end of namespace,hence we are forced to use in the separate include file.
where as other format of defining namespace like 
namsespace a; works fine.


Reproduce code:
---------------
<?php

namespace nsUserInfo {
const vRole = 'user';
}

print "Expected Result :". \nsUserInfo\vRole;

?>


Expected result:
----------------
Expected Result :user

Actual result:
--------------
Fatal error: No code may exist outside of namespace {} in /usr/local/apache/htdocs/php/nstest.php on line 7

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2009-02-13 21:15 UTC] felipe@php.net
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php

See: http://docs.php.net/manual/en/language.namespaces.definitionmultiple.php
 
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Fri Nov 26 23:03:13 2021 UTC