Hi,

Noticed this a couple months ago and never sent this simple thing. :-)
ERANGE is being triggered too soon because of the wrong variable, which
causes the following (in Unicode mode, of course) on 32-bit:

(int) '2147483640' // int(2147483647)
'2147483640' + 0) // float(2147483640)

Instead of the expected int(2147483640) in both cases.


Matt
Index: zend_strtol.c
===================================================================
RCS file: /repository/ZendEngine2/zend_strtol.c,v
retrieving revision 1.2
diff -u -r1.2 zend_strtol.c
--- zend_strtol.c       21 Feb 2006 20:12:41 -0000      1.2
+++ zend_strtol.c       21 Sep 2006 08:49:24 -0000
@@ -103,7 +103,7 @@
        for (acc = 0, any = 0;; c = *s++) {
                if ((val = u_digit(c, base)) < 0)
                        break;
-               if (any < 0 || acc > cutoff || (acc == cutoff && c > cutlim))
+               if (any < 0 || acc > cutoff || (acc == cutoff && val > cutlim))
                        any = -1;
                else {
                        any = 1;

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to