<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Recent changes to 2836: PHP Warning mt_srand() expects parameter 1 to be integer</title><link>https://sourceforge.net/p/squirrelmail/bugs/2836/</link><description>Recent changes to 2836: PHP Warning mt_srand() expects parameter 1 to be integer</description><atom:link href="https://sourceforge.net/p/squirrelmail/bugs/2836/feed.rss" rel="self"/><language>en</language><lastBuildDate>Thu, 08 Dec 2016 13:24:30 -0000</lastBuildDate><atom:link href="https://sourceforge.net/p/squirrelmail/bugs/2836/feed.rss" rel="self" type="application/rss+xml"/><item><title>PHP Warning mt_srand() expects parameter 1 to be integer</title><link>https://sourceforge.net/p/squirrelmail/bugs/2836/</link><description>&lt;div class="markdown_content"&gt;&lt;p&gt;A PHP warning is produced on every page:&lt;br/&gt;
Warning: mt_srand() expects parameter 1 to be integer, float given in ../htdocs/include/init.php on line 136.&lt;/p&gt;
&lt;p&gt;This prevents redirect after login when errors are displayed.&lt;/p&gt;
&lt;p&gt;Code:&lt;/p&gt;
&lt;p&gt;$seed = hexdec(substr(md5($seed), 0, 9));&lt;/p&gt;
&lt;p&gt;// PHP 4.2 and up don't require seeding, but their used seed algorithm&lt;br/&gt;
// is of questionable quality, so we keep doing it ourselves. */&lt;br/&gt;
mt_srand($seed);&lt;/p&gt;
&lt;p&gt;For certain values of $seed, hexdec can return a float instead of an integer on some systems. Mine is 32bit.&lt;/p&gt;
&lt;p&gt;Suggested solution:&lt;br/&gt;
a) remove $seed from mt_rand()&lt;br/&gt;
b) make sure $seed is a value &amp;lt;= PHP_INT_MAX&lt;/p&gt;
&lt;p&gt;$ php -v&lt;br/&gt;
PHP 7.0.12&lt;/p&gt;
&lt;p&gt;$ uname -a&lt;br/&gt;
Linux 4.8.6-1-ARCH #1 SMP PREEMPT Mon Oct 31 19:10:31 CET 2016 i686 GNU/Linux&lt;/p&gt;&lt;/div&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Roland Eckert</dc:creator><pubDate>Thu, 08 Dec 2016 13:24:30 -0000</pubDate><guid>https://sourceforge.netf8d4f6e2cd252d303215089038aadd875d7475b5</guid></item></channel></rss>