Bug #5435 Updated: Request to update eval() or create new function.

From: Date: Sat, 08 Jun 2002 13:59:23 +0000
Subject: Bug #5435 Updated: Request to update eval() or create new function.
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-9846@lists.php.net to get a copy of this message
ID: 5435 Updated by: bigredlinux@yahoo.com Reported By: dahamsta@iewebs.com Status: Open Bug Type: Feature/Change Request PHP Version: 4.0.0 New Comment: Oh, this would be a great feature. One thing this would add is the ability to run an xml string with processing instructions right through php, by just passing it to eval and assuming that eval knows it is going to have php somewhere in it. Very nice feature request! Previous Comments: ------------------------------------------------------------------------ [2000-07-07 15:46:10] dahamsta@iewebs.com Currently, to eval() regular data retrieved from a database or include file, I need to escape from PHP and re-enter it. For example: Presume that I have retrieved data from a source, which is equivalent to a regular PHP file (including plain HTML). To operate eval() on that, and avoid parsing the HTML and thus causing PHP errors, I need to use a function like this: function my_eval($my_eval_str) { $eval_str = "?>"; $eval_str .= $my_eval_str; $eval_str .= "<?"; return eval($eval_str); } This would also make it impossible to access variables in the GLOBAL symbol table, unless I extract($GLOBALS) into the current sumbol table. My suggestion is to either add a second eval() function that will operate in this way; or add a second argument to eval(), such as: void eval (string code_str, string eval_type); Where 'code_str' is the same as the current eval() function, and 'eval_type' is one of two options - one for just PHP code, and one for a string that will contain data escaped from PHP. The default could be set to the current operation, and the second argument could be optional. Ta, adam ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=5435&edit=1

« previous php.bugs (#9846) next »