php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #24712 eval '}' bug
Submitted: 2003-07-18 18:57 UTC Modified: 2003-07-19 03:28 UTC
From: vincent at consultmac dot com Assigned:
Status: Not a bug Package: Feature/Change Request
PHP Version: 4CVS-2003-07-18 (stable) OS: Apache
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: vincent at consultmac dot com
New email:
PHP Version: OS:

 

 [2003-07-18 18:57 UTC] vincent at consultmac dot com
Description:
------------
When I try to create a new function using eval(), it 
just return a parse error: "unexpected '}'"


Oh, I'm using version 4.2.2

Reproduce code:
---------------
function new_func($args,$code) {
$ldelim = '{';
$rdelim = '}'
$l = 'abcdefghijklmnopqrstuvwxyz';
$ret = '';
for ($x = 0; $x < 15; $x++):
$ret .= $l[rand(0,strlen($l) - 1)];
endfor;

eval('function ' . $ret . '(' . $args . ')' . $ldelim . " " . $code . " " .  $rdelim);

return $ret;

}

Expected result:
----------------
To "eval a new function.

Actual result:
--------------
Reports "unexpected '}' on line..."

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2003-07-19 03:28 UTC] derick@php.net
You're just doing something wrong here, try to prove me wrong by submitting a FULL script that we can copy and paste to try ourselves.
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Sun Sep 07 21:00:01 2025 UTC