From:             jeroen at kesh dot nl
Operating system: Windows 2000 Server
PHP version:      4.3.3
PHP Bug Type:     Arrays related
Bug description:  Shuffle() method doesn't work properly

Description:
------------
I pick the first two products out of the shuffled array for random
productviews on a page. I use 3 or more products.
With PHP 4.3.2 it works nice (every refresh another two products). With
PHP 4.3.3 it doesn't seem to work. Every time the same products.

Same PHP.INI file as 4.3.2 (which worked fine).

Reproduce code:
---------------
$ads = array(); 
while($product = mysql_fetch_array($arts)) {    
  $ads[] = $product; 
} 
                
shuffle($ads);

$prod = $ads[0];
echo ($prod[name]);

$prod = $ads[1];
echo ($prod[name]);

Expected result:
----------------
The first two array-records are other products every time at refresh.

Actual result:
--------------
The first two array-records are the same products each refresh.

-- 
Edit bug report at http://bugs.php.net/?id=25247&edit=1
-- 
Try a CVS snapshot (php4):  http://bugs.php.net/fix.php?id=25247&r=trysnapshot4
Try a CVS snapshot (php5):  http://bugs.php.net/fix.php?id=25247&r=trysnapshot5
Fixed in CVS:               http://bugs.php.net/fix.php?id=25247&r=fixedcvs
Fixed in release:           http://bugs.php.net/fix.php?id=25247&r=alreadyfixed
Need backtrace:             http://bugs.php.net/fix.php?id=25247&r=needtrace
Try newer version:          http://bugs.php.net/fix.php?id=25247&r=oldversion
Not developer issue:        http://bugs.php.net/fix.php?id=25247&r=support
Expected behavior:          http://bugs.php.net/fix.php?id=25247&r=notwrong
Not enough info:            http://bugs.php.net/fix.php?id=25247&r=notenoughinfo
Submitted twice:            http://bugs.php.net/fix.php?id=25247&r=submittedtwice
register_globals:           http://bugs.php.net/fix.php?id=25247&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=25247&r=php3
Daylight Savings:           http://bugs.php.net/fix.php?id=25247&r=dst
IIS Stability:              http://bugs.php.net/fix.php?id=25247&r=isapi
Install GNU Sed:            http://bugs.php.net/fix.php?id=25247&r=gnused

Reply via email to