Bug #68026 [NEW]: create_function() fails

From: Date: Tue, 16 Sep 2014 09:26:14 +0000
Subject: Bug #68026 [NEW]: create_function() fails
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-187546@lists.php.net to get a copy of this message
From: jmichae3 at yahoo dot com Operating system: Windows 7 pro x64 sp1 PHP version: 5.5.16 Package: Scripting Engine problem Bug Type: Bug Bug description:create_function() fails Description: ------------ create_function doesn't seem to actually create the function. Test script: --------------- $AcctTypes=preg_split('/,/', 'admin,paidbls,paidmusic,user'); for ($i=0; $i < count($AcctTypes); $i++) { global ${'is'.$AcctTypes[$i].'file'}; $funcbody='{ global $AcctTypes;'; $funcbody.=" if (strpos(\$filepath,\"/".$AcctTypes[$i]."/\") !== FALSE"; $funcbody.=" && strpos(\$filepath,\"/".$AcctTypes[$i]."/\") !== ''"; $funcbody.=" && strpos(\$filepath,\"/".$AcctTypes[$i]."/\") <=3) {"; $funcbody.=' return TRUE;'; $funcbody.=' } else {'; $funcbody.=' return FALSE;'; $funcbody.=' } }'; //create the function from the function body in $funcbody with name in $funcname ${'is'.$AcctTypes[$i].'file'}=create_function('$filepath', $funcbody); } for ($i=0; $i < count($AcctTypes); $i++) { if (!function_exists('is'.$AcctTypes[$i].'file')) { die("\n\nERROR:config file needs function ".'is'.$AcctTypes[$i].'file'."()\n\n"); } } Expected result: ---------------- functions created, no output. Actual result: -------------- ( my error when function not defined) ERROR:config file needs function isadminfile() -- Edit bug report at https://bugs.php.net/bug.php?id=68026&edit=1 -- Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=68026&r=trysnapshot54 Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=68026&r=trysnapshot55 Try a snapshot (trunk): https://bugs.php.net/fix.php?id=68026&r=trysnapshottrunk Fixed in SVN: https://bugs.php.net/fix.php?id=68026&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=68026&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=68026&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=68026&r=needscript Try newer version: https://bugs.php.net/fix.php?id=68026&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=68026&r=support Expected behavior: https://bugs.php.net/fix.php?id=68026&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=68026&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=68026&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=68026&r=globals PHP 4 support discontinued: https://bugs.php.net/fix.php?id=68026&r=php4 Daylight Savings: https://bugs.php.net/fix.php?id=68026&r=dst IIS Stability: https://bugs.php.net/fix.php?id=68026&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=68026&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=68026&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=68026&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=68026&r=mysqlcfg

« previous php.bugs (#187546) next »