From: sandeepc at myrealbox dot com
Operating system: Linux 2.4.9
PHP version: Irrelevant
PHP Bug Type: Performance problem
Bug description: addslashes() fails for large data
Description:
------------
using addslashes() on large data fails. We tested with data size ranging
form 4MB to 100 MB.It would fail around 36 MB of data.
I have'nt tested this in the latest releases, however.
>From phpinfo():
PHP Version 4.2.3
System: Linux linuxbuild 2.4.9-e.3smp #1 SMP Fri May 3 16:48:54 EDT 2002
i686
Build Date Apr 29 2003 17:44:32
Server API Apache
Virtual Directory Support disabled
Thread Safety disabled
Configure Command './configure' '--enable-shared=all' '--disable-static'
'--enable-memory-limit=yes' '--enable-magic-quotes=yes'
'--enable-debug=no' '--enable-inline-optimization' '--enable-mbstring'
'--enable-safe-mode' '--enable-sigchild' '--enable-sysvsem'
'--enable-sysvshm' '--enable-shmop' '--enable-track-vars'
'--enable-gd-native-ttf' '--enable-gd-imgstrttf' '--with-gd' '--with-xml'
'--with-dom' '--with-ttf' '--with-gettext' '--with-ldap' '--with-curl'
'--with-mcrypt' '--without-mysql' '--without-imap' '--with-pgsql'
'--with-apxs'
Reproduce code:
---------------
<?php
if ($upload){
$size=filesize($uploaded_data);
$data = "";
if (is_uploaded_file($uploaded_data)){
if ($fp = fopen($uploaded_data, "r")){
$data = fread($fp,$size);
fclose($fp);
addslashes($data);
print "Hello World";
}// end if (able to get uploaded file)
}
}
else{
?>
<html>
<form method="POST" enctype="multipart/form-data" name="testform">
<input type="hidden" name="MAX_FILE_SIZE" value="104857600">
<input type="file" name="uploaded_data" size="30"><br><br>
<input type="submit" name="upload" value="Upload">
</form>
</html>
<?php
}
?>
Expected result:
----------------
We are storing the uploaded file into a table(Postgres).
The uploaded data needs to be addslashes()'d before storing into the
database.
Actual result:
--------------
There is no error in the error log, however the php hangs.
--
Edit bug report at http://bugs.php.net/?id=25074&edit=1
--
Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=25074&r=trysnapshot4
Try a CVS snapshot (php5): http://bugs.php.net/fix.php?id=25074&r=trysnapshot5
Fixed in CVS: http://bugs.php.net/fix.php?id=25074&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=25074&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=25074&r=needtrace
Try newer version: http://bugs.php.net/fix.php?id=25074&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=25074&r=support
Expected behavior: http://bugs.php.net/fix.php?id=25074&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=25074&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=25074&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=25074&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=25074&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=25074&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=25074&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=25074&r=gnused