php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #25074 addslashes() fails for large data
Submitted: 2003-08-13 06:38 UTC Modified: 2003-08-13 13:01 UTC
From: sandeepc at myrealbox dot com Assigned:
Status: Not a bug Package: Performance problem
PHP Version: 4.2.3 OS: Linux 2.4.9
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: sandeepc at myrealbox dot com
New email:
PHP Version: OS:

 

 [2003-08-13 06:38 UTC] sandeepc at myrealbox dot com
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.

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2003-08-13 12:24 UTC] iliaa@php.net
Sorry, but your problem does not imply a bug in PHP itself.  For a
list of more appropriate places to ask for help using PHP, please
visit http://www.php.net/support.php as this bug system is not the
appropriate forum for asking support questions. 

Thank you for your interest in PHP.

This sounds like a configuration issue, possibly having to do with the memory limit.
 [2003-08-13 13:01 UTC] sniper@php.net
And also an ancient version of PHP..we're about to release 4.3.3, you know..

 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun Dec 22 11:01:30 2024 UTC