Re: assert()

From: Date: Sun, 21 Jul 2002 02:30:14 +0000
Subject: Re: assert()
References: 1 2  Groups: php.dev 
Request: Send a blank email to php-dev+get-86044@lists.php.net to get a copy of this message
Thies C. Arntzen wrote:
On Sat, Jul 20, 2002 at 10:31:39AM +0900, Yasuo Ohgaki wrote:
We can write assert code as a function, ========== [yohgaki@dev DEV]$ php <?php function t() { return false; } assert('t();'); ?> PHP Warning: Assertion "t();" failed in - on line 7 ========== but we cannot write assert code as string. ========== [yohgaki@dev DEV]$ php <?php assert('if (1) return false;'); ?> PHP Parse error: parse error in -(2) : assert code on line 1 ========== Current assert() behavior is the same as passing function name as parameter. Any reason why? Shouldn't it behave like eval()? or make assert() accept a function.
    hmm, it actually uses zend_eval_string(). not sure what's
    wrong. have no time to dig into this though.
This behavior should be a bug, then. It sounds like a scripting engine problem. -- Yasuo Ohgaki

« previous php.dev (#86044) next »