Creation of Zend_Date throws Exception

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Creation of Zend_Date throws Exception

alesl
Hi,

After revision #7768 3.2.2008:
Zend_Date:
 - timezone settings within a date string are now used as internal timezone

   f.e. new Zend_Date('2008-01-01 00:00:00+01:00') will set Etc/GMT-1 as timezone
   textual timezones like CET are used as given
   (closes ZF-2071)

Default timezone is set!

date_default_timezone_set('Europe/Ljubljana');

Creation of  date throws exception!

$date = new Zend_Date();
Stacktrace:

$date
1202417887
1 $part
'TIMESTAMP'
2 $locale
NULL
0 $zone
'1202417887'

timezone (1202417887) is not a known timezone

$date = new Zend_Date(null, null, $locale);
Stacktrace:
0 $date
1202418046
1 $part
'TIMESTAMP'
2 $locale
Zend_Locale::__set_state(array(
   '_Locale' => 'sl_SI',
   '_Codeset' => NULL,
))

timezone (1202418046) is not a known timezone

$date = new Zend_Date('2008-03-06', 'YYYY-MM-dd', $locale);
0 $date
'2008-03-06'
1 $part
'YYYY-MM-dd'
2 $locale
Zend_Locale::__set_state(array(
   '_Locale' => 'sl_SI',
   '_Codeset' => NULL,
))

timezone (2008) is not a known timezone

Am i missing something?

Regards, AlesL
Reply | Threaded
Open this post in threaded view
|

Re: Creation of Zend_Date throws Exception

Thomas Weidner
Hy Ales,

I expect that you are using a custom exception/error handler and PHP 5.2.5
There is an already answered issue related to this.

The point is that within PHP 5.2.5 there is an bug.
Exceptions are returned by the error handler instead of the exception
handler.
And these exceptions are no thrown but catched ones.

See ZF-2566 for the related PHP Bug and the possible solution as long as it
is not fixed within PHP.

Greetings
Thomas Weidner, I18N Team Leader
http://www.thomasweidner.com

----- Original Message -----
From: "Aleš Lončar" <[hidden email]>
To: <[hidden email]>
Cc: <[hidden email]>
Sent: Thursday, February 07, 2008 10:07 PM
Subject: [fw-i18n] Creation of Zend_Date throws Exception


> Hi,
>
> After revision #7768 3.2.2008:
> Zend_Date:
> - timezone settings within a date string are now used as internal timezone
>
>   f.e. new Zend_Date('2008-01-01 00:00:00+01:00') will set Etc/GMT-1 as
> timezone
>   textual timezones like CET are used as given
>   (closes ZF-2071)
>
> Default timezone is set!
>
> date_default_timezone_set('Europe/Ljubljana');
>
> Creation of  date throws exception!
>
> $date = new Zend_Date();
> Stacktrace:
>
> $date
> |1202417887 |
> 1 $part
> |'TIMESTAMP' |
> 2 $locale
> |NULL |
>
> 0 $zone
> |'1202417887' |
>
>
>    timezone (1202417887) is not a known timezone
>
> $date = new Zend_Date(null, null, $locale);
> Stacktrace:
> 0 $date
> |1202418046 |
> 1 $part
> |'TIMESTAMP' |
> 2 $locale
> |Zend_Locale::__set_state(array(
>   '_Locale' => 'sl_SI',
>   '_Codeset' => NULL,
> )) |
>
>
>    timezone (1202418046) is not a known timezone
>
> $date = new Zend_Date('2008-03-06', 'YYYY-MM-dd', $locale);
> 0 $date
> |'2008-03-06' |
> 1 $part
> |'YYYY-MM-dd' |
> 2 $locale
> |Zend_Locale::__set_state(array(
>   '_Locale' => 'sl_SI',
>   '_Codeset' => NULL,
> )) |
>
>
>    timezone (2008) is not a known timezone
>
> Am i missing something?
>
> Regards, AlesL
>