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 b5882271e3..1b07404be9 100644 --- a/ext/date/php_date.c +++ b/ext/date/php_date.c @@ -740,7 +740,6 @@ PHP_RSHUTDOWN_FUNCTION(date) #define SUNFUNCS_RET_STRING 1 #define SUNFUNCS_RET_DOUBLE 2 - /* {{{ PHP_MINIT_FUNCTION */ PHP_MINIT_FUNCTION(date) { @@ -862,11 +861,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"; } @@ -884,7 +889,6 @@ PHPAPI timelib_tzinfo *get_timezone_info(TSRMLS_D) } /* }}} */ - /* {{{ date() and gmdate() data */ #include "ext/standard/php_smart_str.h" @@ -1324,7 +1328,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) @@ -1385,7 +1388,6 @@ PHP_FUNCTION(strtotime) } /* }}} */ - /* {{{ php_mktime - (gm)mktime helper */ PHPAPI void php_mktime(INTERNAL_FUNCTION_PARAMETERS, int gmt) { @@ -1494,7 +1496,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) |
