Mantis - Quercus
Viewing Issue Advanced Details
4483 minor always 04-06-11 10:34 04-06-11 10:57
tokeefe  
 
normal  
new 4.0.11  
open  
none    
none  
0004483: Root-level namespace not working
The following PHP 5.3+ code is valid, and does not produce any errors when interpreted with mod_php5:

   <?
   namespace foo;

   function foo(\Exception $e) { }

The same code when interpreted by Quercus 4.0.11 produces the following error:

com.caucho.quercus.parser.QuercusParseException: index.php:2: namespace identifier is not allowed at '\Exception' in
index.php

This prevents certain code that targets PHP 5.3 from running without modification on both Quercus 4 and mod_php5.
Apache HTTPD, PHP 5.3.3, and mod_php5 used in this example were installed through synaptic on Ubuntu 10.04 x86_64.

Notes
(0005163)
tokeefe   
04-06-11 10:57   
If it is of any help during debugging, it appears that I can only provoke this issue when using "\Exception" inside of a function signature.

For example, if you execute the following code, you will observe the issue when you uncomment the last line:

<?
namespace foo;

class FooException extends \Exception { }

try
{
        throwException();
}
catch(\Exception $e)
{
        echo "Exception caught";
}

function throwException()
{
        throw new \Exception("Ouch");
}

if(new \Exception() instanceof \Exception);

//function foobar(\Exception $e) { }