Bug #15032 Updated: Date_Calc::getMonthFullName() problem

From: Date: Mon, 14 Jan 2002 18:55:58 +0000
Subject: Bug #15032 Updated: Date_Calc::getMonthFullName() problem
References: 1  Groups: php.dev 
Request: Send a blank email to php-dev+get-77041@lists.php.net to get a copy of this message
ID: 15032 Updated by: mj Reported By: matt@mohebbi.com Old Status: Open Status: Closed Bug Type: PEAR related Operating System: Linux PHP Version: 4.0.6 New Comment: Thanks, I commited your patch. - Martin Previous Comments: ------------------------------------------------------------------------ [2002-01-14 13:18:59] matt@mohebbi.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; ------------------------------------------------------------------------ Edit this bug report at http://bugs.php.net/?id=15032&edit=1

« previous php.dev (#77041) next »