|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2003-07-03 02:08 UTC] sterling@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Mon Dec 08 07:00:01 2025 UTC |
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