From:             dellytufy at hotmail dot com
Operating system: win
PHP version:      5.3SVN-2010-02-11 (SVN)
PHP Bug Type:     Unknown/Other Function
Bug description:  use namespace in eval

Description:
------------
i cannot use namespace in eval() 
as
eval('use namespaceName\classname as  myClass;');

after this  i cannot ust  $mc=myClass();  undeclared class

namespace d3;
    namespace d3\sql;
        class oracle{
             public $type='oracle';
        } 

         
       namespace d3\linq;
       class linq{
           public $className='linq';
       }


$type='oracle';    
   eval('use \d3\sql\\'.$type.' as baglanti;');
   $a=new baglanti();// error. undeclared class  d3\linq\baglanti
   echo $a->type; 

Reproduce code:
---------------
$type='oracle';    
   eval('use \d3\sql\\'.$type.' as baglanti; $a=new baglanti();');
   echo $a->type; 

but this is successfully runned.

Expected result:
----------------
namespace d3;
    namespace d3\sql;
        class oracle{
             public $type='oracle';
        } 

         
       namespace d3\linq;
       class linq{
           public $className='linq';
       }


$type='oracle';    
   eval('use \d3\sql\\'.$type.' as baglanti;');
$a=new baglanti();
  echo $a->type; 

i think it must write oracle .


-- 
Edit bug report at http://bugs.php.net/?id=51013&edit=1
-- 
Try a snapshot (PHP 5.2):            
http://bugs.php.net/fix.php?id=51013&r=trysnapshot52
Try a snapshot (PHP 5.3):            
http://bugs.php.net/fix.php?id=51013&r=trysnapshot53
Try a snapshot (PHP 6.0):            
http://bugs.php.net/fix.php?id=51013&r=trysnapshot60
Fixed in SVN:                        
http://bugs.php.net/fix.php?id=51013&r=fixed
Fixed in SVN and need be documented: 
http://bugs.php.net/fix.php?id=51013&r=needdocs
Fixed in release:                    
http://bugs.php.net/fix.php?id=51013&r=alreadyfixed
Need backtrace:                      
http://bugs.php.net/fix.php?id=51013&r=needtrace
Need Reproduce Script:               
http://bugs.php.net/fix.php?id=51013&r=needscript
Try newer version:                   
http://bugs.php.net/fix.php?id=51013&r=oldversion
Not developer issue:                 
http://bugs.php.net/fix.php?id=51013&r=support
Expected behavior:                   
http://bugs.php.net/fix.php?id=51013&r=notwrong
Not enough info:                     
http://bugs.php.net/fix.php?id=51013&r=notenoughinfo
Submitted twice:                     
http://bugs.php.net/fix.php?id=51013&r=submittedtwice
register_globals:                    
http://bugs.php.net/fix.php?id=51013&r=globals
PHP 4 support discontinued:          http://bugs.php.net/fix.php?id=51013&r=php4
Daylight Savings:                    http://bugs.php.net/fix.php?id=51013&r=dst
IIS Stability:                       
http://bugs.php.net/fix.php?id=51013&r=isapi
Install GNU Sed:                     
http://bugs.php.net/fix.php?id=51013&r=gnused
Floating point limitations:          
http://bugs.php.net/fix.php?id=51013&r=float
No Zend Extensions:                  
http://bugs.php.net/fix.php?id=51013&r=nozend
MySQL Configuration Error:           
http://bugs.php.net/fix.php?id=51013&r=mysqlcfg

Reply via email to