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 #967

Date_TimeZone uses a bad global variable

Details

Submitted2004-03-08 03:30 UTC
Fromredbeard at mdjohnson dot us
Assignedpajoye
StatusClosed
PackageDate
PHP VersionIrrelevant
OSAll
Roadmaps(Not assigned)

Comments

[2004-03-08 03:30 UTC] redbeard at mdjohnson dot us

Description:
------------
The Date_TimeZone class uses the global variable $default as the default time zone object. It should be something like (according to PEAR guidlines) $_Date_default_time_zone.

It looks like you might be intending to use static class variables, which don't function as expected in PHP 4.x, IIRC. The above is probably best to use.

Reproduce code:
---------------
Date_TimeZone::setDefault('CST');
$tz = Date_TimeZone::getDefault();
echo "$tz->id\n";

$default = 'EST';
$tz = Date_TimeZone::getDefault();
echo "$tz->id\n";

Expected result:
----------------
CST
CST

Actual result:
--------------
CST
EST