Doc #51538 [Opn->Csd]: strptime() buggy prior PHP 5.2.0
| From: | kalle@php.net | Date: | Wed, 20 Oct 2010 00:33:37 +0000 |
| Subject: | Doc #51538 [Opn->Csd]: strptime() buggy prior PHP 5.2.0 | ||
| References: | 1 | Groups: | php.doc.bugs |
| Request: | Send a blank email to doc-bugs+get-5256@lists.php.net to get a copy of this message | ||
Edit report at http://bugs.php.net/bug.php?id=51538&edit=1
ID: 51538
Updated by: kalle@php.net
Reported by: alex dot schuch at gmx dot de
Summary: strptime() buggy prior PHP 5.2.0
-Status: Open
+Status: Closed
Type: Documentation Problem
Package: Documentation problem
Operating System: irrelevant?
PHP Version: Irrelevant
-Assigned To:
+Assigned To: kalle
Block user comment: N
New Comment:
This bug has been fixed in the documentation's XML sources. Since the
online and downloadable versions of the documentation need some time
to get updated, we would like to ask you to be a bit patient.
Thank you for the report, and for helping us make our documentation
better.
Previous Comments:
------------------------------------------------------------------------
[2010-10-20 02:33:16] kalle@php.net
Automatic comment from SVN on behalf of kalle
Revision: http://svn.php.net/viewvc/?view=revision&revision=304520
Log: Fixed bug #51538 (strptime() buggy prior PHP 5.2.0)
------------------------------------------------------------------------
[2010-08-12 14:54:00] alex dot schuch at gmx dot de
I just had a look at the PHP source:
svn diff -c218534 ext/standard/datetime.c
The fix to this problem was the initialisation of the struct with zero
(using memset()).
From the manual "man 3 strptime":
In principle, this function does not initialize tm but only stores the
values specified. This means that tm should be initialized before the
call. Details differ a bit between different Unix systems. The glibc
implementation does not touch those fields which are not explicitly
specified, except that it recomputes the tm_wday and tm_yday field if
any of the year, month, or day elements changed.
So in easy words:
The elements of the struct are not initialised. strptime() only sets the
values according to the pattern so that non-given values were not
overwritten - they stayed at their uninitialised value.
------------------------------------------------------------------------
[2010-08-10 19:13:37] philip@php.net
Surely it's not "random", so is there some logic behind these incorrect
[and
seemingly random] values prior to 5.2.0? Or maybe we could use the word
'undefined' instead. Thoughts?
The changelog entry is "strptime() does not initialize the internal date
storage
structure" although I'm unsure exactly what that means.
------------------------------------------------------------------------
[2010-04-12 11:10:58] alex dot schuch at gmx dot de
Description:
------------
A note should be added to strptime() documentation, as the function is
not
working according to the documentation before PHP 5.2.0.
http://bugs.php.net/38524
http://php.net/ChangeLog-5.php
Maybe something like:
Prior PHP 5.2.0, strptime() returns random values for parts not included
in the
format string (see bug #38524).
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/bug.php?id=51538&edit=1