fuel / oil

Fuel PHP Framework - Fuel v1.x Oil command-line package
http://fuelphp.com/docs/packages/oil/intro.html
106 stars 67 forks source link

Issue with default date setting #181

Closed AddoSolutions closed 11 years ago

AddoSolutions commented 11 years ago

Pretty simple, on my server, because PHP gives a nasty error whenever you dont set the default timezone, I kept getting a:

PHP Fatal error: Unknown error on line 0

As a complete n00b to the framework, I just figured it was broken, but it was just a setting I missed. I know PHP fairly well, but "Unknown Error" and "on line 0" are not helpful for fixing things (although I realize you have no control over this error).

May I suggest (presuming this is the place to sugget changes) changing the default timezone from null to 'America/New_york' or something along those lines?

WanWizard commented 11 years ago

It's a PHP error, not a Framework error, so there's nothing we can do about this very useful message. On the other hand, it can get worse.

We haven't put a default timezone in on purpose. Most people don't change it, and then complain their sessions don't work. This will force you to configure the framework properly and correctly.

Having said that, it shouldn't give this error, and it doesn't on my system. Which Fuel version, and what did you run to get this error?

AddoSolutions commented 11 years ago

Interesting, Here is what I am running:

PHP: PHP 5.3.3 (cli) (built: Feb 22 2013 02:51:11) Copyright (c) 1997-2010 The PHP Group Zend Engine v2.3.0, Copyright (c) 1998-2010 Zend Technologies

Fuel: $ oil console Fuel 1.5 - PHP 5.3.3 (cli) (Feb 22 2013 02:48:46) [Linux]

FUEL::VERSION 1.5

HTTPD: Server version: Apache/2.2.15 (Unix) Server built: Feb 22 2013 11:19:58

The issue if left unfixed would not allow me to do anything, at all. Literally, it wouldn't even let me run oil commands. It was quite strange, and the only way I was able to fix it was to track through the files with a die("Line: ".LINE) statement until I narrowed it down (yeah, I'm cool).

Let me know if you need more details on this.

kenjis commented 11 years ago

I've got:

( ! ) Fatal error: Uncaught exception 'Fuel\Core\PhpErrorException' with message 'date() [function.date]: It is not safe to rely on the system's timezone settings. You are required to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'Asia/Tokyo' for 'JST/9.0/no DST' instead' in .../fuel-to-test/fuel/core/classes/log.php on line 51

  • PHP 5.3.23 with Xdebug v2.1.2
  • Linux
  • FuelPHP 1.6/develop
AddoSolutions commented 11 years ago

Ah, should have mentioned this: I initially figured out that it was a problem when I replaced (in the core config file): 'log_threshold' => Fuel::L_WARNING with 'log_threshold' => '' (I didn't really even know what that meant at the time as I had never used this system before, that at least gave me that fatal error that kenjis gave).

I think what was happening, was there was errors being thrown due to the date issue, the error handler was catching them, but in effect throwing more because it too was using the date() function, causing PHP to freak out.

Thoughts?

kenjis commented 11 years ago

I checked FuelPHP 1.5.3. There were 3 fatal errors which were the same as in 1.6/develop.

( ! ) Fatal error: Uncaught exception 'Fuel\Core\PhpErrorException' with message 'date() [function.date]: It is not safe to rely on the system's timezone settings. You are required to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'Asia/Tokyo' for 'JST/9.0/no DST' instead' in .../fuelphp-1.5.3/fuel/packages/log/classes/log.php on line 51

( ! ) Fuel\Core\PhpErrorException: date() [function.date]: It is not safe to rely on the system's timezone settings. You are required to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'Asia/Tokyo' for 'JST/9.0/no DST' instead in .../fuelphp-1.5.3/fuel/packages/log/classes/log.php on line 51

( ! ) Fatal error: Call to a member function log() on a non-object in .../fuelphp-1.5.3/fuel/core/base.php on line 91

I don't know why the environment of @AddoSolutions gives Unknown error, but the last error might be a cause.