Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:74292 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 57491 invoked from network); 17 May 2014 19:38:11 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 17 May 2014 19:38:11 -0000 Authentication-Results: pb1.pair.com header.from=inefedor@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=inefedor@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.215.42 as permitted sender) X-PHP-List-Original-Sender: inefedor@gmail.com X-Host-Fingerprint: 209.85.215.42 mail-la0-f42.google.com Received: from [209.85.215.42] ([209.85.215.42:60207] helo=mail-la0-f42.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id A1/B0-53190-1AAB7735 for ; Sat, 17 May 2014 15:38:10 -0400 Received: by mail-la0-f42.google.com with SMTP id el20so2954417lab.29 for ; Sat, 17 May 2014 12:38:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=content-type:to:cc:subject:references:date:mime-version :content-transfer-encoding:from:message-id:in-reply-to:user-agent; bh=81g4ST9Tr452cJtbSqbGQY2+nHsSwEEHyFic7ue02+8=; b=s6jf3sXSKnwAcJGVmApsUZhTN/S0L0dzRKVR0ZbBL88b4xNzt6wGT9lg9AV6FmyN+P uQJ9p5XvKNWIbQGo/025ZWFfSm+VPP3mSpK/uLwKnODuI69EA9R2dNbWyES15CaePr2L EKQjHcgIj3D0naBH6A7sBV9AObOFBe6TXlBX1U1zjw01T7k8SnRI4pBH1ZXOBS20tGwy SgL+WBzENryTmcPrDd2UOkLYmJ3r/j1p8udh5vLPadd/CRiheRvabesMRbXDUc30MiF2 HT/yF3NGH6TqlbWScRxV4Vdoo6RlGafy3gU1ynqhIojHub4utcUWKhWSYGkLAQj/VBnK u7xQ== X-Received: by 10.112.218.74 with SMTP id pe10mr17510745lbc.3.1400355487338; Sat, 17 May 2014 12:38:07 -0700 (PDT) Received: from nikita-pc (95-27-142-37.broadband.corbina.ru. [95.27.142.37]) by mx.google.com with ESMTPSA id to10sm12274298lbb.11.2014.05.17.12.38.02 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Sat, 17 May 2014 12:38:02 -0700 (PDT) Content-Type: text/plain; charset=koi8-r; format=flowed; delsp=yes To: "Nikita Popov" Cc: "PHP internals" References: Date: Sat, 17 May 2014 23:38:01 +0400 MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Message-ID: In-Reply-To: User-Agent: Opera Mail/12.17 (Win32) Subject: Re: [PHP-DEV] Rethinking 64bit sizes and PHP-NG From: inefedor@gmail.com ("Nikita Nefedov") On Sat, 17 May 2014 23:11:13 +0400, Nikita Popov wrote: > 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 > Ah well, my fault didn't see it :)