#26381 [Fbk->Opn]: rand() without srand() doesn't work with certain php.ini
ID: 26381 User updated by: spam at vrana dot cz Reported By: spam at vrana dot cz -Status: Feedback +Status: Open Bug Type: Scripting Engine problem Operating System: Windows XP PHP Version: 4CVS-2003-12-2 New Comment: It behaves like that with php.ini-dist. It doesn't with php.ini-recommended. If I remove part Dynamic Extensions in php.ini-dist, it disappears. I mean part from ;; ; Dynamic Extensions ; ;; to ;;; ; Module Settings ; ;;; You know that everything is commented in this part in php.ini-dist. Previous Comments: [2003-12-02 17:11:37] [EMAIL PROTECTED] We need the php.ini file causing the problems. [2003-12-02 10:57:15] spam at vrana dot cz I can't believe myself, the problem is caused by something completely different. I discovered that the problem occurs only under this circumstances: 1. Lines in php.ini file ends by CRLF. 2. Windows Extensions part in php.ini is longer than 503 characters (including new-lines). I don't know what is it but it looks like buffer overflow or something like that. So the problem is probably in php-src/main/php_ini.c or somewhere near. [2003-11-24 08:21:33] spam at vrana dot cz Description: Function rand() without setting random seed by srand() returns always the same value. It doesn't work only on Windows PHP-CLI. As Windows Apache module and also on Linux PHP-CLI it works as it should. Reproduce code: --- echo rand(); Expected result: (random value) Actual result: -- 24849 -- Edit this bug report at http://bugs.php.net/?id=26381&edit=1
#26381 [Fbk->Opn]: rand() without srand() doesn't work with certain php.ini
ID: 26381 User updated by: spam at vrana dot cz Reported By: spam at vrana dot cz -Status: Feedback +Status: Open Bug Type: Scripting Engine problem Operating System: Windows XP PHP Version: 4CVS-2003-12-2 New Comment: I really don't know which additional information you need. Can you tell me? I described the wrong behaviour on 24 Nov 8:21am EST. I found that the wrong behaviour is most probably bounded with processing of php.ini and described it on 2 Dec 10:57am EST. I tested everything on CVS snapshot on 25 Nov 4:53am EST and on 2 Dec 11:18am EST with the same result. I want to give you all information which you need to fix this bug but I don't know about anything what wasn't already written here. Previous Comments: [2003-12-02 14:28:31] [EMAIL PROTECTED] Not enough information was provided for us to be able to handle this bug. Please re-read the instructions at http://bugs.php.net/how-to-report.php If you can provide more information, feel free to add it to this bug and change the status back to "Open". Thank you for your interest in PHP. [2003-12-02 13:10:29] spam at vrana dot cz Everything is written on http://bugs.php.net/?id=26381. It seems that by some problem in processing php.ini is caused that "rand() without srand() doesn't work". It's most probably only side-effect of something wrong (like buffer-overflow). [2003-12-02 12:51:13] [EMAIL PROTECTED] What problem? How can we reproduce this? [2003-12-02 11:18:28] spam at vrana dot cz Yes. The problem occurs also with CVS snapshot. [2003-12-02 11:04:40] [EMAIL PROTECTED] Please try using this CVS snapshot: http://snaps.php.net/php4-STABLE-latest.tar.gz For Windows: http://snaps.php.net/win32/php4-win32-STABLE-latest.zip 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/26381 -- Edit this bug report at http://bugs.php.net/?id=26381&edit=1
#26381 [Fbk->Opn]: rand() without srand() doesn't work with certain php.ini
ID: 26381 User updated by: spam at vrana dot cz Reported By: spam at vrana dot cz -Status: Feedback +Status: Open Bug Type: Scripting Engine problem Operating System: Windows XP PHP Version: 4CVS-2003-12-2 New Comment: Everything is written on http://bugs.php.net/?id=26381. It seems that by some problem in processing php.ini is caused that "rand() without srand() doesn't work". It's most probably only side-effect of something wrong (like buffer-overflow). Previous Comments: [2003-12-02 12:51:13] [EMAIL PROTECTED] What problem? How can we reproduce this? [2003-12-02 11:18:28] spam at vrana dot cz Yes. The problem occurs also with CVS snapshot. [2003-12-02 11:04:40] [EMAIL PROTECTED] Please try using this CVS snapshot: http://snaps.php.net/php4-STABLE-latest.tar.gz For Windows: http://snaps.php.net/win32/php4-win32-STABLE-latest.zip [2003-12-02 10:57:15] spam at vrana dot cz I can't believe myself, the problem is caused by something completely different. I discovered that the problem occurs only under this circumstances: 1. Lines in php.ini file ends by CRLF. 2. Windows Extensions part in php.ini is longer than 503 characters (including new-lines). I don't know what is it but it looks like buffer overflow or something like that. So the problem is probably in php-src/main/php_ini.c or somewhere near. [2003-12-02 10:22:37] nunoplopes at sapo dot pt This bug is solved! I have the latest windows snapshot on windows xp and cli returns a random value without the need to use srand. 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/26381 -- Edit this bug report at http://bugs.php.net/?id=26381&edit=1
#26381 [Fbk->Opn]: rand() without srand() doesn't work with certain php.ini
ID: 26381 User updated by: spam at vrana dot cz Reported By: spam at vrana dot cz -Status: Feedback +Status: Open Bug Type: Scripting Engine problem Operating System: Windows XP -PHP Version: 4.3.3 +PHP Version: 4.3.5-dev New Comment: Yes. The problem occurs also with CVS snapshot. Previous Comments: [2003-12-02 11:04:40] [EMAIL PROTECTED] Please try using this CVS snapshot: http://snaps.php.net/php4-STABLE-latest.tar.gz For Windows: http://snaps.php.net/win32/php4-win32-STABLE-latest.zip [2003-12-02 10:57:15] spam at vrana dot cz I can't believe myself, the problem is caused by something completely different. I discovered that the problem occurs only under this circumstances: 1. Lines in php.ini file ends by CRLF. 2. Windows Extensions part in php.ini is longer than 503 characters (including new-lines). I don't know what is it but it looks like buffer overflow or something like that. So the problem is probably in php-src/main/php_ini.c or somewhere near. [2003-12-02 10:22:37] nunoplopes at sapo dot pt This bug is solved! I have the latest windows snapshot on windows xp and cli returns a random value without the need to use srand. [2003-11-28 04:26:47] spam at vrana dot cz The behavior of rand() really changed in PHP 4.2.0, it is stated in Changelog. The documentation is correct. And there is coded this feature in source codes (php-src/ext/standard/rand.c, line 327 in current CVS). I don't know where the problem is, I don't understand PHP internals. I can only see that there is global variable rand_is_seeded set on line 58 and checked on line 326. Maybe the problem is that this variable wasn't initialized. I'm just guessing because as I wrote, I don't understand PHP internals. [2003-11-25 08:57:29] [EMAIL PROTECTED] Manual is wrong. 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/26381 -- Edit this bug report at http://bugs.php.net/?id=26381&edit=1
#26381 [Fbk->Opn]: rand() without srand() doesn't work
ID: 26381 User updated by: spam at vrana dot cz Reported By: spam at vrana dot cz -Status: Feedback +Status: Open Bug Type: Math related Operating System: Windows XP PHP Version: 4.3.3 New Comment: Unfortunately it behaves the same with Windows snapshots. For case it's not obvious from my fist comment - if I call srand() before rand() it works well. Previous Comments: [2003-11-25 04:24:32] [EMAIL PROTECTED] Please try using this CVS snapshot: http://snaps.php.net/php4-STABLE-latest.tar.gz For Windows: http://snaps.php.net/win32/php4-win32-STABLE-latest.zip Works fine for me within Windows XP, within Apache and CLI. [2003-11-24 08:21:33] spam at vrana dot cz Description: Function rand() without setting random seed by srand() returns always the same value. It doesn't work only on Windows PHP-CLI. As Windows Apache module and also on Linux PHP-CLI it works as it should. Reproduce code: --- echo rand(); Expected result: (random value) Actual result: -- 24849 -- Edit this bug report at http://bugs.php.net/?id=26381&edit=1