Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:76967 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 25749 invoked from network); 30 Aug 2014 12:03:54 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 30 Aug 2014 12:03:54 -0000 Authentication-Results: pb1.pair.com header.from=are.you.winning@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=are.you.winning@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.216.182 as permitted sender) X-PHP-List-Original-Sender: are.you.winning@gmail.com X-Host-Fingerprint: 209.85.216.182 mail-qc0-f182.google.com Received: from [209.85.216.182] ([209.85.216.182:49734] helo=mail-qc0-f182.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id F5/E1-09868-7ADB1045 for ; Sat, 30 Aug 2014 08:03:52 -0400 Received: by mail-qc0-f182.google.com with SMTP id m20so3585311qcx.13 for ; Sat, 30 Aug 2014 05:03:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date:message-id:subject :from:to:cc:content-type; bh=8f+EHGM+VLcJvHg7P5ja3fDV2gHygrkD3muXyA3j3Lc=; b=kvyhQcAz/v1vloNTu+VG/WCIuF1B1ghM0QQytlUR013/AvYqPrJVejJxlEHhPXgr55 xCc5/SPdb4Gr+Qwu2qsIPd5OLXocu+j4RlXFaKQ/j9KbnZ3LmcNb3M9SRgDBigmE4bjy gFShc3erS8grYRy2JG+AFKl6LNKgG/45vqQ+aS3RoOtijI5es8RZMHC4hiaJnVJ7zBSf ZW5fUsguOHFBiNYb0QOI+631OkZVLNhxPTxV+QkqzLEuLufL3s6Ep+Yoi6T/nvgSe3xQ JkkNB6jmXyjgi2fHysV2NtTjSL43yXUL0stc8leeytL0GQoS26xClsjbON6ad6y3IAuF pIOQ== MIME-Version: 1.0 X-Received: by 10.140.49.201 with SMTP id q67mr24921036qga.7.1409400228766; Sat, 30 Aug 2014 05:03:48 -0700 (PDT) Sender: are.you.winning@gmail.com Received: by 10.141.28.193 with HTTP; Sat, 30 Aug 2014 05:03:48 -0700 (PDT) In-Reply-To: <5401BB3D.4060000@beccati.com> References: <2afc5a878ff4c780c74f4604f77525c1.squirrel@webmail.klapt.com> <8642f96d780f339c448bd330c6e1c097.squirrel@webmail.klapt.com> <5401BB3D.4060000@beccati.com> Date: Sat, 30 Aug 2014 13:03:48 +0100 X-Google-Sender-Auth: SBeCHJZV0exRnS0s5jyHR53gTXI Message-ID: To: Matteo Beccati Cc: Anatol Belski , Xinchen Hui , PHP Internals , Nikita Popov , Pierre Joye , Dmitry Stogov Content-Type: text/plain; charset=UTF-8 Subject: Re: [PHP-DEV] Re: 64 bit string offsets From: cw@daverandom.com (Chris Wright) On 30 August 2014 12:53, Matteo Beccati 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