ZE2 and assert()
| From: | David Brown | Date: | Fri, 30 May 2003 19:03:36 +0000 |
| Subject: | ZE2 and assert() | ||
| Groups: | php.internals | ||
| Request: | Send a blank email to internals+get-2097@lists.php.net to get a copy of this message | ||
Hi:
Given the following script, which uses assert to eval() a string that
references the current class:
<?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
dave@codewhore.org