Bug #15032: Date_Calc::getMonthFullName() problem
| From: | matt at mohebbi dot com | Date: | Mon, 14 Jan 2002 18:19:00 +0000 |
| Subject: | Bug #15032: Date_Calc::getMonthFullName() problem | ||
| Groups: | php.pear.dev | ||
| Request: | Send a blank email to pear-dev+get-3927@lists.php.net to get a copy of this message | ||
From: matt@mohebbi.com
Operating system: Linux
PHP version: 4.0.6
PHP Bug Type: PEAR related
Bug description: Date_Calc::getMonthFullName() problem
For the getMonthFullName function the specs state the input should be in
the form MM. If call the function with 01 as its input it works fine. I
believe php is automatically casting the number to an int and thus
removing the 0. However, there are some cases where the function is
called
with a variable as input (in my case a get variable) where this casting
does not occur. The function then returns nothing. Below is a diff that
fixes the getMonthFullName and GetMonthAbbrName for this case.
File bug.php:
<?
require 'Date/Calc.php';
$en_month = Date_Calc::getMonthFullname($month);
echo "Test $en_month";
?>
bug.php?month=01 output:
Before patch:
Test
After patch:
Test January
1434c1434,1436
<
---
>
> // Cast month to an int to eliminate starting zero
> $month = (int)$month;
1457a1460
> $month = (int)$month;
--
Edit bug report at: http://bugs.php.net/?id=15032&edit=1