php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #61549 2GB string size limit is too small
Submitted: 2012-03-29 03:08 UTC Modified: 2015-04-06 15:22 UTC
Votes:209
Avg. Score:5.0 ± 0.3
Reproduced:207 of 208 (99.5%)
Same Version:205 (99.0%)
Same OS:205 (99.0%)
From: tstarling@php.net Assigned: dmitry (profile)
Status: Closed Package: Scripting Engine problem
PHP Version: master OS: any
Private report: No CVE-ID: None
 [2012-03-29 03:08 UTC] tstarling@php.net
Description:
------------
According to language.types.string.php: "Note: It is no problem for a string to become very large. PHP imposes no boundary on the size of a string; the only limit is the available memory of the computer on which PHP is running."

The incorrectness of this statement is growing as time goes on. Strings are limited to 2GB, which is a small and ever-shrinking fraction of the memory available on a typical modern server.


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2012-03-30 10:26 UTC] yohgaki@php.net
-Status: Open +Status: Closed -Assigned To: +Assigned To: yohgaki
 [2012-03-30 10:26 UTC] yohgaki@php.net
This bug has been fixed in the documentation's XML sources. Since the
online and downloadable versions of the documentation need some time
to get updated, we would like to ask you to be a bit patient.

Thank you for the report, and for helping us make our documentation better.


 [2012-03-31 01:45 UTC] yohgaki@php.net
Re-opened as feature request.

String size is limited by zvalue due to "signed int" for string length. 2GB 
string size limit is too small for today. Memory is cheap and there many PC has 
more than 8GB or more. It's simply too small for load large files, etc.
 [2012-03-31 01:45 UTC] yohgaki@php.net
-Summary: String size limit +Summary: 2GB string size limit is too small -Status: Closed +Status: Re-Opened -Type: Documentation Problem +Type: Feature/Change Request -Package: Documentation problem +Package: Scripting Engine problem -Operating System: +Operating System: any -PHP Version: 5.4.0 +PHP Version: master -Assigned To: yohgaki +Assigned To: dmitry
 [2012-03-31 01:46 UTC] yohgaki@php.net
I think this is good changes for next PHP release.
 [2012-03-31 11:57 UTC] tstarling@php.net
It's not quite as simple as changing the type of zvalue_value.str.len. String sizes are assumed to be ints or unsigned ints in lots of other interfaces, perhaps most notably zend_parse_parameters().
 [2015-04-06 15:22 UTC] dmitry@php.net
-Status: Re-Opened +Status: Closed
 [2015-04-06 15:22 UTC] dmitry@php.net
Implemented in PHP-7 (only in 64-bit version of course).
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Wed Apr 24 00:01:32 2024 UTC