mirror of
https://github.com/php/php-src.git
synced 2024-12-16 21:37:49 +08:00
- date_timezone_set() needs both arguments
- Throw exception in DateTimeZone::__construct if no arguments are passed
This commit is contained in:
parent
7710e22e77
commit
f2ad985262
@ -2001,7 +2001,7 @@ PHP_FUNCTION(date_timezone_set)
|
||||
php_date_obj *dateobj;
|
||||
php_timezone_obj *tzobj;
|
||||
|
||||
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O|O", &object, date_ce_date, &timezone_object, date_ce_timezone) == FAILURE) {
|
||||
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "OO", &object, date_ce_date, &timezone_object, date_ce_timezone) == FAILURE) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
dateobj = (php_date_obj *) zend_object_store_get_object(object TSRMLS_CC);
|
||||
@ -2131,13 +2131,13 @@ PHP_METHOD(DateTimeZone, __construct)
|
||||
int tz_len;
|
||||
timelib_tzinfo *tzi = NULL;
|
||||
|
||||
php_set_error_handling(EH_THROW, NULL TSRMLS_CC);
|
||||
if (SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &tz, &tz_len)) {
|
||||
php_set_error_handling(EH_THROW, NULL TSRMLS_CC);
|
||||
if (SUCCESS == timezone_initialize(&tzi, tz TSRMLS_CC)) {
|
||||
((php_timezone_obj *) zend_object_store_get_object(getThis() TSRMLS_CC))->tz = tzi;
|
||||
}
|
||||
php_set_error_handling(EH_NORMAL, NULL TSRMLS_CC);
|
||||
}
|
||||
php_set_error_handling(EH_NORMAL, NULL TSRMLS_CC);
|
||||
}
|
||||
|
||||
PHP_FUNCTION(timezone_name_get)
|
||||
|
Loading…
Reference in New Issue
Block a user