#19166 [NEW]: strtotime example in docs incorrect

From: Date: Thu, 29 Aug 2002 07:46:14 +0000
Subject: #19166 [NEW]: strtotime example in docs incorrect
Groups: php.bugs php.doc 
Request: Send a blank email to php-bugs+get-18127@lists.php.net to get a copy of this message
From: jc@mega-bucks.co.jp Operating system: Red Hat Linux 7.2 PHP version: 4.2.2 PHP Bug Type: Documentation problem Bug description: strtotime example in docs incorrect 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 bug report at http://bugs.php.net/?id=19166&edit=1 -- Try a CVS snapshot: http://bugs.php.net/fix.php?id=19166&r=trysnapshot Fixed in CVS: http://bugs.php.net/fix.php?id=19166&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=19166&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=19166&r=needtrace Try newer version: http://bugs.php.net/fix.php?id=19166&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=19166&r=support Expected behavior: http://bugs.php.net/fix.php?id=19166&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=19166&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=19166&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=19166&r=globals

« previous php.bugs (#18127) next »