From:             phpbugs at mechintosh dot com
Operating system: MacOS X 10.3.6
PHP version:      4.3.9
PHP Bug Type:     Documentation problem
Bug description:  uniqid() warning when no argument

Description:
------------
http://nl.php.net/manual/en/function.uniqid.php

Excerpt, added arrows:
----------------------
string uniqid ( [string prefix [, bool more_entropy]])

uniqid() returns a prefixed unique identifier based on the current time in
microseconds. prefix is --> optional <-- but can be useful, for instance,
if you generate identifiers simultaneously on several hosts that might
happen to generate the identifier at the same microsecond. Up until PHP
4.3.1, prefix could only be a maximum of 114 characters long.

If the --> optional <-- more_entropy parameter is TRUE....
----------------------

So while both parameters should be optional, I do get a warning.

Reproduce code:
---------------
<?php
ini_set('display_errors', '1');
ini_set('track_errors', '1');
error_reporting(E_ALL);

echo uniqid();
?>

Expected result:
----------------
41a6819d003c2

or somesuch.. the same result that I would have gotten with
echo uniqid('');

Actual result:
--------------
Warning: uniqid() expects at least 1 parameter, 0 given in
/Library/WebServer/Documents/foo.php on line 7

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

Reply via email to