Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:74290 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 53106 invoked from network); 17 May 2014 19:11:16 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 17 May 2014 19:11:16 -0000 Authentication-Results: pb1.pair.com header.from=nikita.ppv@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=nikita.ppv@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.219.44 as permitted sender) X-PHP-List-Original-Sender: nikita.ppv@gmail.com X-Host-Fingerprint: 209.85.219.44 mail-oa0-f44.google.com Received: from [209.85.219.44] ([209.85.219.44:47114] helo=mail-oa0-f44.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 84/02-43080-354B7735 for ; Sat, 17 May 2014 15:11:16 -0400 Received: by mail-oa0-f44.google.com with SMTP id o6so4538064oag.31 for ; Sat, 17 May 2014 12:11:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=wGoh3ULDB27cS9NWlLAYQjfy5kBWPvY7TqXdSYPdlOI=; b=MhDEOSepyk89jgv9mYk+4lHZHSpevk8S5ZWWW2SA0uv4vY2a0pkXu/UU/bciXSqqLs 9afH+7sAQgE7MHs/RTk8Oy9gAa84ZtuVyavfRcw3/vHpszkeaCu5w+9p9uOS0sTvFjpU G2WBz8lfnhrq5g2JgNNvsY+eTH9AumlDqTJrQOboyaqCgPjmL6xMB7B5bacv/dP+YRJX UavCDGReQg1A9OnF7zAiSA4wvR1ZdagMr0Qk2KC2B4VCJzxwyTd/qtO/JPtoU6DpqOoi axn0TZMGLleAk1MIXQNFxi5QBf2ZC2cDLRmzkoBOeM30oasdFWVxxF5dhYs8gqKpHkVs n+1Q== MIME-Version: 1.0 X-Received: by 10.60.133.81 with SMTP id pa17mr25812983oeb.35.1400353873313; Sat, 17 May 2014 12:11:13 -0700 (PDT) Received: by 10.182.165.69 with HTTP; Sat, 17 May 2014 12:11:13 -0700 (PDT) In-Reply-To: References: Date: Sat, 17 May 2014 21:11:13 +0200 Message-ID: To: Nikita Nefedov Cc: PHP internals Content-Type: multipart/alternative; boundary=047d7b4728002dc48704f99d4b93 Subject: Re: [PHP-DEV] Rethinking 64bit sizes and PHP-NG From: nikita.ppv@gmail.com (Nikita Popov) --047d7b4728002dc48704f99d4b93 Content-Type: text/plain; charset=UTF-8 On Sat, May 17, 2014 at 9:01 PM, Nikita Nefedov wrote: > Hey, > > First thank you for arranging all this points. > > I just wanted to ask: could we also make nNextFreeElement be unsigned? > Because with your proposal it would be possible to overflow it with the > code like this: $array[pow(2, 32) + 1] = 123; (if I understand it correctly) > > And besides that we can't have negative keys anyway. > PHP arrays store integral keys larger than PHP_INT_MAX as a string rather than an integer. Auto-incrementing does not work past that point. If you write something like this... $array[PHP_INT_MAX] = 42; $array[] = 43; ...you'll receive an error (this is intentional). You get that error because the code explicitly makes sure that nNextFreeElement can never overflow. (Here is an example of such an overflow check: http://lxr.php.net/xref/PHP_TRUNK/Zend/zend_hash.c#435). Nikita --047d7b4728002dc48704f99d4b93--