#19166 [Dup->Bgs]: strtotime example in docs incorrect
| From: | sniper@php.net | Date: | Tue, 28 Oct 2003 21:27:29 +0000 |
| Subject: | #19166 [Dup->Bgs]: strtotime example in docs incorrect | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-49588@lists.php.net to get a copy of this message | ||
ID: 19166
Updated by: sniper@php.net
Reported By: jc at mega-bucks dot co dot jp
-Status: Duplicate
+Status: Bogus
Bug Type: Date/time related
Operating System: Red Hat Linux 7.2
PHP Version: 4.2.2
Assigned To: derick
New Comment:
One report per bug is enough..
Previous Comments:
------------------------------------------------------------------------
[2002-08-29 08:50:31] jc at mega-bucks dot co dot jp
Your an angel. A quick call to checkdate() to verify the input might be
all that's needed?
------------------------------------------------------------------------
[2002-08-29 08:36:45] derick@php.net
Ok, I changed my mind and think this would be solved by fixing the
function instead.
Because there is a Bug #18101 in which sniper promised that I would
rewrite it, I'm marking this one as duplicate of that bug 18101.
------------------------------------------------------------------------
[2002-08-29 03:46:14] jc at mega-bucks dot co dot jp
The docs for strtotime contain a code snippet that is supposed to catch
invalid dates. It fails in this example where $str is set to
"1970-1-222" and invalid date.
$str = "1970-1-222";
if (($timestamp = strtotime($str)) === -1) {
echo "The string ($str) is bogus";
}
else {
echo "$str == ". date('l dS of F Y h:i:s A',$timestamp);
}
The output is:
1970-1-222 == Monday 10th of August 1970 12:00:00 AM
Whereas is should say that 1970-1-222 is a bogus date.
Jc
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=19166&edit=1