Bug #12158: EVAL code not working correctly if IF block
| From: | craig at nerds dot net | Date: | Sat, 14 Jul 2001 00:58:01 +0000 |
| Subject: | Bug #12158: EVAL code not working correctly if IF block | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-60014@lists.php.net to get a copy of this message | ||
From: craig@nerds.net
Operating system: Win2K
PHP version: 4.0.6
PHP Bug Type: Strings related
Bug description: EVAL code not working correctly if IF block
<?php
$extensions=array(".htm",".asp");
$x="";
$numargs=count($extensions);
for ($i=0;$i<=$numargs-1;$i++){
$x=$x."strstr(\$filename,\"".$extensions[$i]."\")";
if ($numargs>0 && $i!=$numargs-1){
$x=$x." || ";
}
}
$validExtensions=$x;
echo $validExtensions;
$handle=opendir('.');
while (($filename = readdir($handle))!==false) {
if (is_file($filename)){
$fd = fopen ($filename, "rb");
$contents = fread ($fd, filesize ($filename));
if (eval($validExtensions)){
echo $filename."<br>";
}
fclose ($fd);
}
}
closedir($handle);
?>
--
Edit bug report at: http://bugs.php.net/?id=12158&edit=1