Date: 08/31/99
- Next message: Egon Schmid: "Re: [PHP-DEV] PHP 4.0 Bug #2201 Updated: uniqid strange values"
- Previous message: Bug Database: "[PHP-DEV] PHP 4.0 Bug #2065 Updated: mail() function doesn't do anything"
- In reply to: chrisvik <email protected>: "[PHP-DEV] PHP 4.0 Bug #2201: uniqid strange values"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On Tue, Aug 31, 1999 at 12:14:25PM -0000, chrisvik <email protected> wrote:
> From: chrisvik <email protected>
> Operating system: RedHat 6.0
> PHP version: 4.0 Latest CVS (31/08/1999)
> PHP Bug Type: Misbehaving function
> Bug description: uniqid strange values
>
> In PHP3 and PHP4B1 uniqid() returned values like
> 37c3afdea8412
>
> In PHP4B2 and the latest CVS uniqid returnes values like
> 37cbbbd3584b99.99999671
> (and ALWAYS the number 99999671 after the period)
>
> Is this intentional and expected of the future release of PHP4?
> (I have to know because i have to restructure some DB-fields or find some other ID-generator...)
This is intentional. Notice that uniqid() does not make any
promises with regard to the format of the returned string. If
your application depends on a specific format, you should use
a function which returns always the same format (i.e. md5()).
The value of the combined LCG which you find at the end of
the uniqid() return value, should never be the same within a
period of
(2^31 - 85) * (2^31 - 249)
For example, the script
for($i = 0; $i < 10; $i++) echo uniqid("")."\n";
produces the output
37cbf4c8aa5409.32011773
37cbf4c8ad2214.10714353
37cbf4c8ad2ec2.84566246
37cbf4c8ad3ac4.89409158
37cbf4c8ad4691.56120212
37cbf4c8ad5256.58456530
37cbf4c8ad5e12.00133011
37cbf4c8ad6a71.60144976
37cbf4c8ad7623.15287431
37cbf4c8ad81d1.25612660
I currently don't know of any circumstances where the lcg
could fail (beside 16-bit platforms).
--Regards,
Sascha Schumann Consultant
-- PHP Development Mailing List <http://www.php.net/> To unsubscribe, e-mail: php-dev-unsubscribe <email protected> For additional commands, e-mail: php-dev-help <email protected> To contact the list administrators, e-mail: php-list-admin <email protected>
- Next message: Egon Schmid: "Re: [PHP-DEV] PHP 4.0 Bug #2201 Updated: uniqid strange values"
- Previous message: Bug Database: "[PHP-DEV] PHP 4.0 Bug #2065 Updated: mail() function doesn't do anything"
- In reply to: chrisvik <email protected>: "[PHP-DEV] PHP 4.0 Bug #2201: uniqid strange values"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]

