Re: Re: 64 bit string offsets

From: Date: Sat, 30 Aug 2014 12:03:48 +0000
Subject: Re: Re: 64 bit string offsets
References: 1 2 3 4  Groups: php.internals 
Request: Send a blank email to internals+get-76967@lists.php.net to get a copy of this message
On 30 August 2014 12:53, Matteo Beccati <php@beccati.com> wrote: > On 29/08/2014 23:58, Anatol Belski wrote: >> On Fri, August 29, 2014 18:34, Xinchen Hui wrote: >>> if a string is bigger than 2^32... I think there must be a bug.... :) >>> >> Only for this case you mean, or generally? As we safe with memory_limit >> anyway. > > Even though size_t allows "huge" strings, would it be so bad to throw an > error when one tries to create a string longer than 2^32 bytes, > regardless of memory_limit? This would be an unnecessary and somewhat arbitrary limitation. Yes, loading >2GB of *anything* into memory in PHP *probably* makes no sense (probably 99% of real-world installations have memory_limit set much lower than this anyway), but just because we cannot think of a valid use case does not mean there isn't one. If the string index deref issue cannot be solved, it can simply be documented as only working for offsets up to 2^31, but I personally am not in favour of imposing limitations on the size of a string for a non-technical reason. Thanks, Chris

« previous php.internals (#76967) next »