Bug #69906 [NEW]: chr() behavior difference between 32- and 64-bit bulids

From: Date: Tue, 23 Jun 2015 07:22:20 +0000
Subject: Bug #69906 [NEW]: chr() behavior difference between 32- and 64-bit bulids
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-193779@lists.php.net to get a copy of this message
From: ab Operating system: any PHP version: 7.0.0alpha1 Package: *General Issues Bug Type: Bug Bug description:chr() behavior difference between 32- and 64-bit bulids Description: ------------ When passing an integer that overflows PHP_INT_MAX in 32-bit, the behavior of chr() differs. The documentation currently doesn't define what should happen in this situation, the only statement is that chr() expects an ASCII code. chr() should ensure the input is in the valid range, thus making the behavior consistent between 32- and 64-bit. Test script: --------------- Debug\php.exe -r "$a = chr(2632627629); var_dump($a, ord($a));" string(1) " " int(0) x64\Debug\php.exe -r "$a = chr(2632627629); var_dump($a, ord($a));" string(1) "¡" int(173) Expected result: ---------------- string(1) " " int(0) Actual result: -------------- Different behavior depending on 32- or 64-bit build. -- Edit bug report at https://bugs.php.net/bug.php?id=69906&edit=1 -- Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=69906&r=trysnapshot54 Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=69906&r=trysnapshot55 Try a snapshot (trunk): https://bugs.php.net/fix.php?id=69906&r=trysnapshottrunk Fixed in SVN: https://bugs.php.net/fix.php?id=69906&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=69906&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=69906&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=69906&r=needscript Try newer version: https://bugs.php.net/fix.php?id=69906&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=69906&r=support Expected behavior: https://bugs.php.net/fix.php?id=69906&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=69906&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=69906&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=69906&r=globals PHP 4 support discontinued: https://bugs.php.net/fix.php?id=69906&r=php4 Daylight Savings: https://bugs.php.net/fix.php?id=69906&r=dst IIS Stability: https://bugs.php.net/fix.php?id=69906&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=69906&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=69906&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=69906&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=69906&r=mysqlcfg

« previous php.bugs (#193779) next »