PEAR is archived and read-only

This mirror preserves historical PEAR package releases and metadata so existing references remain available.

Home » Date and Time » Date_Holidays » Bug #7193

Missing parameter filter to isHoliday in Composite driver

Details

Submitted2006-03-24 09:49 UTC
Fromjw at php dot net
Assignedschst
StatusClosed
PackageDate_Holidays
PHP VersionIrrelevant
OSIrrelevant
Roadmaps(Not assigned)

Comments

[2006-03-24 09:49 UTC] jw at php dot net

Description:
------------
When using the composite driver and you call isHoliday(DATE, FILTER) on it, the filter is not applied. When looking at the source in Date/Holidays/Driver/Composite.php, you can see the parameter ist missing and will not be passed on to the added drivers of the compound. This is easily fixed and seems to have been forgotten.

Test script:
---------------
require_once 'Date/Holidays.php';
require_once 'Date/Holidays/Filter/Germany/Saxony.php';

$holidaysThisYear = Date_Holidays::factory('Germany', 2006, 'de_DE');
$holidaysNextYear = Date_Holidays::factory('Germany', 2007, 'de_DE');

$holidays = Date_Holidays::factory('Composite');
$holidays->addDriver($holidaysThisYear);
$holidays->addDriver($holidaysNextYear);

$holidayFilter = new Date_Holidays_Filter_Germany_Saxony;

if ($holidays->isHoliday(strtotime('2006-04-13'), $holidayFilter)) {
echo 'HOLIDAY';
} else {
echo 'NO HOLIDAY';
}

Expected result:
----------------
"NO HOLIDAY"

Actual result:
--------------
"HOLIDAY"