rmccue / Feast

A feed reader transformation plugin for WordPress
40 stars 7 forks source link

Timezone #3

Open kucrut opened 11 years ago

kucrut commented 11 years ago

When timezone is set to default (UTC+0), feeds can't be added and an exception is thrown:

[Sun Mar 24 20:03:30.112441 2013] [:error] [pid 5146] [client 127.0.0.1:37422] PHP Fatal error:  Uncaught exception 'Exception' with message 'DateTimeZone::__construct() [<a href='datetimezone.--construct'>datetimezone.--construct</a>]: Unknown or bad timezone (UTC+0)' in /home/kucrut/packages/web/cms/wordpress/plugins/feast/library/Feast.php:378\nStack trace:\n#0 /home/kucrut/packages/web/cms/wordpress/plugins/feast/library/Feast.php(378): DateTimeZone->__construct('UTC+0')\n#1 /home/kucrut/packages/web/cms/wordpress/plugins/feast/library/Feast/Feed.php(29): Feast::getTimezoneObject()\n#2 /home/kucrut/packages/web/cms/wordpress/plugins/feast/library/Feast/Feed.php(156): Feast_Feed->update()\n#3 [internal function]: Feast_Feed::addFeedData(Object(Feast_Feed), Array)\n#4 /home/kucrut/work/web/sites/kc.wp/wp/wp-includes/plugin.php(406): call_user_func_array(Array, Array)\n#5 /home/kucrut/packages/web/cms/wordpress/plugins/feast/library/Feast/Admin/Feeds.php(105): do_action('feast_create_fe...', Object(Feast_Feed), Array)\n#6 [internal function]: Feast_Admin_Feeds::save_post(5, Object(WP_Post))\n#7 /home/kucrut/work in /home/kucrut/packages/web/cms/wordpress/plugins/feast/library/Feast.php on line 378, referer: http://feast.wp.kc/wp-admin/post-new.php?post_type=feast-feed
JasonHoffmann commented 11 years ago

I'm actually getting this error no matter what my timezone is set to.

Trying to figure this out.

JasonHoffmann commented 11 years ago

Can't say I no much about this but I found some help on this post: http://wordpress.org/support/topic/error-unknown-or-bad-timezone.

Before the error, none of the feeds were showing.

If I add this starting on line 368:

if (empty($tzstring)) { // set the Etc zone if no timezone string exists if ($current_offset < 0) $offnum = - ceil($current_offset); else $offnum = - floor($current_offset); $tzstring = 'Etc/GMT' . (($offnum >= 0) ? '+' : '') . $offnum; $tzstring='Europe/Paris'; }

Then the error goes away, and the feeds show up again. But I honestly don't know why and would love someone to explain it to me.