Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:56431 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 35206 invoked from network); 19 Nov 2011 14:00:23 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 19 Nov 2011 14:00:23 -0000 Authentication-Results: pb1.pair.com smtp.mail=dragoonis@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=dragoonis@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.220.170 as permitted sender) X-PHP-List-Original-Sender: dragoonis@gmail.com X-Host-Fingerprint: 209.85.220.170 mail-vx0-f170.google.com Received: from [209.85.220.170] ([209.85.220.170:59589] helo=mail-vx0-f170.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id BC/D2-17432-576B7CE4 for ; Sat, 19 Nov 2011 09:00:22 -0500 Received: by vcbgb30 with SMTP id gb30so370239vcb.29 for ; Sat, 19 Nov 2011 06:00:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; bh=62osT+qwQM2oDmdDUuEiuSXgn6e515DkaHraRZO6RXM=; b=aBr/w2yvs/6Fb0n8pniItauzW0K7dBss2A8/ndmvxjCpmrOUbX9A2QAEpdgus1/xtU Vt2ZBCeufBlm3mLpCWFGYrr14vWKL1pmO2iVKkYk3B+K90B00PPFwq2SsCL5C8YBANfr /jof8xaRnC6wL3GhgFdMzKx2y9DpkH5uHITTY= MIME-Version: 1.0 Received: by 10.229.68.148 with SMTP id v20mr781129qci.76.1321711218853; Sat, 19 Nov 2011 06:00:18 -0800 (PST) Received: by 10.229.80.198 with HTTP; Sat, 19 Nov 2011 06:00:18 -0800 (PST) In-Reply-To: References: Date: Sat, 19 Nov 2011 14:00:18 +0000 Message-ID: To: Anthony Ferrara Cc: PHP Internals List Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Subject: Re: [PHP-DEV] PHP Integer Bug From: dragoonis@gmail.com (Paul Dragoonis) Thanks for the response guys. It wasn't important that I casted my value I was just being pedantic in the first place. Removing the cast stops be from being hit with INT_MAX and INT_SIZE. Cheers! Paul Dragoonis. On Sat, Nov 19, 2011 at 1:53 PM, Anthony Ferrara wrot= e: > If I'm not mistaken, that is to be expected. =A0That's because you're on > a 32 bit system, so the maximum possible int (PHP_INT_MAX) is > 2147483647. =A0Now, normally PHP could cast to a float to get the larger > number in, but you explicitly cast it to an integer, so it had to > truncate the value. > > Try var_dump($s + 0); which correctly results in a float of the > correct value. =A0But the problem is that you asked for the int type, > which overflowed... > > Anthony > > PS: You can use http://codepad.viper-7.com/ to test 5.2, 5.3, 5.4 and > Trunk (I believe they do nightly builds of each)... > > > On Sat, Nov 19, 2011 at 8:46 AM, Paul Dragoonis wro= te: >> Hey guys, >> >> I don't have a dev environment on my mac here so I can't upgrade to >> TRUNK to test so I'm relying on someone on the internals list to test >> this. >> >> ---- PHP INFO ---- >> 5.3.1 >> >> ------ ISSUE ---- >> Simple integer work, converting it from being wrapped in a zval.type of = string, >> into int. Same value would be expected but it's giving an arbitrary valu= e. >> >> I can't test on latest php 5.3.x as I don't have a dev environment >> setup on this >> machine. So i'm relying on some mac user to test using trunk and verify. >> >> ----- OS ---- >> MAC OSX 10.7.2 >> Darwin Paul-Dragooniss-MacBook-Pro.local 11.2.0 Darwin Kernel Version >> 11.2.0: Tue >> Aug 9 20:54:00 PDT 2011; root:xnu-1699.24.8~1/RELEASE_X86_64 x86_64. >> >> >> ---- CODE --- >> $s =3D "2433078805"; >> var_dump($s); >> var_dump((int) $s); exit; >> >> ----- EXPECTED ----- >> string(10) "2433078805" int(2433078805) >> >> ----- ACTUAL ----- >> string(10) "2433078805" int(2147483647) >> >> >> Random or what? >> >> Regards, >> Paul Dragoonis. >> >> -- >> PHP Internals - PHP Runtime Development Mailing List >> To unsubscribe, visit: http://www.php.net/unsub.php >> >>