php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #30900 uniqid() warning when no argument
Submitted: 2004-11-26 02:09 UTC Modified: 2005-02-01 15:58 UTC
From: phpbugs at mechintosh dot com Assigned:
Status: Closed Package: Documentation problem
PHP Version: 4.3.10 OS: MacOS X 10.3.7
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: phpbugs at mechintosh dot com
New email:
PHP Version: OS:

 

 [2004-11-26 02:09 UTC] phpbugs at mechintosh dot com
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

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-11-26 08:40 UTC] vrana@php.net
Thank you for your bug report. This issue has already been fixed
in the latest released version of PHP, which you can download at 
http://www.php.net/downloads.php

Already fixed by Nuno in XML sources.
 [2004-11-27 13:07 UTC] phpbugs at mechintosh dot com
Must admit to using the http://entropy.ch/ installer, instead of downloading source from http://www.php.net/downloads.php and compiling myself, but it *is* 4.3.9, the only newer release is a RC?
Not that it's critical or anything..
 [2005-02-01 15:07 UTC] phpbugs at mechintosh dot com
It still happens in the now most recent version, 4.3.10? Or does "most recent" mean 5 and up?
 [2005-02-01 15:58 UTC] vrana@php.net
It's clearly stated in the manual: "The prefix parameter became optional in PHP 5."
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Wed Apr 24 23:01:34 2024 UTC