New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
PHPMD complains about itself #77
Comments
Take a look at |
@ooxi I'm looking at it, but don't see how it fits here. The error I'm getting is from PHPMD checking itself and reporting errors. Shouldn't it only be checking my project for errors? |
PHPMD does not check itself, this message appears if PHP's date/time functions, but not default timezone is set. You can configure it, the setting is date.timezone. |
The problem is that |
I'm having this issue as well. Any chance for a fix? |
I have the same issue with version 2.1.3, which has the fix made by @manuelpichler . the call to date_default_timezone_get() still triggers the php warning, but returns UTC by default by PHP, so it never enters the if clause, and then the date() call also prints a warning due to date_default_timezone_set never being called. date_default_timezone_set(@date_default_timezone_get()) would fix the issue (though it's not exactly beautiful, but well). |
Hi, we also have this issue using PHP 5.6.
The fix applied is not valid for PHP 5.6, the warning is explicit, even if the system timezone is set we should set a timezone explicitly in the source code. So (at least for PHP 5.6) we should replace ... if (!ini_get('date.timezone') && !date_default_timezone_get()) {
date_default_timezone_set('UTC');
} by ... if (version_compare(phpversion(), '5.6.0', '>=') || (!ini_get('date.timezone') && !date_default_timezone_get())) {
date_default_timezone_set('UTC');
} |
@hbandura: Yes, even after @manuelpichler's fix, a timezone warning is still raised. I've just created PR #297 which completely fixes the issue (@bgaillard: even on PHP 5.6). |
Complete fix for #77 (timezone warning)
I just installed PHPMD in PhpStorm 6.0 and ran it for the first time in my project. The very first warning was about itself and not my code; I can't figure out how to to keep it from checking its own files and checking mine instead.
The text was updated successfully, but these errors were encountered: