php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #63298 Nothing resolves upwards in PHP
Submitted: 2012-10-17 22:25 UTC Modified: 2013-03-03 00:12 UTC
Votes:1
Avg. Score:1.0 ± 0.0
Reproduced:0 of 1 (0.0%)
From: nat at nath dot is Assigned:
Status: Not a bug Package: *General Issues
PHP Version: 5.4.7 OS: Unix
Private report: No CVE-ID: None
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: nat at nath dot is
New email:
PHP Version: OS:

 

 [2012-10-17 22:25 UTC] nat at nath dot is
Description:
------------
---
From manual page: http://www.php.net/language.namespaces.global
---

I would love to use namespaces, but it seems kind of silly that nothing in PHP 
resolves upwards (be that variables, classes, constants or functions).



Test script:
---------------
https://gist.github.com/3908714/c7639b02a8a4fc2c13ebfbcb35e41d17ab1b8d44

Expected result:
----------------
whoof

Actual result:
--------------
Fatal error: Class 'MyProject\Animal\Animal' not found in 
/Users/Nathaniel/Projects/test/animal/dog.php on line 5


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2012-10-26 18:51 UTC] dagguh at gmail dot com
your Animal class is not in global namespace, but in MyProject.
You gotta import it via:
use MyProject\Animal;

This request is invalid
BTW. Namespaces should be all in lowercase.
 [2013-03-03 00:12 UTC] bjori@php.net
-Status: Open +Status: Not a bug
 [2013-03-03 00:12 UTC] bjori@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


 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Thu Jul 17 14:04:04 2025 UTC