Re: Evaluating math without eval()

From: Date: Mon, 14 Apr 2008 06:44:26 +0000
Subject: Re: Evaluating math without eval()
References: 1 2 3 4  Groups: php.general 
Request: Send a blank email to php-general+get-272963@lists.php.net to get a copy of this message
On Sat, 2008-04-12 at 09:05 -0500, Ray Hauge wrote: > > you might be able to leverage a call to expr on a bash sell. Just > replace the variables you're expecting with preg_replace or some similar > function. > > http://hacktux.com/bashmath > http://sysblogd.wordpress.com/2007/08/26/let-bash-do-the-math-doing-calculations-using-that-bash/ > > I'm not sure if that's any more secure than eval though. Good idea Ray. I'm thinking that it might be safer to exec a separate app - preferably sandboxed. That way it could still be PHP (or anything else really) but without the headache of compromising the main application. J

« previous php.general (#272963) next »