#26381 [Opn->Fbk]: rand() without srand() doesn't work with certain php.ini
| From: | sniper@php.net | Date: | Tue, 02 Dec 2003 17:51:13 +0000 |
| Subject: | #26381 [Opn->Fbk]: rand() without srand() doesn't work with certain php.ini | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-51576@lists.php.net to get a copy of this message | ||
ID: 26381
Updated by: sniper@php.net
Reported By: spam at vrana dot cz
-Status: Open
+Status: Feedback
Bug Type: Scripting Engine problem
Operating System: Windows XP
PHP Version: 4CVS-2003-12-2
New Comment:
What problem?
How can we reproduce this?
Previous Comments:
------------------------------------------------------------------------
[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] sniper@php.net
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.
------------------------------------------------------------------------
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