#34496 [NEW]: single quote copying files
| From: | before_after_death at yahoo dot com | Date: | Wed, 14 Sep 2005 02:54:18 +0000 |
| Subject: | #34496 [NEW]: single quote copying files | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-85006@lists.php.net to get a copy of this message | ||
From: before_after_death at yahoo dot com
Operating system: WINDOWS XP
PHP version: 5.0.5
PHP Bug Type: *Directory/Filesystem functions
Bug description: single quote copying files
Description:
------------
There's bug that I found in PHP5.0.4 (I'm sorry if the problem has been
fixed)
This is the problem:
for example: the $uploadfile=bring'iton.jpg
and the result: iton.jpg
it doesn't happen at PHP4 version, so I remigrate to PHP4 again.
Reproduce code:
---------------
<?
include "connect.config.php";
$cwdvar=getcwd();
$cwdvar1=str_replace("\\","/",$cwdvar);
$file_name = "$uploadFile_name";
echo "$uploadFile_name";
$file_name=str_replace("'","",$file_name);
$copy = copy($uploadFile,$file_name);
if($copy){
echo "<b>$file_name </b> upload succeed<br>";
$query_insert="INSERT INTO dirfiles (filename, dirpath) VALUES
('$file_name', '$cwdvar1')";
$query_res=mysql_query("$query_insert");
if($query_res){
echo "database updated";
}
}else{
echo "<b>$file_name</b> database doesn't updated<br>";
}
?>
Expected result:
----------------
i expect the result is bringiton.jpg (because there's an str_replace
function)
and I try to remigrate to PHP4, the result is bringiton.jpg
Actual result:
--------------
The result is iton.jpg (at PHP 5.0.4)
--
Edit bug report at http://bugs.php.net/?id=34496&edit=1
--
Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=34496&r=trysnapshot4
Try a CVS snapshot (php5.0): http://bugs.php.net/fix.php?id=34496&r=trysnapshot50
Try a CVS snapshot (php5.1): http://bugs.php.net/fix.php?id=34496&r=trysnapshot51
Fixed in CVS: http://bugs.php.net/fix.php?id=34496&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=34496&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=34496&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=34496&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=34496&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=34496&r=support
Expected behavior: http://bugs.php.net/fix.php?id=34496&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=34496&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=34496&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=34496&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=34496&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=34496&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=34496&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=34496&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=34496&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=34496&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=34496&r=mysqlcfg