PEAR is discontinued

This is a static archive preserving historical releases and metadata. No new packages or updates will be published. For updates to existing packages, or to publish new packages, please use Composer and Packagist.

Home » Date and Time » Date » Bug #4489

CGI error on Windows 2003 / IIS6 for DST handling code

Details

Submitted2005-05-31 18:39 UTC
Fromjpm at mysql dot com
StatusNo Feedback
PackageDate
PHP Version4.3.11
OSWindows 2003
Roadmaps(Not assigned)

Comments

[2005-05-31 18:39 UTC] jpm at mysql dot com

Description:
------------
See description of problem here: http://lists.mysql.com/eventum-users/1578

====

I just moved my Eventum 1.5.3 test installation from :
- W2K Sp4 / PWS
- MySQL 4.1.11
- PHP 4.3.10
- mailserver Lotus Notes 5.0.12 / IMAP

to production environment :
- Windows 2003 SP1 / IIS 6.0
- MySQL 4.1.12
- PHP 4.3.11
- mailserver Lotus Notes 5.0.12 / IMAP

and had the same cgi error when viewing entry details. I found a windows related
problem in the include PEAR file timezone.php. Below a fixed version from the
function causing the error:

/**
* Is the given date/time in DST for this time zone
*
* Attempts to determine if a given Date object represents a date/time
* that is in DST for this time zone. WARNINGS: this basically attempts to
* "trick" the system into telling us if we're in DST for a given time zone.
* This uses putenv() which may not work in safe mode, and relies on unix time
* which is only valid for dates from 1970 to ~2038. This relies on the
* underlying OS calls, so it may not work on Windows or on a system where
* zoneinfo is not installed or configured properly.
*
* @access public
* @param object Date $date the date/time to test
* @return boolean true if this date is in DST for this time zone
*/

function inDaylightTime($date)
{
// This additional line immediately returns from the function.
return date("I");
// End MS Windows work around code.

// Beginning of the original PEAR code.
$env_tz = "";
if(getenv("TZ")) {
$env_tz = getenv("TZ");
}
putenv("TZ=".$this->id);
$ltime = localtime($date->getTime(), true);
putenv("TZ=".$env_tz);
return $ltime['tm_isdst'];
}

More about the problem :
http://phpwebsite-comm.sourceforge.net/wiki/index.php?title=MS_Windows_Installations#MS_Windows_2003_and_IIS6

====

So my question is the following: if date('I') is available to check if the given date is on DST or not, why do you need the code above?