rand(min,max) always returns min when zts enabled
| Bug #26949 | rand(min,max) always returns min when zts enabled | |||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Submitted: | 2004-01-17 17:34 UTC | Modified: | 2004-01-18 21:25 UTC |
|
||||||||||
| From: | alucard at vitriolic dot org | Assigned: | ||||||||||||
| Status: | Closed | Package: | Math related | |||||||||||
| PHP Version: | 4CVS-2004-01-18 | OS: | Solaris 9 | |||||||||||
| Private report: | No | CVE-ID: | None | |||||||||||
[2004-01-17 17:34 UTC] alucard at vitriolic dot org
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.
Patches
Pull Requests
History
AllCommentsChangesGit/SVN commits
[2004-01-18 02:04 UTC] alucard at vitriolic dot org
[2004-01-18 09:35 UTC] sniper@php.net
[2004-01-18 09:36 UTC] sniper@php.net
[2004-01-18 16:16 UTC] alucard at vitriolic dot org
[2004-01-18 21:25 UTC] sniper@php.net