sid is primary key so mostly md5(microtime()) is the same and second insert failed with
'UserBlocksUnitTests', 'exception',
'SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry ''3886465a51d1dfce61c06aa04f332ecd'' for key 1',
'Uncaught exception', 'PDOStatement->execute()', 1691,
'/home/drupaltesting/web/public/sites/drupaltesting.deekayen.net/files/checkout/includes/database/database.inc'
This happens in modules\user\user.test
$this->insertSession();
$this->insertSession();
...
private function insertSession(array $fields = array()) {
$fields += array(
'uid' => 0,
'sid' => md5(microtime()),
'timestamp' => REQUEST_TIME,
);
Comments
Comment #1
andypostI cant understand a logic of test.
Comment #2
andypostMore descriptive title
modules\user\user.test
testWhosOnlineBlock()Comment #3
damien tournoud commentedOn which OS / hardware are you running this test?
I agree that inserting rows into the database is really not a good method for testing the who's online block... it will fail for non DB session.inc, and session.inc is supposed to remain pluggable.
Comment #4
andypostStable error when using php-apc - on debian 5 (apache2 php 5.2.6)
Comment #5
deekayen commentedI got the error on Ubuntu 8.04 Hardy with eaccelerator 0.9.5.3 and PHP 5.2.4 Suhosin.
Comment #6
andypostSuppose using md5(microtime()) is not a good random generator mainly.
Comment #7
boombatower commentedTest still passes locally and would seem to solve problem.
Comment #8
dave reidI think this was my test. :) Let's change it to md5(mt_rand()) and see if that fixes it.
Comment #9
boombatower commentedFix cross-post.
Comment #10
andypostLooks good for me. Need some reviews except mine...
Comment #11
deekayen commentedHow about using the PHP function actually intended for unique IDs:
md5(uniqid(mt_rand(), true))Comment #12
boombatower commentedLooks great. Lets not hold up PIFR any longer, eh?
Comment #13
dries commentedCommitted to CVS HEAD. Thanks!