Re: assert()
| From: | Thies C. Arntzen | Date: | Sun, 21 Jul 2002 08:21:02 +0000 |
| Subject: | Re: assert() | ||
| References: | 1 2 3 | Groups: | php.dev |
| Request: | Send a blank email to php-dev+get-86045@lists.php.net to get a copy of this message | ||
On Sun, Jul 21, 2002 at 11:30:14AM +0900, Yasuo Ohgaki wrote:
> 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.
don't think so. but nothing stops you from diving into it.
re,
tc