uniqid() expects at least 1 parameter

jcouture - June 21, 2009 - 00:21
Project:Flexifilter
Version:6.x-1.1-rc2
Component:User interface - Admin pages
Category:bug report
Priority:normal
Assigned:Unassigned
Status:active
Description

1) Installed FlexiFilter 6.x-1.1-rc2 on Drupal 6.12

2) whet to Preview screen and entered ==Hello Dolly== and got error:
warning: uniqid() expects at least 1 parameter, 0 given in
.../modules/flexifilter/flexifilter.admin.inc on line 916.

3) According to article at http://drupal.org/node/204335
the fix is to substitute (line 916 in flexifilter.admin.inc):

$uniqid = uniqid();

with

$this->unique_id = uniqid(rand(), true);

4) I did it and it worked.

#1

KiamLaLuno - July 1, 2009 - 04:04

uniqid() requires the first parameter, in PHP 4.
That is clearly documented in the PHP documentation, but it is also reported in the example the documentation uses.

<?php
// no prefix
// works only in PHP 5 and later versions
$token = md5(uniqid());

// better, difficult to guess
$better_token = md5(uniqid(mt_rand(), true));
?>

#2

jcouture - July 1, 2009 - 19:50

kiam,

Thank you. However, because Drupal is a big system and Flexifilter is a relatively stable module, I don't have a clue as to WHERE to put your code :-)

#3

KiamLaLuno - July 1, 2009 - 20:32

I don't have a clue as to WHERE to put your code

The code I reported is simply the example code reported in the PHP documentation. My comment was for the maintainer of the project, who probably forgot about the support for PHP4, or to mark his module for PHP5 only.

 
 

Drupal is a registered trademark of Dries Buytaert.