Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:43091 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 17264 invoked from network); 18 Feb 2009 13:26:43 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 18 Feb 2009 13:26:43 -0000 Authentication-Results: pb1.pair.com smtp.mail=php_lists@realplain.com; spf=permerror; sender-id=unknown Authentication-Results: pb1.pair.com header.from=php_lists@realplain.com; sender-id=unknown Received-SPF: error (pb1.pair.com: domain realplain.com from 209.151.69.1 cause and error) X-PHP-List-Original-Sender: php_lists@realplain.com X-Host-Fingerprint: 209.151.69.1 liberty.vosn.net Linux 2.4/2.6 Received: from [209.151.69.1] ([209.151.69.1:34707] helo=liberty.vosn.net) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id EF/80-13863-29C0C994 for ; Wed, 18 Feb 2009 08:26:43 -0500 Received: from 75-121-92-101.dyn.centurytel.net ([75.121.92.101]:64954 helo=PC) by liberty.vosn.net with smtp (Exim 4.69) (envelope-from ) id 1LZmRi-0004vp-Uw; Wed, 18 Feb 2009 06:26:39 -0700 Message-ID: <00d401c991cc$879c1980$0201a8c0@PC> To: "internals Mailing List" , "zoe" Cc: "Moriyoshi Koizumi" , "Ilia Alshanetsky" , "Dmitry Stogov" References: <6D771262-F1BD-43B7-93FC-BF9D47D15F49@prohost.org> <499BF0CF.3000108@googlemail.com> Date: Wed, 18 Feb 2009 07:25:39 -0600 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2800.1933 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1933 X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - liberty.vosn.net X-AntiAbuse: Original Domain - lists.php.net X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - realplain.com Subject: Re: [PHP-DEV] Re: Bug #46701 From: php_lists@realplain.com ("Matt Wilmas") Hi Zoe, all, ----- Original Message ----- From: "zoe" Sent: Wednesday, February 18, 2009 > Moriyoshi Koizumi wrote: > > Please don't even think of backporting. This will definitely break a > > lot of things, and this kind of thing must not be done in a minor > > release. > > > > > --snip-- > > >>>> I guess the patch relies on the 5.3's DVAL_TO_LVAL behavior that was > >>>> changed by the fix for bug #42868, right? > >>>> If so, this patch shouldn't be MFH'ed as the #42868 patch was not > >>>> merged although I didn't remember any discussion on this. > >>>> > >>>> See also: http://marc.info/?l=php-internals&m=120799720922202&w=2 > >>>> > >>>> > Hey all > > I'm sorry - I should have replied to this before since I was responsible > for raising #42868. I didn't do a good job at explaining what the issue > was in that bug, mainly because I didn't know what it was when I > started. The central problem is that PHP's behaviour on casting double > to int defaults to whatever the underlying C environment does. On > Windows and Linux (all of the versions that I looked at) this turns out > to be a simple truncation of the last 32 bits. Unfortunately the C > behaviour is 'undefined' (Kernigan and Ritchie, page 197, A6.3). The > issue that I found in #42868 was that on the Mac the casting behaviour > is completely different so many of the PHP tests failed. I believe that > PHP should behave in a platform independent way - that is what the fix > to #42868 achieves. It is also fair to say that any applications that > depend on the overflow behaviour in PHP 5.2 cannot be guaranteed to run > on any platform. (I'm glad this change was reverted for 5.2...) Anyway, like I said in my "5.3 todos" reply, I'll send a possible DVAL_TO_LVAL, etc. solution (consistent/reliable overflow across platforms) for consideration as soon as I can... There are other inconsistencies and behavior changes with the existing code, and it definitely doesn't behave in a platform-independent way! With the 4 versions of DVAL_...: old, 32 bit, 64 bit, 64 bit Windows (not sure why it's there; its longs are still 32 bit?), things I can think of: - 64-bit Windows has no range limiting for casting, so it's free to overflow like the old way...? Other 64 bit limits the range to LONG_MAX/MIN. 32 bit still casts between LONG_MAX and MAX_UNSIGNED_INT (ULONG_MAX-ish?), and, presumably, it's supposed to overflow between those 2, but casting of the out-of-range unsigned long is also "implementation-defined," so still cannot be guaranteed. - Conversion of INF/-INF: the old version and 64 bit Windows now will convert them to 0. 32 bit and other 64 bit will convert them to LONG_MAX/LONG_MIN. - With zend_parse_parameters(), a numeric string that results in a double is still converted using a simple (long) cast only. (In my proposed changes, I was going to add a new conversion specifier (simple few lines), like capital 'L', for functions that want/need to limit the long without overflow, like lengths for some string functions that I *thought* was trying to be fixed orginally.) > Zoe - Matt