Req #60171 [Opn->Wfx]: Suggestion for new function
| From: | cataphract@php.net | Date: | Sun, 30 Oct 2011 00:52:48 +0000 |
| Subject: | Req #60171 [Opn->Wfx]: Suggestion for new function | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-164675@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=60171&edit=1
ID: 60171
Updated by: cataphract@php.net
Reported by: invictible at live dot co dot uk
Summary: Suggestion for new function
-Status: Open
+Status: Wont fix
Type: Feature/Change Request
Package: Unknown/Other Function
Operating System: Windows
PHP Version: 5.3.8
Block user comment: N
Private report: N
New Comment:
This is the purpose of eval (though it would probably be better â including versatile â to
parse the expression yourself), the "security issues" (really, input validation) can be
handled by analyzing the tokens in the strings; see token_get_all().
Besides, this request is very vague â for instance it doesn't specify which subset of the
expressions space would be admissible and gives a rationale for it.
Won't fix.
Previous Comments:
------------------------------------------------------------------------
[2011-10-29 21:28:06] invictible at live dot co dot uk
Description:
------------
I've been looking for a solution on PHP as I need some way to evaluate expressions within
strings.
Since with if:
$str = '5>6';
if($str)
Would evaluate as true regardless of the expression.
A good possible solution for this may be a function for evaluating the expressions in the string,
eg. evalexp($str); which would return true or false based on the expression within the string.
Eval is an alternative however, it can create security issues when used with user provided content
for obvious reasons.
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=60171&edit=1