php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #15032 Date_Calc::getMonthFullName() problem
Submitted: 2002-01-14 13:18 UTC Modified: 2002-01-14 14:03 UTC
From: matt at mohebbi dot com Assigned:
Status: Closed Package: PEAR related
PHP Version: 4.0.6 OS: Linux
Private report: No CVE-ID: None
 [2002-01-14 13:18 UTC] matt at mohebbi dot com
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;

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-01-14 13:55 UTC] mj@php.net
Thanks, I commited your patch.

- Martin
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Apr 26 02:01:29 2024 UTC