Bug #12083 Updated: addslashes
| From: | sander@php.net | Date: | Sat, 20 Oct 2001 09:48:21 +0000 |
| Subject: | Bug #12083 Updated: addslashes | ||
| References: | 1 | Groups: | php.dev |
| Request: | Send a blank email to php-dev+get-68487@lists.php.net to get a copy of this message | ||
ID: 12083
Updated by: sander
Reported By: xyrix@pisem.net
Old Status: Open
Status: Bogus
Bug Type: Strings related
Operating System: Win32
PHP Version: 4.0.5
New Comment:
addslashes() works fine for me on binary data...
Unlikely to be a bug: ask support questions on the appropriate mailinglist (see http://www.php.net/support.php).
Previous Comments:
------------------------------------------------------------------------
[2001-07-13 00:46:49] xyrix@pisem.net
$image_file=fopen($HTTP_POST_FILES['imagefile']['tmp_name'],"rb");
unset($upload);
while(!feof($image_file)) $upload.=fread($image_file,65535);
fclose($image_file);
$upload=str_replace("\\","\\\\",$upload);
$upload=addslashes($upload);
$query_str="INSERT INTO images (id, image_type, image) VALUES('',
'".$HTTP_POST_FILES['imagefile']['type']."',
'$upload')";
$insert=mysql_query($query_str, $link);
Function addslashes don't add slashes '\' before '\', and result is corrupt
image.
------------------------------------------------------------------------
[2001-07-12 03:05:03] derick@php.net
Please post a short example to show what goes wrong and why.
Derick
------------------------------------------------------------------------
[2001-07-12 02:41:51] xyrix@pisem.net
addslashes() don't properly work.
Before use it, need add this:
$str_any=str_replace("\\","\\\\",$str_any);
and only then:
$str_any=addslashes($str_any);
------------------------------------------------------------------------
Edit this bug report at http://bugs.php.net/?id=12083&edit=1