Package home | Report new bug | New search | Development Roadmap Status: Open | Feedback | All | Closed Since Version 0.1.3

Bug #21004 PEAR_Error::getDate() when trying to get 2016 Japan holidays
Submitted: 2015-12-17 03:16 UTC
From: zenich Assigned:
Status: Open Package: Date_Holidays_Japan (version 0.1.3)
PHP Version: 5.6.15 OS: Linux (CentOS release 6.7)
Roadmaps: (Not assigned)    
Subscription  


 [2015-12-17 03:16 UTC] zenich (zen yasuda)
Description: ------------ The code below results with " PHP Fatal error: Call to undefined method PEAR_Error::getDate() in /mnt/hgfs/wrk/2016.php on line 12 " error, while it goes well when I specify $dh = &Date_Holidays::factory('Japan', 2015, 'ja_JP'); Test script: --------------- <?php require_once 'Date/Holidays.php'; $filename = "data/Date_Holidays_Japan/lang/Japan/ja_JP.xml"; $dh = &Date_Holidays::factory('Japan', 2016, 'ja_JP'); $dh->addTranslationFile($filename, 'ja_JP'); $holidays = array(); foreach ($dh->getHolidays() as $h) { $holidays[$h->getDate()->format('%Y-%m-%d')] = $h->getTitle(); } ksort($holidays); print_r($holidays); ?> Expected result: ---------------- Array ( [2016-01-01] => ?? [2016-01-11] => ???? [2016-02-11] => ?????? [2016-03-20] => ???? [2016-03-21] => ???? [2016-04-29] => ???? [2016-05-03] => ????? [2016-05-04] => ????? [2016-05-05] => ????? [2016-07-18] => ??? [2016-08-11] => ??? [2016-09-19] => ???? [2016-09-22] => ???? [2016-10-10] => ???? [2016-11-03] => ???? [2016-11-23] => ?????? [2016-12-23] => ????? ) Actual result: -------------- PHP Stack trace: PHP 1. {main}() /mnt/hgfs/wrk/2016.php:0 PHP 2. Date_Holidays::factory() /mnt/hgfs/wrk/2016.php:7 PHP 3. Date_Holidays_Driver->setYear() /usr/share/pear/Date/Holidays.php:149 PHP 4. Date_Holidays_Driver_Japan->_buildHolidays() /usr/share/pear/Date/Holidays/Driver.php:252 PHP 5. Date_Holidays_Driver_Japan->_buildSubstituteHolidays() /usr/share/pear/Date/Holidays/Driver/Japan.php:168 PHP 6. Date_Holidays_Driver->_addHoliday() /usr/share/pear/Date/Holidays/Driver/Japan.php:585 PHP 7. mktime() /usr/share/pear/Date/Holidays/Driver.php:901 PHP Fatal error: Call to undefined method PEAR_Error::getDate() in /mnt/hgfs/wrk/2016.php on line 12

Comments