#24909 [Fbk->Opn]: rand function with range always returns low value of range
ID: 24909 User updated by: a0 at hush dot com Reported By: a0 at hush dot com -Status: Feedback +Status: Open Bug Type: Math related Operating System: solaris 8 PHP Version: 4.3.3RC3-dev New Comment: i configured and built as you specified Build complete. (It is safe to ignore warnings about tempnam and tmpnam). bash-2.05# sapi/cli/php -r 'echo rand(),"\n"; echo rand(0,100),"\n";' 16162 0 bash-2.05# sapi/cli/php -r 'echo rand(),"\n"; echo rand(0,100),"\n";' 31971 0 bash-2.05# Previous Comments: [2003-08-04 08:39:37] [EMAIL PROTECTED] Please try this: # 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";' ------------ [2003-08-02 15:17:29] a0 at hush dot com i used the cli binary in both cases [2003-08-02 15:00:52] [EMAIL PROTECTED] I've tried the ZTS version on both Linux & Windows and it worked perfectly in both cases. Did you run test via the nsapi module or using PHP cli or cgi binaries? -------- [2003-08-02 13:55:00] a0 at hush dot com thanks for the response. i have downloaded 4.3.3RC2 and tried it. first, i configured it using no args. after i compiled it, the rand() function behaves as expected, even with a range specified. this works. i then configured it with --with-nsapi=/usr/local/iws41, which is what we need to use the module with our webserver. after i compiled it, the cli program now returns a 0 whenever a range is specified to rand(). i have not really looked through the code, but i would guess this has something to do with the fact that php is built with -DZTS in the second scenario (a different random function is used in rand.c when this is defined). [2003-08-02 12:46:58] [EMAIL PROTECTED] I've asked a number of people to replicate the problem, however they were unable to do so using latest PHP and Solaris 8 & 9. Please try the latest snapshot of 4.3.3 and see if the problem persists. The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at http://bugs.php.net/24909 -- Edit this bug report at http://bugs.php.net/?id=24909&edit=1
#24909 [Fbk->Opn]: rand function with range always returns low value of range
ID: 24909 User updated by: a0 at hush dot com Reported By: a0 at hush dot com -Status: Feedback +Status: Open Bug Type: Math related Operating System: solaris 8 PHP Version: 4.3.2 New Comment: i used the cli binary in both cases Previous Comments: [2003-08-02 15:00:52] [EMAIL PROTECTED] I've tried the ZTS version on both Linux & Windows and it worked perfectly in both cases. Did you run test via the nsapi module or using PHP cli or cgi binaries? [2003-08-02 13:55:00] a0 at hush dot com thanks for the response. i have downloaded 4.3.3RC2 and tried it. first, i configured it using no args. after i compiled it, the rand() function behaves as expected, even with a range specified. this works. i then configured it with --with-nsapi=/usr/local/iws41, which is what we need to use the module with our webserver. after i compiled it, the cli program now returns a 0 whenever a range is specified to rand(). i have not really looked through the code, but i would guess this has something to do with the fact that php is built with -DZTS in the second scenario (a different random function is used in rand.c when this is defined). [2003-08-02 12:46:58] [EMAIL PROTECTED] I've asked a number of people to replicate the problem, however they were unable to do so using latest PHP and Solaris 8 & 9. Please try the latest snapshot of 4.3.3 and see if the problem persists. [2003-08-01 14:37:22] a0 at hush dot com Description: when using the rand function with php 4.3.2 on solaris 8, it will return a random value as expected if no range is specified. if a range is specified it will always return the low value of the range. i'm building the module with -DZTS, and it is being loaded into IWS4.1. i've modified the code so it works by changing line 36 of php_rand.h from #if HAVE_LRAND48 to #if (HAVE_LRAND48 && !sun) so PHP_RAND_MAX will get a value of RAND_MAX. Reproduce code: --- Expected result: 24384 0 (it will always return 0) -- Edit this bug report at http://bugs.php.net/?id=24909&edit=1
#24909 [Fbk->Opn]: rand function with range always returns low value of range
ID: 24909 User updated by: a0 at hush dot com Reported By: a0 at hush dot com -Status: Feedback +Status: Open Bug Type: Math related Operating System: solaris 8 PHP Version: 4.3.2 New Comment: thanks for the response. i have downloaded 4.3.3RC2 and tried it. first, i configured it using no args. after i compiled it, the rand() function behaves as expected, even with a range specified. this works. i then configured it with --with-nsapi=/usr/local/iws41, which is what we need to use the module with our webserver. after i compiled it, the cli program now returns a 0 whenever a range is specified to rand(). i have not really looked through the code, but i would guess this has something to do with the fact that php is built with -DZTS in the second scenario (a different random function is used in rand.c when this is defined). Previous Comments: [2003-08-02 12:46:58] [EMAIL PROTECTED] I've asked a number of people to replicate the problem, however they were unable to do so using latest PHP and Solaris 8 & 9. Please try the latest snapshot of 4.3.3 and see if the problem persists. [2003-08-01 14:37:22] a0 at hush dot com Description: when using the rand function with php 4.3.2 on solaris 8, it will return a random value as expected if no range is specified. if a range is specified it will always return the low value of the range. i'm building the module with -DZTS, and it is being loaded into IWS4.1. i've modified the code so it works by changing line 36 of php_rand.h from #if HAVE_LRAND48 to #if (HAVE_LRAND48 && !sun) so PHP_RAND_MAX will get a value of RAND_MAX. Reproduce code: --- Expected result: 24384 0 (it will always return 0) -- Edit this bug report at http://bugs.php.net/?id=24909&edit=1
#24909 [NEW]: rand function with range always returns low value of range
From: a0 at hush dot com Operating system: solaris 8 PHP version: 4.3.2 PHP Bug Type: Math related Bug description: rand function with range always returns low value of range Description: when using the rand function with php 4.3.2 on solaris 8, it will return a random value as expected if no range is specified. if a range is specified it will always return the low value of the range. i'm building the module with -DZTS, and it is being loaded into IWS4.1. i've modified the code so it works by changing line 36 of php_rand.h from #if HAVE_LRAND48 to #if (HAVE_LRAND48 && !sun) so PHP_RAND_MAX will get a value of RAND_MAX. Reproduce code: --- Expected result: 24384 0 (it will always return 0) -- Edit bug report at http://bugs.php.net/?id=24909&edit=1 -- Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=24909&r=trysnapshot4 Try a CVS snapshot (php5): http://bugs.php.net/fix.php?id=24909&r=trysnapshot5 Fixed in CVS: http://bugs.php.net/fix.php?id=24909&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=24909&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=24909&r=needtrace Try newer version: http://bugs.php.net/fix.php?id=24909&r=oldversion Not developer issue:http://bugs.php.net/fix.php?id=24909&r=support Expected behavior: http://bugs.php.net/fix.php?id=24909&r=notwrong Not enough info:http://bugs.php.net/fix.php?id=24909&r=notenoughinfo Submitted twice:http://bugs.php.net/fix.php?id=24909&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=24909&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=24909&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=24909&r=dst IIS Stability: http://bugs.php.net/fix.php?id=24909&r=isapi Install GNU Sed:http://bugs.php.net/fix.php?id=24909&r=gnused