From: foobar Date: Mon, 19 Jan 2004 02:30:54 +0000 (+0000) Subject: - Fixed bug #26949 (rand(min,max) always returns min when ZTS enabled) X-Git-Tag: php_ibase_before_split~112 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=c7f8c84f360dd671f30a1df426ac2b7cb72db046;p=php - Fixed bug #26949 (rand(min,max) always returns min when ZTS enabled) --- diff --git a/ext/standard/php_rand.h b/ext/standard/php_rand.h index 7e705bb12d..1638a7ace7 100644 --- a/ext/standard/php_rand.h +++ b/ext/standard/php_rand.h @@ -33,7 +33,8 @@ #define RAND_MAX (1<<15) #endif -#if defined(HAVE_LRAND48) || defined(HAVE_RANDOM) +/* In ZTS mode we rely on rand_r() so we must use RAND_MAX. */ +#if !defined(ZTS) && (defined(HAVE_LRAND48) || defined(HAVE_RANDOM)) #define PHP_RAND_MAX 2147483647 #else #define PHP_RAND_MAX RAND_MAX