#23922 [NEW]: With assert(string): $this unavailable inside of eval() code

From: Date: Sat, 31 May 2003 14:48:09 +0000
Subject: #23922 [NEW]: With assert(string): $this unavailable inside of eval() code
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-40782@lists.php.net to get a copy of this message
From: dave at codewhore dot org Operating system: Linux 2.4 PHP version: 5CVS-2003-05-31 (dev) PHP Bug Type: Scripting Engine problem Bug description: With assert(string): $this unavailable inside of eval() code Hi: Given the following script, which uses assert to eval() a string that references the current class instance: <?php class foo { var $foo = 1; function as_string() { assert('$this->foo == 1'); } function as_expr() { assert($this->foo == 1); } } $foo = new foo(); $foo->as_expr(); $foo->as_string(); ?> PHP 4.3-cvs executes it correctly, but PHP 5.0-cvs with ZE2 fails: Fatal error: Using $this when not in object context in /home/dave/test.php(8) : assert code on line 1 Is this expected behavior? More specifically, is $this no longer available inside of an eval() on ZE2? Thanks in advance, - Dave -- Edit bug report at http://bugs.php.net/?id=23922&edit=1 -- Try a CVS snapshot: http://bugs.php.net/fix.php?id=23922&r=trysnapshot Fixed in CVS: http://bugs.php.net/fix.php?id=23922&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=23922&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=23922&r=needtrace Try newer version: http://bugs.php.net/fix.php?id=23922&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=23922&r=support Expected behavior: http://bugs.php.net/fix.php?id=23922&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=23922&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=23922&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=23922&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=23922&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=23922&r=dst IIS Stability: http://bugs.php.net/fix.php?id=23922&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=23922&r=gnused

« previous php.bugs (#40782) next »