php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #14630 integers wrapping around rather than being promoted into floats on overflow
Submitted: 2001-12-20 13:45 UTC Modified: 2002-08-08 01:00 UTC
Votes:1
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:0 (0.0%)
Same OS:0 (0.0%)
From: markmont at umich dot edu Assigned:
Status: No Feedback Package: Math related
PHP Version: 4.1.0 OS: Solaris 8, 64-bit
Private report: No CVE-ID: None
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: markmont at umich dot edu
New email:
PHP Version: OS:

 

 [2001-12-20 13:45 UTC] markmont at umich dot edu
This problem causes all tests in ext/standard/tests/math to fail:

<?php
  define('LONG_MAX', is_int(5000000000)? 9223372036854775807
    : 0x7FFFFFFF);
  define('LONG_MIN', -LONG_MAX - 1);
  printf("%d,%d,%d,%d\n",is_int(LONG_MIN  ),is_int(LONG_MAX  ),
                                     is_int(LONG_MIN-1),is_int(LONG_MAX+1));
 
  printf( "LONG_MIN = %ld, LONG_MIN - 1 = %ld\n",
    LONG_MIN, LONG_MIN - 1 );
  printf( "LONG_MAX = %ld, LONG_MAX + 1 = %ld\n",
    LONG_MAX, LONG_MAX + 1 );

?>

This script gives the following results on my system:

1,1,1,1
LONG_MIN = -9223372036854775808, LONG_MIN - 1 = 9223372036854775807
LONG_MAX = 9223372036854775807, LONG_MAX + 1 = -9223372036854775808

Here's my setup:

PHP 4.1.0 compiled as a 64-bit stand-alone interpreter (CGI).

Hardware:  Sun Blade 1000 (750MHz UltraSparc III processor)
OS:        Solaris 8 07/01, running a 64-bit kernel
Compiler:  Sun Forte 6 update 2


env CC="cc -fast -xtarget=generic64" CFLAGS="-v -I/opt/include" \
    CXX="CC -fast -xtarget=generic64 -v" \
    LDFLAGS="-R/opt/lib/sparcv9 -R/opt/lib -L/opt/lib/sparcv9 -L/opt/lib" \
    ac_cv_path_install='/usr/sbin/install' \
  ./configure --prefix=/opt/packages/php-4.1.0 \
    --enable-force-cgi-redirect --enable-discard-path --enable-trans-sid \
    --with-config-file-path=/opt/www/etc \
    --with-exec-dir=/opt/packages/php-4.1.0/bin --with-mm=/opt --with-zlib \
    --with-zlib-dir=/opt --with-expat-dir=/opt --with-mysql --with-gdbm=/opt \
    --with-gd=yes --enable-gd-native-ttf   --with-xpm-dir=/opt \ --with-jpeg-dir=/opt --with-png-dir=/opt --with-freetype-dir=/opt \
    --enable-freetype-4bit-antialias-hack
 
I hope this helps.  Any thoughts as to what the problem could be?
If I can be of help in fixing it, just let me know.

Thanks!

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-07-07 13:31 UTC] derick@php.net
This works fine for me on Linux with the latest development CVS version of PHP (On Linux) provided that you use printf ("LONG_MIN -1 = %f", LONG_MIN - 1); instead, because the value of LONG_MIN - 1 does not fit in a field with %ld.
Can you try this with the latest CVS version, and report back?

Derick
 [2002-08-08 01:00 UTC] php-bugs at lists dot php dot net
No feedback was provided for this bug for over a month, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Dec 21 13:01:31 2024 UTC