From: eric at evilwalrus dot com
Operating system: Windows XP
PHP version: 5CVS-2003-03-17 (dev)
PHP Bug Type: Zend Engine 2 problem
Bug description: Classes outside of namespaces cannot be called.
If I have the following script, the class that is defined before the
namespace cannot be called from within a class in the namespace.
<?php
class TestClass2
{
function __construct()
{
print "TestClass2\n";
}
}
namespace Test
{
function newClass () {
$new = new TestClass();
$new->newClass();
}
class TestClass
{
function __construct()
{
print "TestClass\n";
}
function newClass ()
{
$new = new TestClass2();
}
}
}
Test::newClass();
//$new = new TestClass2();
?>
This example will show the error "Fatal error: Class 'testclass2' not
found in c:\usr\test.php on line 26" I'm assuming that this is done by
design... but I would think that PHP would look for the class outside of
the namespace since it is defined before the namespace. If you use the
commented out line $new = new TestClass2; instead of the Test::newClass();
then it works properly, and the TestClass2 construct is called.
As I said, I think this is done by design and isn't a bug... but I thought
I would submit it because I'm not for sure. Any explination though would
be very helpful to me. Thanks.
--
Edit bug report at http://bugs.php.net/?id=22749&edit=1
--
Try a CVS snapshot: http://bugs.php.net/fix.php?id=22749&r=trysnapshot
Fixed in CVS: http://bugs.php.net/fix.php?id=22749&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=22749&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=22749&r=needtrace
Try newer version: http://bugs.php.net/fix.php?id=22749&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=22749&r=support
Expected behavior: http://bugs.php.net/fix.php?id=22749&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=22749&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=22749&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=22749&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=22749&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=22749&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=22749&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=22749&r=gnused