From: alucard at vitriolic dot org Operating system: Solaris 9 PHP version: 4.3.4 PHP Bug Type: *Math Functions Bug description: rand(min,max) always returns min when zts enabled
Description: ------------ Bug #24909 is still an issue with latest build and Solaris 9. When rand() is called with no arguments, it operates as expected. When rand(min,max) is called, it always returns value 'min'. This problem only occurs when ZTS is enabled. When it's not, both calls to rand() work as expected, though the value ranges are completely different. To demonstrate: # uname -a SunOS XXXXXX 5.9 Generic_112233-08 sun4u sparc SUNW,Ultra-Enterprise # rm config.cache # ./configure --disable-all --disable-cgi --enable-experimental-zts # make clean && make # sapi/cli/php -r 'echo rand(),"\n"; echo rand(0,100),"\n";' 28909 0 # sapi/cli/php -r 'echo rand(),"\n"; echo rand(0,100),"\n";' 21885 0 # rm config.cache # ./configure --disable-all --disable-cgi # make clean && make # sapi/cli/php -r 'echo rand(),"\n"; echo rand(0,100),"\n";' 1116498057 87 # sapi/cli/php -r 'echo rand(),"\n"; echo rand(0,100),"\n";' 102735333 95 Note that with zts enabled, the rand() values are much smaller, and rand(min,max) always returns min. Without it, rand values are much larger, and rand(min,max) operates as expected. -- Edit bug report at http://bugs.php.net/?id=26949&edit=1 -- Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=26949&r=trysnapshot4 Try a CVS snapshot (php5): http://bugs.php.net/fix.php?id=26949&r=trysnapshot5 Fixed in CVS: http://bugs.php.net/fix.php?id=26949&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=26949&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=26949&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=26949&r=needscript Try newer version: http://bugs.php.net/fix.php?id=26949&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=26949&r=support Expected behavior: http://bugs.php.net/fix.php?id=26949&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=26949&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=26949&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=26949&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=26949&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=26949&r=dst IIS Stability: http://bugs.php.net/fix.php?id=26949&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=26949&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=26949&r=float