Doc #52642 [NEW]: You have mixed up two values in one of the tables
| From: | superspring+php at gmail dot com | Date: | Thu, 19 Aug 2010 02:36:20 +0000 |
| Subject: | Doc #52642 [NEW]: You have mixed up two values in one of the tables | ||
| Groups: | php.doc.bugs | ||
| Request: | Send a blank email to doc-bugs+get-4888@lists.php.net to get a copy of this message | ||
From:
Operating system:
PHP version: 5.2.14
Package: Date/time related
Bug Type: Documentation Problem
Bug description:You have mixed up two values in one of the tables
Description:
------------
%p UPPER-CASE 'AM' or 'PM' based on the given time
%P lower-case 'am' or 'pm' based on the given time
These lines appear to be the wrong way around.
<?php
$date = '15/02/08 11:19:56 am';
$dateFormat1 = '%d/%m/%y %l:%M:%S %p'; // Little P, which docs say is
upper-case
$dateFormat2 = '%d/%m/%y %l:%M:%S %P'; // Big P, which docs say is
lower-case
echo strptime($date, $dateFormat1) == true ? "true\n" : "false\n";
echo strptime($date, $dateFormat2) == true ? "true\n" : "false\n";
Result is true, false, which means that %p is matching, but docs say it
will
only match on upper case, which is wrong and that %P is not matching, but
docs
say it will with the lower case.
Since the input has a lower case 'am' in it, the lower-case %P should
match, but
it does not.
Test script:
---------------
<?php
$date = '15/02/08 11:19:56 am';
$dateFormat1 = '%d/%m/%y %l:%M:%S %p'; // Little P, which docs say is
upper-case
$dateFormat2 = '%d/%m/%y %l:%M:%S %P'; // Big P, which docs say is
lower-case
echo strptime($date, $dateFormat1) == true ? "true\n" : "false\n";
echo strptime($date, $dateFormat2) == true ? "true\n" : "false\n";
Result is true, false, which means that %p is matching, but docs say it
will only match on upper case, which is wrong and that %P is not matching,
but docs say it will with the lower case.
Since the input has a lower case 'am' in it, the lower-case %P should
match, but it does not.
Expected result:
----------------
false
true
Actual result:
--------------
true
false
--
Edit bug report at http://bugs.php.net/bug.php?id=52642&edit=1
--
Try a snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=52642&r=trysnapshot52
Try a snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=52642&r=trysnapshot53
Try a snapshot (trunk): http://bugs.php.net/fix.php?id=52642&r=trysnapshottrunk
Fixed in SVN: http://bugs.php.net/fix.php?id=52642&r=fixed
Fixed in SVN and need be documented: http://bugs.php.net/fix.php?id=52642&r=needdocs
Fixed in release: http://bugs.php.net/fix.php?id=52642&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=52642&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=52642&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=52642&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=52642&r=support
Expected behavior: http://bugs.php.net/fix.php?id=52642&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=52642&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=52642&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=52642&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=52642&r=php4
Daylight Savings: http://bugs.php.net/fix.php?id=52642&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=52642&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=52642&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=52642&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=52642&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=52642&r=mysqlcfg