Re: Turning a string into a condition

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Feb 16, 2012 at 9:49 PM, Marc Guay <marc.guay@xxxxxxxxx> wrote:
>> I just added the return statement and the semicolon, because the error was complaining about it not being a proper PHP statement basically.
>
> That's beautiful, thanks.  I just stumbled across a forum post that
> said it wasn't possible and was about to give up for the day.
>
> Marc

While it works, I'm a bit worried about how you're going to use this.
If the data is from user input, then this is really dangerous (that's
why there is a big fat warning on the eval man page).
You can easily execute nasty commands with eval.
If it is user input, then it would be much safer to do the parsing
yourself. It shouldn't be that hard to parse this type of expressions.

- Matijn

- Matijn

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux