#51013 [Bgs]: use namespace in eval

From: Date: Thu, 11 Feb 2010 13:21:19 +0000
Subject: #51013 [Bgs]: use namespace in eval
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-147436@lists.php.net to get a copy of this message
ID: 51013 User updated by: dellytufy at hotmail dot com Reported By: dellytufy at hotmail dot com Status: Bogus Bug Type: Unknown/Other Function Operating System: win PHP Version: 5.3SVN-2010-02-11 (SVN) New Comment: thanx i will check again but why it's running eval('use \d3\sql\\'.$type.' as baglanti; $a=new baglanti();'); it's not eval('use \d3\sql\\'.$type.' as baglanti;'); Previous Comments: ------------------------------------------------------------------------ [2010-02-11 12:11:43] johannes@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 The use in the eval() is valid for the eval\'d code. ------------------------------------------------------------------------ [2010-02-11 11:53:49] dellytufy at hotmail dot com 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 this bug report at http://bugs.php.net/?id=51013&edit=1

« previous php.bugs (#147436) next »