diff options
Diffstat (limited to 'ext/date/php_date.c')
-rw-r--r-- | ext/date/php_date.c | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/ext/date/php_date.c b/ext/date/php_date.c index 7c4e7820bb..765da9ec45 100644 --- a/ext/date/php_date.c +++ b/ext/date/php_date.c @@ -738,7 +738,6 @@ PHP_RSHUTDOWN_FUNCTION(date) #define SUNFUNCS_RET_STRING 1 #define SUNFUNCS_RET_DOUBLE 2 - /* {{{ PHP_MINIT_FUNCTION */ PHP_MINIT_FUNCTION(date) { @@ -860,11 +859,17 @@ static char* guess_timezone(const timelib_tzdb *tzdb TSRMLS_DC) timelib_timezone_id_is_valid(Z_STRVAL(ztz), tzdb)) { return Z_STRVAL(ztz); } - } else if (*DATEG(default_timezone) && timelib_timezone_id_is_valid(DATEG(default_timezone), tzdb)) { - return DATEG(default_timezone); + } else if (*DATEG(default_timezone)) { + if (timelib_timezone_id_is_valid(DATEG(default_timezone), tzdb)) { + return DATEG(default_timezone); + } + /* Invalid date.timezone value */ + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid date.timezone value '%s', we selected the timezone 'UTC' for now.", DATEG(default_timezone)); + } else { + /* No date.timezone value */ + php_error_docref(NULL TSRMLS_CC, E_WARNING, DATE_TZ_ERRMSG "We selected the timezone 'UTC' for now, but please set date.timezone to select your timezone."); } /* Fallback to UTC */ - php_error_docref(NULL TSRMLS_CC, E_WARNING, DATE_TZ_ERRMSG "We selected the timezone 'UTC' for now, but please set date.timezone to select your timezone."); return "UTC"; } @@ -882,7 +887,6 @@ PHPAPI timelib_tzinfo *get_timezone_info(TSRMLS_D) } /* }}} */ - /* {{{ date() and gmdate() data */ #include "ext/standard/php_smart_str.h" @@ -1318,7 +1322,6 @@ PHPAPI signed long php_parse_date(char *string, signed long *now) } /* }}} */ - /* {{{ proto int strtotime(string time [, int now ]) Convert string representation of date and time to a timestamp */ PHP_FUNCTION(strtotime) @@ -1379,7 +1382,6 @@ PHP_FUNCTION(strtotime) } /* }}} */ - /* {{{ php_mktime - (gm)mktime helper */ PHPAPI void php_mktime(INTERNAL_FUNCTION_PARAMETERS, int gmt) { @@ -1488,7 +1490,6 @@ PHP_FUNCTION(gmmktime) } /* }}} */ - /* {{{ proto bool checkdate(int month, int day, int year) Returns true(1) if it is a valid date in gregorian calendar */ PHP_FUNCTION(checkdate) |