diff options
Diffstat (limited to 'ext/date')
274 files changed, 2925 insertions, 3146 deletions
diff --git a/ext/date/php_date.c b/ext/date/php_date.c index 02068b44cc..e71699ecbf 100644 --- a/ext/date/php_date.c +++ b/ext/date/php_date.c @@ -1,7 +1,5 @@ /* +----------------------------------------------------------------------+ - | PHP Version 7 | - +----------------------------------------------------------------------+ | Copyright (c) The PHP Group | +----------------------------------------------------------------------+ | This source file is subject to version 3.01 of the PHP license, | @@ -76,496 +74,7 @@ PHPAPI time_t php_time() #endif } -/* {{{ arginfo */ -ZEND_BEGIN_ARG_INFO_EX(arginfo_date, 0, 0, 1) - ZEND_ARG_INFO(0, format) - ZEND_ARG_INFO(0, timestamp) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_gmdate, 0, 0, 1) - ZEND_ARG_INFO(0, format) - ZEND_ARG_INFO(0, timestamp) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_idate, 0, 0, 1) - ZEND_ARG_INFO(0, format) - ZEND_ARG_INFO(0, timestamp) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_strtotime, 0, 0, 1) - ZEND_ARG_INFO(0, time) - ZEND_ARG_INFO(0, now) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_mktime, 0, 0, 0) - ZEND_ARG_INFO(0, hour) - ZEND_ARG_INFO(0, min) - ZEND_ARG_INFO(0, sec) - ZEND_ARG_INFO(0, mon) - ZEND_ARG_INFO(0, day) - ZEND_ARG_INFO(0, year) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_gmmktime, 0, 0, 0) - ZEND_ARG_INFO(0, hour) - ZEND_ARG_INFO(0, min) - ZEND_ARG_INFO(0, sec) - ZEND_ARG_INFO(0, mon) - ZEND_ARG_INFO(0, day) - ZEND_ARG_INFO(0, year) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO(arginfo_checkdate, 0) - ZEND_ARG_INFO(0, month) - ZEND_ARG_INFO(0, day) - ZEND_ARG_INFO(0, year) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_strftime, 0, 0, 1) - ZEND_ARG_INFO(0, format) - ZEND_ARG_INFO(0, timestamp) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_gmstrftime, 0, 0, 1) - ZEND_ARG_INFO(0, format) - ZEND_ARG_INFO(0, timestamp) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO(arginfo_time, 0) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_localtime, 0, 0, 0) - ZEND_ARG_INFO(0, timestamp) - ZEND_ARG_INFO(0, associative_array) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_getdate, 0, 0, 0) - ZEND_ARG_INFO(0, timestamp) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO(arginfo_date_default_timezone_set, 0) - ZEND_ARG_INFO(0, timezone_identifier) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO(arginfo_date_default_timezone_get, 0) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_date_sunrise, 0, 0, 1) - ZEND_ARG_INFO(0, time) - ZEND_ARG_INFO(0, format) - ZEND_ARG_INFO(0, latitude) - ZEND_ARG_INFO(0, longitude) - ZEND_ARG_INFO(0, zenith) - ZEND_ARG_INFO(0, gmt_offset) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_date_sunset, 0, 0, 1) - ZEND_ARG_INFO(0, time) - ZEND_ARG_INFO(0, format) - ZEND_ARG_INFO(0, latitude) - ZEND_ARG_INFO(0, longitude) - ZEND_ARG_INFO(0, zenith) - ZEND_ARG_INFO(0, gmt_offset) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO(arginfo_date_sun_info, 0) - ZEND_ARG_INFO(0, time) - ZEND_ARG_INFO(0, latitude) - ZEND_ARG_INFO(0, longitude) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_date_create, 0, 0, 0) - ZEND_ARG_INFO(0, time) - ZEND_ARG_INFO(0, timezone) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_date_create_from_format, 0, 0, 2) - ZEND_ARG_INFO(0, format) - ZEND_ARG_INFO(0, time) - ZEND_ARG_OBJ_INFO(0, object, DateTimeZone, 1) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_date_parse, 0, 0, 1) - ZEND_ARG_INFO(0, date) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_date_parse_from_format, 0, 0, 2) - ZEND_ARG_INFO(0, format) - ZEND_ARG_INFO(0, date) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO(arginfo_date_get_last_errors, 0) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_date_format, 0, 0, 2) - ZEND_ARG_INFO(0, object) - ZEND_ARG_INFO(0, format) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_date_method_format, 0, 0, 1) - ZEND_ARG_INFO(0, format) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_date_modify, 0, 0, 2) - ZEND_ARG_INFO(0, object) - ZEND_ARG_INFO(0, modify) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_date_method_modify, 0, 0, 1) - ZEND_ARG_INFO(0, modify) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_date_add, 0, 0, 2) - ZEND_ARG_INFO(0, object) - ZEND_ARG_INFO(0, interval) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_date_method_add, 0, 0, 1) - ZEND_ARG_INFO(0, interval) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_date_sub, 0, 0, 2) - ZEND_ARG_INFO(0, object) - ZEND_ARG_INFO(0, interval) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_date_method_sub, 0, 0, 1) - ZEND_ARG_INFO(0, interval) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_date_timezone_get, 0, 0, 1) - ZEND_ARG_INFO(0, object) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO(arginfo_date_method_timezone_get, 0) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_date_timezone_set, 0, 0, 2) - ZEND_ARG_INFO(0, object) - ZEND_ARG_INFO(0, timezone) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_date_method_timezone_set, 0, 0, 1) - ZEND_ARG_INFO(0, timezone) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_date_offset_get, 0, 0, 1) - ZEND_ARG_INFO(0, object) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO(arginfo_date_method_offset_get, 0) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_date_diff, 0, 0, 2) - ZEND_ARG_INFO(0, object) - ZEND_ARG_INFO(0, object2) - ZEND_ARG_INFO(0, absolute) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_date_method_diff, 0, 0, 1) - ZEND_ARG_INFO(0, object) - ZEND_ARG_INFO(0, absolute) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_date_time_set, 0, 0, 3) - ZEND_ARG_INFO(0, object) - ZEND_ARG_INFO(0, hour) - ZEND_ARG_INFO(0, minute) - ZEND_ARG_INFO(0, second) - ZEND_ARG_INFO(0, microseconds) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_date_method_time_set, 0, 0, 2) - ZEND_ARG_INFO(0, hour) - ZEND_ARG_INFO(0, minute) - ZEND_ARG_INFO(0, second) - ZEND_ARG_INFO(0, microseconds) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_date_date_set, 0, 0, 4) - ZEND_ARG_INFO(0, object) - ZEND_ARG_INFO(0, year) - ZEND_ARG_INFO(0, month) - ZEND_ARG_INFO(0, day) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_date_method_date_set, 0, 0, 3) - ZEND_ARG_INFO(0, year) - ZEND_ARG_INFO(0, month) - ZEND_ARG_INFO(0, day) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_date_isodate_set, 0, 0, 3) - ZEND_ARG_INFO(0, object) - ZEND_ARG_INFO(0, year) - ZEND_ARG_INFO(0, week) - ZEND_ARG_INFO(0, day) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_date_method_isodate_set, 0, 0, 2) - ZEND_ARG_INFO(0, year) - ZEND_ARG_INFO(0, week) - ZEND_ARG_INFO(0, day) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_date_timestamp_set, 0, 0, 2) - ZEND_ARG_INFO(0, object) - ZEND_ARG_INFO(0, unixtimestamp) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_date_method_timestamp_set, 0, 0, 1) - ZEND_ARG_INFO(0, unixtimestamp) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_date_timestamp_get, 0, 0, 1) - ZEND_ARG_INFO(0, object) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO(arginfo_date_method_timestamp_get, 0) -ZEND_END_ARG_INFO() - - -ZEND_BEGIN_ARG_INFO_EX(arginfo_date_method_create_from_immutable, 0, 0, 1) - ZEND_ARG_INFO(0, DateTimeImmutable) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_date_method_create_from_mutable, 0, 0, 1) - ZEND_ARG_INFO(0, DateTime) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_timezone_open, 0, 0, 1) - ZEND_ARG_INFO(0, timezone) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_timezone_name_get, 0, 0, 1) - ZEND_ARG_INFO(0, object) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO(arginfo_timezone_method_name_get, 0) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_timezone_name_from_abbr, 0, 0, 1) - ZEND_ARG_INFO(0, abbr) - ZEND_ARG_INFO(0, gmtoffset) - ZEND_ARG_INFO(0, isdst) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_timezone_offset_get, 0, 0, 2) - ZEND_ARG_OBJ_INFO(0, object, DateTimeZone, 0) - ZEND_ARG_OBJ_INFO(0, datetime, DateTimeInterface, 0) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_timezone_method_offset_get, 0, 0, 1) - ZEND_ARG_INFO(0, object) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_timezone_transitions_get, 0, 0, 1) - ZEND_ARG_INFO(0, object) - ZEND_ARG_INFO(0, timestamp_begin) - ZEND_ARG_INFO(0, timestamp_end) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_timezone_method_transitions_get, 0, 0, 0) - ZEND_ARG_INFO(0, timestamp_begin) - ZEND_ARG_INFO(0, timestamp_end) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_timezone_location_get, 0, 0, 1) - ZEND_ARG_INFO(0, object) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO(arginfo_timezone_method_location_get, 0) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_timezone_identifiers_list, 0, 0, 0) - ZEND_ARG_INFO(0, what) - ZEND_ARG_INFO(0, country) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO(arginfo_timezone_abbreviations_list, 0) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO(arginfo_timezone_version_get, 0) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_date_interval_create_from_date_string, 0, 0, 1) - ZEND_ARG_INFO(0, time) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_date_interval_format, 0, 0, 2) - ZEND_ARG_INFO(0, object) - ZEND_ARG_INFO(0, format) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO(arginfo_date_method_interval_format, 0) - ZEND_ARG_INFO(0, format) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_date_period_construct, 0, 0, 3) - ZEND_ARG_INFO(0, start) - ZEND_ARG_INFO(0, interval) - ZEND_ARG_INFO(0, end) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_date_set_state, 0, 0, 1) - ZEND_ARG_ARRAY_INFO(0, array, 0) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_date_interval_construct, 0, 0, 1) - ZEND_ARG_INFO(0, interval_spec) -ZEND_END_ARG_INFO() -/* }}} */ - -/* {{{ Function table */ -static const zend_function_entry date_functions[] = { - PHP_FE(strtotime, arginfo_strtotime) - PHP_FE(date, arginfo_date) - PHP_FE(idate, arginfo_idate) - PHP_FE(gmdate, arginfo_gmdate) - PHP_FE(mktime, arginfo_mktime) - PHP_FE(gmmktime, arginfo_gmmktime) - PHP_FE(checkdate, arginfo_checkdate) - PHP_FE(strftime, arginfo_strftime) - PHP_FE(gmstrftime, arginfo_gmstrftime) - PHP_FE(time, arginfo_time) - PHP_FE(localtime, arginfo_localtime) - PHP_FE(getdate, arginfo_getdate) - - /* Advanced Interface */ - PHP_FE(date_create, arginfo_date_create) - PHP_FE(date_create_immutable, arginfo_date_create) - PHP_FE(date_create_from_format, arginfo_date_create_from_format) - PHP_FE(date_create_immutable_from_format, arginfo_date_create_from_format) - PHP_FE(date_parse, arginfo_date_parse) - PHP_FE(date_parse_from_format, arginfo_date_parse_from_format) - PHP_FE(date_get_last_errors, arginfo_date_get_last_errors) - PHP_FE(date_format, arginfo_date_format) - PHP_FE(date_modify, arginfo_date_modify) - PHP_FE(date_add, arginfo_date_add) - PHP_FE(date_sub, arginfo_date_sub) - PHP_FE(date_timezone_get, arginfo_date_timezone_get) - PHP_FE(date_timezone_set, arginfo_date_timezone_set) - PHP_FE(date_offset_get, arginfo_date_offset_get) - PHP_FE(date_diff, arginfo_date_diff) - - PHP_FE(date_time_set, arginfo_date_time_set) - PHP_FE(date_date_set, arginfo_date_date_set) - PHP_FE(date_isodate_set, arginfo_date_isodate_set) - PHP_FE(date_timestamp_set, arginfo_date_timestamp_set) - PHP_FE(date_timestamp_get, arginfo_date_timestamp_get) - - PHP_FE(timezone_open, arginfo_timezone_open) - PHP_FE(timezone_name_get, arginfo_timezone_name_get) - PHP_FE(timezone_name_from_abbr, arginfo_timezone_name_from_abbr) - PHP_FE(timezone_offset_get, arginfo_timezone_offset_get) - PHP_FE(timezone_transitions_get, arginfo_timezone_transitions_get) - PHP_FE(timezone_location_get, arginfo_timezone_location_get) - PHP_FE(timezone_identifiers_list, arginfo_timezone_identifiers_list) - PHP_FE(timezone_abbreviations_list, arginfo_timezone_abbreviations_list) - PHP_FE(timezone_version_get, arginfo_timezone_version_get) - - PHP_FE(date_interval_create_from_date_string, arginfo_date_interval_create_from_date_string) - PHP_FE(date_interval_format, arginfo_date_interval_format) - - /* Options and Configuration */ - PHP_FE(date_default_timezone_set, arginfo_date_default_timezone_set) - PHP_FE(date_default_timezone_get, arginfo_date_default_timezone_get) - - /* Astronomical functions */ - PHP_FE(date_sunrise, arginfo_date_sunrise) - PHP_FE(date_sunset, arginfo_date_sunset) - PHP_FE(date_sun_info, arginfo_date_sun_info) - PHP_FE_END -}; - -static const zend_function_entry date_funcs_interface[] = { - PHP_ABSTRACT_ME(DateTimeInterface, format, arginfo_date_method_format) - PHP_ABSTRACT_ME(DateTimeInterface, getTimezone, arginfo_date_method_timezone_get) - PHP_ABSTRACT_ME(DateTimeInterface, getOffset, arginfo_date_method_offset_get) - PHP_ABSTRACT_ME(DateTimeInterface, getTimestamp, arginfo_date_method_timestamp_get) - PHP_ABSTRACT_ME(DateTimeInterface, diff, arginfo_date_method_diff) - PHP_ABSTRACT_ME(DateTimeInterface, __wakeup, NULL) - PHP_FE_END -}; - -static const zend_function_entry date_funcs_date[] = { - PHP_ME(DateTime, __construct, arginfo_date_create, ZEND_ACC_PUBLIC) - PHP_ME(DateTime, __wakeup, NULL, ZEND_ACC_PUBLIC) - PHP_ME(DateTime, __set_state, arginfo_date_set_state, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC) - PHP_ME(DateTime, createFromImmutable, arginfo_date_method_create_from_immutable, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC) - PHP_ME_MAPPING(createFromFormat, date_create_from_format, arginfo_date_create_from_format, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC) - PHP_ME_MAPPING(getLastErrors, date_get_last_errors, arginfo_date_get_last_errors, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC) - PHP_ME_MAPPING(format, date_format, arginfo_date_method_format, 0) - PHP_ME_MAPPING(modify, date_modify, arginfo_date_method_modify, 0) - PHP_ME_MAPPING(add, date_add, arginfo_date_method_add, 0) - PHP_ME_MAPPING(sub, date_sub, arginfo_date_method_sub, 0) - PHP_ME_MAPPING(getTimezone, date_timezone_get, arginfo_date_method_timezone_get, 0) - PHP_ME_MAPPING(setTimezone, date_timezone_set, arginfo_date_method_timezone_set, 0) - PHP_ME_MAPPING(getOffset, date_offset_get, arginfo_date_method_offset_get, 0) - PHP_ME_MAPPING(setTime, date_time_set, arginfo_date_method_time_set, 0) - PHP_ME_MAPPING(setDate, date_date_set, arginfo_date_method_date_set, 0) - PHP_ME_MAPPING(setISODate, date_isodate_set, arginfo_date_method_isodate_set, 0) - PHP_ME_MAPPING(setTimestamp, date_timestamp_set, arginfo_date_method_timestamp_set, 0) - PHP_ME_MAPPING(getTimestamp, date_timestamp_get, arginfo_date_method_timestamp_get, 0) - PHP_ME_MAPPING(diff, date_diff, arginfo_date_method_diff, 0) - PHP_FE_END -}; - -static const zend_function_entry date_funcs_immutable[] = { - PHP_ME(DateTimeImmutable, __construct, arginfo_date_create, ZEND_ACC_PUBLIC) - PHP_ME(DateTime, __wakeup, NULL, ZEND_ACC_PUBLIC) - PHP_ME(DateTimeImmutable, __set_state, arginfo_date_set_state, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC) - PHP_ME_MAPPING(createFromFormat, date_create_immutable_from_format, arginfo_date_create_from_format, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC) - PHP_ME_MAPPING(getLastErrors, date_get_last_errors, arginfo_date_get_last_errors, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC) - PHP_ME_MAPPING(format, date_format, arginfo_date_method_format, 0) - PHP_ME_MAPPING(getTimezone, date_timezone_get, arginfo_date_method_timezone_get, 0) - PHP_ME_MAPPING(getOffset, date_offset_get, arginfo_date_method_offset_get, 0) - PHP_ME_MAPPING(getTimestamp, date_timestamp_get, arginfo_date_method_timestamp_get, 0) - PHP_ME_MAPPING(diff, date_diff, arginfo_date_method_diff, 0) - PHP_ME(DateTimeImmutable, modify, arginfo_date_method_modify, 0) - PHP_ME(DateTimeImmutable, add, arginfo_date_method_add, 0) - PHP_ME(DateTimeImmutable, sub, arginfo_date_method_sub, 0) - PHP_ME(DateTimeImmutable, setTimezone, arginfo_date_method_timezone_set, 0) - PHP_ME(DateTimeImmutable, setTime, arginfo_date_method_time_set, 0) - PHP_ME(DateTimeImmutable, setDate, arginfo_date_method_date_set, 0) - PHP_ME(DateTimeImmutable, setISODate, arginfo_date_method_isodate_set, 0) - PHP_ME(DateTimeImmutable, setTimestamp, arginfo_date_method_timestamp_set, 0) - PHP_ME(DateTimeImmutable, createFromMutable, arginfo_date_method_create_from_mutable, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC) - PHP_FE_END -}; - -static const zend_function_entry date_funcs_timezone[] = { - PHP_ME(DateTimeZone, __construct, arginfo_timezone_open, ZEND_ACC_PUBLIC) - PHP_ME(DateTimeZone, __wakeup, NULL, ZEND_ACC_PUBLIC) - PHP_ME(DateTimeZone, __set_state, arginfo_date_set_state, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC) - PHP_ME_MAPPING(getName, timezone_name_get, arginfo_timezone_method_name_get, 0) - PHP_ME_MAPPING(getOffset, timezone_offset_get, arginfo_timezone_method_offset_get, 0) - PHP_ME_MAPPING(getTransitions, timezone_transitions_get, arginfo_timezone_method_transitions_get, 0) - PHP_ME_MAPPING(getLocation, timezone_location_get, arginfo_timezone_method_location_get, 0) - PHP_ME_MAPPING(listAbbreviations, timezone_abbreviations_list, arginfo_timezone_abbreviations_list, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC) - PHP_ME_MAPPING(listIdentifiers, timezone_identifiers_list, arginfo_timezone_identifiers_list, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC) - PHP_FE_END -}; - -static const zend_function_entry date_funcs_interval[] = { - PHP_ME(DateInterval, __construct, arginfo_date_interval_construct, ZEND_ACC_PUBLIC) - PHP_ME(DateInterval, __wakeup, NULL, ZEND_ACC_PUBLIC) - PHP_ME(DateInterval, __set_state, arginfo_date_set_state, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC) - PHP_ME_MAPPING(format, date_interval_format, arginfo_date_method_interval_format, 0) - PHP_ME_MAPPING(createFromDateString, date_interval_create_from_date_string, arginfo_date_interval_create_from_date_string, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC) - PHP_FE_END -}; - -static const zend_function_entry date_funcs_period[] = { - PHP_ME(DatePeriod, __construct, arginfo_date_period_construct, ZEND_ACC_PUBLIC) - PHP_ME(DatePeriod, __wakeup, NULL, ZEND_ACC_PUBLIC) - PHP_ME(DatePeriod, __set_state, arginfo_date_set_state, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC) - PHP_ME(DatePeriod, getStartDate, NULL, ZEND_ACC_PUBLIC) - PHP_ME(DatePeriod, getEndDate, NULL, ZEND_ACC_PUBLIC) - PHP_ME(DatePeriod, getDateInterval, NULL, ZEND_ACC_PUBLIC) - PHP_ME(DatePeriod, getRecurrences, NULL, ZEND_ACC_PUBLIC) - PHP_FE_END -}; +#include "php_date_arginfo.h" static char* guess_timezone(const timelib_tzdb *tzdb); static void date_register_classes(void); @@ -581,11 +90,11 @@ int php_date_global_timezone_db_enabled; #define DATE_DEFAULT_LATITUDE "31.7667" #define DATE_DEFAULT_LONGITUDE "35.2333" -/* on 90'35; common sunset declaration (start of sun body appear) */ -#define DATE_SUNSET_ZENITH "90.583333" +/* on 90'50; common sunset declaration (start of sun body appear) */ +#define DATE_SUNSET_ZENITH "90.833333" -/* on 90'35; common sunrise declaration (sun body disappeared) */ -#define DATE_SUNRISE_ZENITH "90.583333" +/* on 90'50; common sunrise declaration (sun body disappeared) */ +#define DATE_SUNRISE_ZENITH "90.833333" static PHP_INI_MH(OnUpdate_date_timezone); @@ -641,8 +150,8 @@ static zend_object_handlers date_object_handlers_period; #define DATE_CHECK_INITIALIZED(member, class_name) \ if (!(member)) { \ - php_error_docref(NULL, E_WARNING, "The " #class_name " object has not been correctly initialized by its constructor"); \ - RETURN_FALSE; \ + zend_throw_error(NULL, "The " #class_name " object has not been correctly initialized by its constructor"); \ + RETURN_THROWS(); \ } static void date_object_free_storage_date(zend_object *object); @@ -655,30 +164,30 @@ static zend_object *date_object_new_timezone(zend_class_entry *class_type); static zend_object *date_object_new_interval(zend_class_entry *class_type); static zend_object *date_object_new_period(zend_class_entry *class_type); -static zend_object *date_object_clone_date(zval *this_ptr); -static zend_object *date_object_clone_timezone(zval *this_ptr); -static zend_object *date_object_clone_interval(zval *this_ptr); -static zend_object *date_object_clone_period(zval *this_ptr); +static zend_object *date_object_clone_date(zend_object *this_ptr); +static zend_object *date_object_clone_timezone(zend_object *this_ptr); +static zend_object *date_object_clone_interval(zend_object *this_ptr); +static zend_object *date_object_clone_period(zend_object *this_ptr); static int date_object_compare_date(zval *d1, zval *d2); -static HashTable *date_object_get_gc(zval *object, zval **table, int *n); -static HashTable *date_object_get_properties_for(zval *object, zend_prop_purpose purpose); -static HashTable *date_object_get_gc_interval(zval *object, zval **table, int *n); -static HashTable *date_object_get_properties_interval(zval *object); -static HashTable *date_object_get_gc_period(zval *object, zval **table, int *n); -static HashTable *date_object_get_properties_period(zval *object); -static HashTable *date_object_get_properties_for_timezone(zval *object, zend_prop_purpose purpose); -static HashTable *date_object_get_gc_timezone(zval *object, zval **table, int *n); -static HashTable *date_object_get_debug_info_timezone(zval *object, int *is_temp); +static HashTable *date_object_get_gc(zend_object *object, zval **table, int *n); +static HashTable *date_object_get_properties_for(zend_object *object, zend_prop_purpose purpose); +static HashTable *date_object_get_gc_interval(zend_object *object, zval **table, int *n); +static HashTable *date_object_get_properties_interval(zend_object *object); +static HashTable *date_object_get_gc_period(zend_object *object, zval **table, int *n); +static HashTable *date_object_get_properties_period(zend_object *object); +static HashTable *date_object_get_properties_for_timezone(zend_object *object, zend_prop_purpose purpose); +static HashTable *date_object_get_gc_timezone(zend_object *object, zval **table, int *n); +static HashTable *date_object_get_debug_info_timezone(zend_object *object, int *is_temp); static void php_timezone_to_string(php_timezone_obj *tzobj, zval *zv); static int date_interval_compare_objects(zval *o1, zval *o2); -static zval *date_interval_read_property(zval *object, zval *member, int type, void **cache_slot, zval *rv); -static zval *date_interval_write_property(zval *object, zval *member, zval *value, void **cache_slot); -static zval *date_interval_get_property_ptr_ptr(zval *object, zval *member, int type, void **cache_slot); -static zval *date_period_read_property(zval *object, zval *member, int type, void **cache_slot, zval *rv); -static zval *date_period_write_property(zval *object, zval *member, zval *value, void **cache_slot); -static zval *date_period_get_property_ptr_ptr(zval *object, zval *member, int type, void **cache_slot); +static zval *date_interval_read_property(zend_object *object, zend_string *member, int type, void **cache_slot, zval *rv); +static zval *date_interval_write_property(zend_object *object, zend_string *member, zval *value, void **cache_slot); +static zval *date_interval_get_property_ptr_ptr(zend_object *object, zend_string *member, int type, void **cache_slot); +static zval *date_period_read_property(zend_object *object, zend_string *name, int type, void **cache_slot, zval *rv); +static zval *date_period_write_property(zend_object *object, zend_string *name, zval *value, void **cache_slot); +static zval *date_period_get_property_ptr_ptr(zend_object *object, zend_string *name, int type, void **cache_slot); static int date_object_compare_timezone(zval *tz1, zval *tz2); @@ -688,7 +197,7 @@ zend_module_entry date_module_entry = { NULL, NULL, "date", /* extension name */ - date_functions, /* function list */ + ext_functions, /* function list */ PHP_MINIT(date), /* process startup */ PHP_MSHUTDOWN(date), /* process shutdown */ PHP_RINIT(date), /* request startup */ @@ -1273,14 +782,15 @@ static void php_date(INTERNAL_FUNCTION_PARAMETERS, int localtime) { zend_string *format; zend_long ts; + zend_bool ts_is_null = 1; ZEND_PARSE_PARAMETERS_START(1, 2) Z_PARAM_STR(format) Z_PARAM_OPTIONAL - Z_PARAM_LONG(ts) - ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE); + Z_PARAM_LONG_OR_NULL(ts, ts_is_null) + ZEND_PARSE_PARAMETERS_END(); - if (ZEND_NUM_ARGS() == 1) { + if (ts_is_null) { ts = php_time(); } @@ -1431,21 +941,22 @@ PHP_FUNCTION(gmdate) PHP_FUNCTION(idate) { zend_string *format; - zend_long ts = 0; + zend_long ts; + zend_bool ts_is_null = 1; int ret; ZEND_PARSE_PARAMETERS_START(1, 2) Z_PARAM_STR(format) Z_PARAM_OPTIONAL - Z_PARAM_LONG(ts) - ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE); + Z_PARAM_LONG_OR_NULL(ts, ts_is_null) + ZEND_PARSE_PARAMETERS_END(); if (ZSTR_LEN(format) != 1) { php_error_docref(NULL, E_WARNING, "idate format is one char"); RETURN_FALSE; } - if (ZEND_NUM_ARGS() == 1) { + if (ts_is_null) { ts = php_time(); } @@ -1502,15 +1013,16 @@ PHP_FUNCTION(strtotime) zend_string *times; int error1, error2; timelib_error_container *error; - zend_long preset_ts = 0, ts; + zend_long preset_ts, ts; + zend_bool preset_ts_is_null = 1; timelib_time *t, *now; timelib_tzinfo *tzi; ZEND_PARSE_PARAMETERS_START(1, 2) Z_PARAM_STR(times) Z_PARAM_OPTIONAL - Z_PARAM_LONG(preset_ts) - ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE); + Z_PARAM_LONG_OR_NULL(preset_ts, preset_ts_is_null) + ZEND_PARSE_PARAMETERS_END(); tzi = get_timezone_info(); @@ -1518,7 +1030,7 @@ PHP_FUNCTION(strtotime) now->tz_info = tzi; now->zone_type = TIMELIB_ZONETYPE_ID; timelib_unixtime2local(now, - (ZEND_NUM_ARGS() == 2) ? (timelib_sll) preset_ts : (timelib_sll) php_time()); + !preset_ts_is_null ? (timelib_sll) preset_ts : (timelib_sll) php_time()); t = timelib_strtotime(ZSTR_VAL(times), ZSTR_LEN(times), &error, DATE_TIMEZONEDB, php_date_parse_tzfile_wrapper); @@ -1542,21 +1054,22 @@ PHP_FUNCTION(strtotime) /* {{{ php_mktime - (gm)mktime helper */ PHPAPI void php_mktime(INTERNAL_FUNCTION_PARAMETERS, int gmt) { - zend_long hou = 0, min = 0, sec = 0, mon = 0, day = 0, yea = 0; + zend_long hou, min, sec, mon, day, yea; + zend_bool min_is_null = 1, sec_is_null = 1, mon_is_null = 1, day_is_null = 1, yea_is_null = 1; timelib_time *now; timelib_tzinfo *tzi = NULL; zend_long ts, adjust_seconds = 0; int error; - ZEND_PARSE_PARAMETERS_START(0, 6) - Z_PARAM_OPTIONAL + ZEND_PARSE_PARAMETERS_START(1, 6) Z_PARAM_LONG(hou) - Z_PARAM_LONG(min) - Z_PARAM_LONG(sec) - Z_PARAM_LONG(mon) - Z_PARAM_LONG(day) - Z_PARAM_LONG(yea) - ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE); + Z_PARAM_OPTIONAL + Z_PARAM_LONG_OR_NULL(min, min_is_null) + Z_PARAM_LONG_OR_NULL(sec, sec_is_null) + Z_PARAM_LONG_OR_NULL(mon, mon_is_null) + Z_PARAM_LONG_OR_NULL(day, day_is_null) + Z_PARAM_LONG_OR_NULL(yea, yea_is_null) + ZEND_PARSE_PARAMETERS_END(); /* Initialize structure with current time */ now = timelib_time_ctor(); @@ -1568,36 +1081,34 @@ PHPAPI void php_mktime(INTERNAL_FUNCTION_PARAMETERS, int gmt) now->zone_type = TIMELIB_ZONETYPE_ID; timelib_unixtime2local(now, (timelib_sll) php_time()); } - /* Fill in the new data */ - switch (ZEND_NUM_ARGS()) { - case 7: - /* break intentionally missing */ - case 6: - if (yea >= 0 && yea < 70) { - yea += 2000; - } else if (yea >= 70 && yea <= 100) { - yea += 1900; - } - now->y = yea; - /* break intentionally missing again */ - case 5: - now->d = day; - /* break missing intentionally here too */ - case 4: - now->m = mon; - /* and here */ - case 3: - now->s = sec; - /* yup, this break isn't here on purpose too */ - case 2: - now->i = min; - /* last intentionally missing break */ - case 1: - now->h = hou; - break; - default: - php_error_docref(NULL, E_DEPRECATED, "You should be using the time() function instead"); + + now->h = hou; + + if (!min_is_null) { + now->i = min; + } + + if (!sec_is_null) { + now->s = sec; + } + + if (!mon_is_null) { + now->m = mon; + } + + if (!day_is_null) { + now->d = day; } + + if (!yea_is_null) { + if (yea >= 0 && yea < 70) { + yea += 2000; + } else if (yea >= 70 && yea <= 100) { + yea += 1900; + } + now->y = yea; + } + /* Update the timestamp */ if (gmt) { timelib_update_ts(now, NULL); @@ -1618,7 +1129,7 @@ PHPAPI void php_mktime(INTERNAL_FUNCTION_PARAMETERS, int gmt) } /* }}} */ -/* {{{ proto int mktime([int hour [, int min [, int sec [, int mon [, int day [, int year]]]]]]) +/* {{{ proto int mktime(int hour [, int min [, int sec [, int mon [, int day [, int year]]]]]) Get UNIX timestamp for a date */ PHP_FUNCTION(mktime) { @@ -1626,7 +1137,7 @@ PHP_FUNCTION(mktime) } /* }}} */ -/* {{{ proto int gmmktime([int hour [, int min [, int sec [, int mon [, int day [, int year]]]]]]) +/* {{{ proto int gmmktime(int hour [, int min [, int sec [, int mon [, int day [, int year]]]]]) Get UNIX timestamp for a GMT date */ PHP_FUNCTION(gmmktime) { @@ -1644,7 +1155,7 @@ PHP_FUNCTION(checkdate) Z_PARAM_LONG(m) Z_PARAM_LONG(d) Z_PARAM_LONG(y) - ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE); + ZEND_PARSE_PARAMETERS_END(); if (y < 1 || y > 32767 || !timelib_valid_date(y, m, d)) { RETURN_FALSE; @@ -1657,7 +1168,8 @@ PHP_FUNCTION(checkdate) PHPAPI void php_strftime(INTERNAL_FUNCTION_PARAMETERS, int gmt) { zend_string *format; - zend_long timestamp = 0; + zend_long timestamp; + zend_bool timestamp_is_null = 1; struct tm ta; int max_reallocs = 5; size_t buf_len = 256, real_len; @@ -1666,18 +1178,20 @@ PHPAPI void php_strftime(INTERNAL_FUNCTION_PARAMETERS, int gmt) timelib_time_offset *offset = NULL; zend_string *buf; - timestamp = (zend_long) php_time(); - ZEND_PARSE_PARAMETERS_START(1, 2) Z_PARAM_STR(format) Z_PARAM_OPTIONAL - Z_PARAM_LONG(timestamp) - ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE); + Z_PARAM_LONG_OR_NULL(timestamp, timestamp_is_null) + ZEND_PARSE_PARAMETERS_END(); if (ZSTR_LEN(format) == 0) { RETURN_FALSE; } + if (timestamp_is_null) { + timestamp = (zend_long) php_time(); + } + ts = timelib_time_ctor(); if (gmt) { tzi = NULL; @@ -1769,9 +1283,7 @@ PHP_FUNCTION(gmstrftime) Return current UNIX timestamp */ PHP_FUNCTION(time) { - if (zend_parse_parameters_none() == FAILURE) { - return; - } + ZEND_PARSE_PARAMETERS_NONE(); RETURN_LONG((zend_long)php_time()); } @@ -1782,17 +1294,18 @@ PHP_FUNCTION(time) PHP_FUNCTION(localtime) { zend_long timestamp; + zend_bool timestamp_is_null = 1; zend_bool associative = 0; timelib_tzinfo *tzi; timelib_time *ts; ZEND_PARSE_PARAMETERS_START(0, 2) Z_PARAM_OPTIONAL - Z_PARAM_LONG(timestamp) + Z_PARAM_LONG_OR_NULL(timestamp, timestamp_is_null) Z_PARAM_BOOL(associative) - ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE); + ZEND_PARSE_PARAMETERS_END(); - if (ZEND_NUM_ARGS() == 0) { + if (timestamp_is_null) { timestamp = (zend_long) php_time(); } @@ -1835,15 +1348,16 @@ PHP_FUNCTION(localtime) PHP_FUNCTION(getdate) { zend_long timestamp; + zend_bool timestamp_is_null = 1; timelib_tzinfo *tzi; timelib_time *ts; ZEND_PARSE_PARAMETERS_START(0, 1) Z_PARAM_OPTIONAL - Z_PARAM_LONG(timestamp) - ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE); + Z_PARAM_LONG_OR_NULL(timestamp, timestamp_is_null) + ZEND_PARSE_PARAMETERS_END(); - if (ZEND_NUM_ARGS() == 0) { + if (timestamp_is_null) { timestamp = (zend_long) php_time(); } @@ -2049,35 +1563,21 @@ static int implement_date_interface_handler(zend_class_entry *interface, zend_cl return SUCCESS; } /* }}} */ -static int date_interval_has_property(zval *object, zval *member, int type, void **cache_slot) /* {{{ */ +static int date_interval_has_property(zend_object *object, zend_string *name, int type, void **cache_slot) /* {{{ */ { php_interval_obj *obj; - zval tmp_member; zval rv; zval *prop; int retval = 0; - if (UNEXPECTED(Z_TYPE_P(member) != IS_STRING)) { - zend_string *str = zval_try_get_string_func(member); - if (UNEXPECTED(!str)) { - return 0; - } - ZVAL_STR(&tmp_member, str); - member = &tmp_member; - cache_slot = NULL; - } - - obj = Z_PHPINTERVAL_P(object); + obj = php_interval_obj_from_obj(object); if (!obj->initialized) { - retval = zend_std_has_property(object, member, type, cache_slot); - if (member == &tmp_member) { - zval_ptr_dtor_str(&tmp_member); - } + retval = zend_std_has_property(object, name, type, cache_slot); return retval; } - prop = date_interval_read_property(object, member, BP_VAR_IS, cache_slot, &rv); + prop = date_interval_read_property(object, name, BP_VAR_IS, cache_slot, &rv); if (prop != &EG(uninitialized_zval)) { if (type == 2) { @@ -2088,11 +1588,7 @@ static int date_interval_has_property(zval *object, zval *member, int type, void retval = (Z_TYPE_P(prop) != IS_NULL); } } else { - retval = zend_std_has_property(object, member, type, cache_slot); - } - - if (member == &tmp_member) { - zval_ptr_dtor_str(&tmp_member); + retval = zend_std_has_property(object, name, type, cache_slot); } return retval; @@ -2104,7 +1600,7 @@ static void date_register_classes(void) /* {{{ */ { zend_class_entry ce_date, ce_immutable, ce_timezone, ce_interval, ce_period, ce_interface; - INIT_CLASS_ENTRY(ce_interface, "DateTimeInterface", date_funcs_interface); + INIT_CLASS_ENTRY(ce_interface, "DateTimeInterface", class_DateTimeInterface_methods); date_ce_interface = zend_register_internal_interface(&ce_interface); date_ce_interface->interface_gets_implemented = implement_date_interface_handler; @@ -2125,39 +1621,39 @@ static void date_register_classes(void) /* {{{ */ REGISTER_DATE_INTERFACE_CONST_STRING("RSS", DATE_FORMAT_RFC1123); REGISTER_DATE_INTERFACE_CONST_STRING("W3C", DATE_FORMAT_RFC3339); - INIT_CLASS_ENTRY(ce_date, "DateTime", date_funcs_date); + INIT_CLASS_ENTRY(ce_date, "DateTime", class_DateTime_methods); ce_date.create_object = date_object_new_date; date_ce_date = zend_register_internal_class_ex(&ce_date, NULL); memcpy(&date_object_handlers_date, &std_object_handlers, sizeof(zend_object_handlers)); date_object_handlers_date.offset = XtOffsetOf(php_date_obj, std); date_object_handlers_date.free_obj = date_object_free_storage_date; date_object_handlers_date.clone_obj = date_object_clone_date; - date_object_handlers_date.compare_objects = date_object_compare_date; + date_object_handlers_date.compare = date_object_compare_date; date_object_handlers_date.get_properties_for = date_object_get_properties_for; date_object_handlers_date.get_gc = date_object_get_gc; zend_class_implements(date_ce_date, 1, date_ce_interface); - INIT_CLASS_ENTRY(ce_immutable, "DateTimeImmutable", date_funcs_immutable); + INIT_CLASS_ENTRY(ce_immutable, "DateTimeImmutable", class_DateTimeImmutable_methods); ce_immutable.create_object = date_object_new_date; date_ce_immutable = zend_register_internal_class_ex(&ce_immutable, NULL); memcpy(&date_object_handlers_immutable, &std_object_handlers, sizeof(zend_object_handlers)); date_object_handlers_immutable.clone_obj = date_object_clone_date; - date_object_handlers_immutable.compare_objects = date_object_compare_date; + date_object_handlers_immutable.compare = date_object_compare_date; date_object_handlers_immutable.get_properties_for = date_object_get_properties_for; date_object_handlers_immutable.get_gc = date_object_get_gc; zend_class_implements(date_ce_immutable, 1, date_ce_interface); - INIT_CLASS_ENTRY(ce_timezone, "DateTimeZone", date_funcs_timezone); + INIT_CLASS_ENTRY(ce_timezone, "DateTimeZone", class_DateTimeZone_methods); ce_timezone.create_object = date_object_new_timezone; date_ce_timezone = zend_register_internal_class_ex(&ce_timezone, NULL); memcpy(&date_object_handlers_timezone, &std_object_handlers, sizeof(zend_object_handlers)); date_object_handlers_timezone.offset = XtOffsetOf(php_timezone_obj, std); date_object_handlers_timezone.free_obj = date_object_free_storage_timezone; date_object_handlers_timezone.clone_obj = date_object_clone_timezone; - date_object_handlers_timezone.compare_objects = date_object_compare_timezone; date_object_handlers_timezone.get_properties_for = date_object_get_properties_for_timezone; date_object_handlers_timezone.get_gc = date_object_get_gc_timezone; date_object_handlers_timezone.get_debug_info = date_object_get_debug_info_timezone; + date_object_handlers_timezone.compare = date_object_compare_timezone; #define REGISTER_TIMEZONE_CLASS_CONST_STRING(const_name, value) \ zend_declare_class_constant_long(date_ce_timezone, const_name, sizeof(const_name)-1, value); @@ -2177,7 +1673,7 @@ static void date_register_classes(void) /* {{{ */ REGISTER_TIMEZONE_CLASS_CONST_STRING("ALL_WITH_BC", PHP_DATE_TIMEZONE_GROUP_ALL_W_BC); REGISTER_TIMEZONE_CLASS_CONST_STRING("PER_COUNTRY", PHP_DATE_TIMEZONE_PER_COUNTRY); - INIT_CLASS_ENTRY(ce_interval, "DateInterval", date_funcs_interval); + INIT_CLASS_ENTRY(ce_interval, "DateInterval", class_DateInterval_methods); ce_interval.create_object = date_object_new_interval; date_ce_interval = zend_register_internal_class_ex(&ce_interval, NULL); memcpy(&date_object_handlers_interval, &std_object_handlers, sizeof(zend_object_handlers)); @@ -2190,9 +1686,9 @@ static void date_register_classes(void) /* {{{ */ date_object_handlers_interval.get_properties = date_object_get_properties_interval; date_object_handlers_interval.get_property_ptr_ptr = date_interval_get_property_ptr_ptr; date_object_handlers_interval.get_gc = date_object_get_gc_interval; - date_object_handlers_interval.compare_objects = date_interval_compare_objects; + date_object_handlers_interval.compare = date_interval_compare_objects; - INIT_CLASS_ENTRY(ce_period, "DatePeriod", date_funcs_period); + INIT_CLASS_ENTRY(ce_period, "DatePeriod", class_DatePeriod_methods); ce_period.create_object = date_object_new_period; date_ce_period = zend_register_internal_class_ex(&ce_period, NULL); date_ce_period->get_iterator = date_object_period_get_iterator; @@ -2224,9 +1720,9 @@ static zend_object *date_object_new_date(zend_class_entry *class_type) /* {{{ */ return &intern->std; } /* }}} */ -static zend_object *date_object_clone_date(zval *this_ptr) /* {{{ */ +static zend_object *date_object_clone_date(zend_object *this_ptr) /* {{{ */ { - php_date_obj *old_obj = Z_PHPDATE_P(this_ptr); + php_date_obj *old_obj = php_date_obj_from_obj(this_ptr); php_date_obj *new_obj = php_date_obj_from_obj(date_object_new_date(old_obj->std.ce)); zend_objects_clone_members(&new_obj->std, &old_obj->std); @@ -2249,17 +1745,22 @@ static zend_object *date_object_clone_date(zval *this_ptr) /* {{{ */ static void date_clone_immutable(zval *object, zval *new_object) /* {{{ */ { - ZVAL_OBJ(new_object, date_object_clone_date(object)); + ZVAL_OBJ(new_object, date_object_clone_date(Z_OBJ_P(object))); } /* }}} */ static int date_object_compare_date(zval *d1, zval *d2) /* {{{ */ { - php_date_obj *o1 = Z_PHPDATE_P(d1); - php_date_obj *o2 = Z_PHPDATE_P(d2); + php_date_obj *o1; + php_date_obj *o2; + + ZEND_COMPARE_OBJECTS_FALLBACK(d1, d2); + + o1 = Z_PHPDATE_P(d1); + o2 = Z_PHPDATE_P(d2); if (!o1->time || !o2->time) { php_error_docref(NULL, E_WARNING, "Trying to compare an incomplete DateTime or DateTimeImmutable object"); - return 1; + return ZEND_UNCOMPARABLE; } if (!o1->time->sse_uptodate) { timelib_update_ts(o1->time, o1->time->tz_info); @@ -2271,21 +1772,21 @@ static int date_object_compare_date(zval *d1, zval *d2) /* {{{ */ return timelib_time_compare(o1->time, o2->time); } /* }}} */ -static HashTable *date_object_get_gc(zval *object, zval **table, int *n) /* {{{ */ +static HashTable *date_object_get_gc(zend_object *object, zval **table, int *n) /* {{{ */ { *table = NULL; *n = 0; return zend_std_get_properties(object); } /* }}} */ -static HashTable *date_object_get_gc_timezone(zval *object, zval **table, int *n) /* {{{ */ +static HashTable *date_object_get_gc_timezone(zend_object *object, zval **table, int *n) /* {{{ */ { *table = NULL; *n = 0; return zend_std_get_properties(object); } /* }}} */ -static HashTable *date_object_get_properties_for(zval *object, zend_prop_purpose purpose) /* {{{ */ +static HashTable *date_object_get_properties_for(zend_object *object, zend_prop_purpose purpose) /* {{{ */ { HashTable *props; zval zv; @@ -2302,7 +1803,7 @@ static HashTable *date_object_get_properties_for(zval *object, zend_prop_purpose return zend_std_get_properties_for(object, purpose); } - dateobj = Z_PHPDATE_P(object); + dateobj = php_date_obj_from_obj(object); props = zend_array_dup(zend_std_get_properties(object)); if (!dateobj->time) { return props; @@ -2354,9 +1855,9 @@ static zend_object *date_object_new_timezone(zend_class_entry *class_type) /* {{ return &intern->std; } /* }}} */ -static zend_object *date_object_clone_timezone(zval *this_ptr) /* {{{ */ +static zend_object *date_object_clone_timezone(zend_object *this_ptr) /* {{{ */ { - php_timezone_obj *old_obj = Z_PHPTIMEZONE_P(this_ptr); + php_timezone_obj *old_obj = php_timezone_obj_from_obj(this_ptr); php_timezone_obj *new_obj = php_timezone_obj_from_obj(date_object_new_timezone(old_obj->std.ce)); zend_objects_clone_members(&new_obj->std, &old_obj->std); @@ -2387,6 +1888,8 @@ static int date_object_compare_timezone(zval *tz1, zval *tz2) /* {{{ */ { php_timezone_obj *o1, *o2; + ZEND_COMPARE_OBJECTS_FALLBACK(tz1, tz2); + o1 = Z_PHPTIMEZONE_P(tz1); o2 = Z_PHPTIMEZONE_P(tz2); @@ -2394,7 +1897,7 @@ static int date_object_compare_timezone(zval *tz1, zval *tz2) /* {{{ */ if (o1->type != o2->type) { php_error_docref(NULL, E_WARNING, "Trying to compare different kinds of DateTimeZone objects"); - return 1; + return ZEND_UNCOMPARABLE; } switch (o1->type) { @@ -2432,7 +1935,7 @@ static void php_timezone_to_string(php_timezone_obj *tzobj, zval *zv) } } -static HashTable *date_object_get_properties_for_timezone(zval *object, zend_prop_purpose purpose) /* {{{ */ +static HashTable *date_object_get_properties_for_timezone(zend_object *object, zend_prop_purpose purpose) /* {{{ */ { HashTable *props; zval zv; @@ -2449,7 +1952,7 @@ static HashTable *date_object_get_properties_for_timezone(zval *object, zend_pro return zend_std_get_properties_for(object, purpose); } - tzobj = Z_PHPTIMEZONE_P(object); + tzobj = php_timezone_obj_from_obj(object); props = zend_array_dup(zend_std_get_properties(object)); if (!tzobj->initialized) { return props; @@ -2464,13 +1967,13 @@ static HashTable *date_object_get_properties_for_timezone(zval *object, zend_pro return props; } /* }}} */ -static HashTable *date_object_get_debug_info_timezone(zval *object, int *is_temp) /* {{{ */ +static HashTable *date_object_get_debug_info_timezone(zend_object *object, int *is_temp) /* {{{ */ { HashTable *ht, *props; zval zv; php_timezone_obj *tzobj; - tzobj = Z_PHPTIMEZONE_P(object); + tzobj = php_timezone_obj_from_obj(object); props = zend_std_get_properties(object); *is_temp = 1; @@ -2496,9 +1999,9 @@ static zend_object *date_object_new_interval(zend_class_entry *class_type) /* {{ return &intern->std; } /* }}} */ -static zend_object *date_object_clone_interval(zval *this_ptr) /* {{{ */ +static zend_object *date_object_clone_interval(zend_object *this_ptr) /* {{{ */ { - php_interval_obj *old_obj = Z_PHPINTERVAL_P(this_ptr); + php_interval_obj *old_obj = php_interval_obj_from_obj(this_ptr); php_interval_obj *new_obj = php_interval_obj_from_obj(date_object_new_interval(old_obj->std.ce)); zend_objects_clone_members(&new_obj->std, &old_obj->std); @@ -2510,7 +2013,7 @@ static zend_object *date_object_clone_interval(zval *this_ptr) /* {{{ */ return &new_obj->std; } /* }}} */ -static HashTable *date_object_get_gc_interval(zval *object, zval **table, int *n) /* {{{ */ +static HashTable *date_object_get_gc_interval(zend_object *object, zval **table, int *n) /* {{{ */ { *table = NULL; @@ -2518,13 +2021,13 @@ static HashTable *date_object_get_gc_interval(zval *object, zval **table, int *n return zend_std_get_properties(object); } /* }}} */ -static HashTable *date_object_get_properties_interval(zval *object) /* {{{ */ +static HashTable *date_object_get_properties_interval(zend_object *object) /* {{{ */ { HashTable *props; zval zv; php_interval_obj *intervalobj; - intervalobj = Z_PHPINTERVAL_P(object); + intervalobj = php_interval_obj_from_obj(object); props = zend_std_get_properties(object); if (!intervalobj->initialized) { return props; @@ -2572,9 +2075,9 @@ static zend_object *date_object_new_period(zend_class_entry *class_type) /* {{{ return &intern->std; } /* }}} */ -static zend_object *date_object_clone_period(zval *this_ptr) /* {{{ */ +static zend_object *date_object_clone_period(zend_object *this_ptr) /* {{{ */ { - php_period_obj *old_obj = Z_PHPPERIOD_P(this_ptr); + php_period_obj *old_obj = php_period_obj_from_obj(this_ptr); php_period_obj *new_obj = php_period_obj_from_obj(date_object_new_period(old_obj->std.ce)); zend_objects_clone_members(&new_obj->std, &old_obj->std); @@ -2785,7 +2288,7 @@ PHP_FUNCTION(date_create) Z_PARAM_OPTIONAL Z_PARAM_STRING(time_str, time_str_len) Z_PARAM_OBJECT_OF_CLASS_EX(timezone_object, date_ce_timezone, 1, 0) - ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE); + ZEND_PARSE_PARAMETERS_END(); php_date_instantiate(date_ce_date, return_value); if (!php_date_initialize(Z_PHPDATE_P(return_value), time_str, time_str_len, NULL, timezone_object, 0)) { @@ -2808,7 +2311,7 @@ PHP_FUNCTION(date_create_immutable) Z_PARAM_OPTIONAL Z_PARAM_STRING(time_str, time_str_len) Z_PARAM_OBJECT_OF_CLASS_EX(timezone_object, date_ce_timezone, 1, 0) - ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE); + ZEND_PARSE_PARAMETERS_END(); php_date_instantiate(date_ce_immutable, return_value); if (!php_date_initialize(Z_PHPDATE_P(return_value), time_str, time_str_len, NULL, timezone_object, 0)) { @@ -2832,7 +2335,7 @@ PHP_FUNCTION(date_create_from_format) Z_PARAM_STRING(time_str, time_str_len) Z_PARAM_OPTIONAL Z_PARAM_OBJECT_OF_CLASS_EX(timezone_object, date_ce_timezone, 1, 0) - ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE); + ZEND_PARSE_PARAMETERS_END(); php_date_instantiate(date_ce_date, return_value); if (!php_date_initialize(Z_PHPDATE_P(return_value), time_str, time_str_len, format_str, timezone_object, 0)) { @@ -2856,7 +2359,7 @@ PHP_FUNCTION(date_create_immutable_from_format) Z_PARAM_STRING(time_str, time_str_len) Z_PARAM_OPTIONAL Z_PARAM_OBJECT_OF_CLASS_EX(timezone_object, date_ce_timezone, 1, 0) - ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE); + ZEND_PARSE_PARAMETERS_END(); php_date_instantiate(date_ce_immutable, return_value); if (!php_date_initialize(Z_PHPDATE_P(return_value), time_str, time_str_len, format_str, timezone_object, 0)) { @@ -2876,7 +2379,7 @@ PHP_METHOD(DateTime, __construct) size_t time_str_len = 0; zend_error_handling error_handling; - ZEND_PARSE_PARAMETERS_START_EX(ZEND_PARSE_PARAMS_THROW, 0, 2) + ZEND_PARSE_PARAMETERS_START(0, 2) Z_PARAM_OPTIONAL Z_PARAM_STRING(time_str, time_str_len) Z_PARAM_OBJECT_OF_CLASS_EX(timezone_object, date_ce_timezone, 1, 0) @@ -2898,7 +2401,7 @@ PHP_METHOD(DateTimeImmutable, __construct) size_t time_str_len = 0; zend_error_handling error_handling; - ZEND_PARSE_PARAMETERS_START_EX(ZEND_PARSE_PARAMS_THROW, 0, 2) + ZEND_PARSE_PARAMETERS_START(0, 2) Z_PARAM_OPTIONAL Z_PARAM_STRING(time_str, time_str_len) Z_PARAM_OBJECT_OF_CLASS_EX(timezone_object, date_ce_timezone, 1, 0) @@ -2931,6 +2434,27 @@ PHP_METHOD(DateTime, createFromImmutable) } /* }}} */ +/* {{{ proto DateTime::createFromInterface(DateTimeInterface object) + Creates new DateTime object from an existing DateTimeInterface object. +*/ +PHP_METHOD(DateTime, createFromInterface) +{ + zval *datetimeinterface_object = NULL; + php_date_obj *new_obj = NULL; + php_date_obj *old_obj = NULL; + + ZEND_PARSE_PARAMETERS_START(1, 1) + Z_PARAM_OBJECT_OF_CLASS(datetimeinterface_object, date_ce_interface) + ZEND_PARSE_PARAMETERS_END(); + + php_date_instantiate(date_ce_date, return_value); + old_obj = Z_PHPDATE_P(datetimeinterface_object); + new_obj = Z_PHPDATE_P(return_value); + + new_obj->time = timelib_time_clone(old_obj->time); +} +/* }}} */ + /* {{{ proto DateTimeImmutable::createFromMutable(DateTime object) Creates new DateTimeImmutable object from an existing mutable DateTime object. */ @@ -2952,6 +2476,27 @@ PHP_METHOD(DateTimeImmutable, createFromMutable) } /* }}} */ +/* {{{ proto DateTimeImmutable::createFromInterface(DateTimeInterface object) + Creates new DateTimeImmutable object from an existing DateTimeInterface object. +*/ +PHP_METHOD(DateTimeImmutable, createFromInterface) +{ + zval *datetimeinterface_object = NULL; + php_date_obj *new_obj = NULL; + php_date_obj *old_obj = NULL; + + ZEND_PARSE_PARAMETERS_START(1, 1) + Z_PARAM_OBJECT_OF_CLASS(datetimeinterface_object, date_ce_interface) + ZEND_PARSE_PARAMETERS_END(); + + php_date_instantiate(date_ce_immutable, return_value); + old_obj = Z_PHPDATE_P(datetimeinterface_object); + new_obj = Z_PHPDATE_P(return_value); + + new_obj->time = timelib_time_clone(old_obj->time); +} +/* }}} */ + static int php_date_initialize_from_hash(php_date_obj **dateobj, HashTable *myht) { zval *z_date; @@ -3011,7 +2556,7 @@ PHP_METHOD(DateTime, __set_state) ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ARRAY(array) - ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE); + ZEND_PARSE_PARAMETERS_END(); myht = Z_ARRVAL_P(array); @@ -3033,7 +2578,7 @@ PHP_METHOD(DateTimeImmutable, __set_state) ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ARRAY(array) - ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE); + ZEND_PARSE_PARAMETERS_END(); myht = Z_ARRVAL_P(array); @@ -3053,6 +2598,8 @@ PHP_METHOD(DateTime, __wakeup) php_date_obj *dateobj; HashTable *myht; + ZEND_PARSE_PARAMETERS_NONE(); + dateobj = Z_PHPDATE_P(object); myht = Z_OBJPROP_P(object); @@ -3063,6 +2610,26 @@ PHP_METHOD(DateTime, __wakeup) } /* }}} */ +/* {{{ proto DateTimeImmutable::__wakeup() +*/ +PHP_METHOD(DateTimeImmutable, __wakeup) +{ + zval *object = ZEND_THIS; + php_date_obj *dateobj; + HashTable *myht; + + ZEND_PARSE_PARAMETERS_NONE(); + + dateobj = Z_PHPDATE_P(object); + + myht = Z_OBJPROP_P(object); + + if (!php_date_initialize_from_hash(&dateobj, myht)) { + zend_throw_error(NULL, "Invalid serialization data for DateTimeImmutable object"); + } +} +/* }}} */ + /* Helper function used to add an associative array of warnings and errors to a zval */ static void zval_from_error_container(zval *z, timelib_error_container *error) /* {{{ */ { @@ -3089,6 +2656,8 @@ static void zval_from_error_container(zval *z, timelib_error_container *error) / */ PHP_FUNCTION(date_get_last_errors) { + ZEND_PARSE_PARAMETERS_NONE(); + if (DATEG(last_errors)) { array_init(return_value); zval_from_error_container(return_value, DATEG(last_errors)); @@ -3183,7 +2752,7 @@ PHP_FUNCTION(date_parse) ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_STR(date) - ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE); + ZEND_PARSE_PARAMETERS_END(); parsed_time = timelib_strtotime(ZSTR_VAL(date), ZSTR_LEN(date), &error, DATE_TIMEZONEDB, php_date_parse_tzfile_wrapper); php_date_do_return_parsed_time(INTERNAL_FUNCTION_PARAM_PASSTHRU, parsed_time, error); @@ -3202,7 +2771,7 @@ PHP_FUNCTION(date_parse_from_format) ZEND_PARSE_PARAMETERS_START(2, 2) Z_PARAM_STR(format) Z_PARAM_STR(date) - ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE); + ZEND_PARSE_PARAMETERS_END(); parsed_time = timelib_parse_from_format(ZSTR_VAL(format), ZSTR_VAL(date), ZSTR_LEN(date), &error, DATE_TIMEZONEDB, php_date_parse_tzfile_wrapper); php_date_do_return_parsed_time(INTERNAL_FUNCTION_PARAM_PASSTHRU, parsed_time, error); @@ -3220,7 +2789,7 @@ PHP_FUNCTION(date_format) size_t format_len; if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "Os", &object, date_ce_interface, &format, &format_len) == FAILURE) { - RETURN_FALSE; + RETURN_THROWS(); } dateobj = Z_PHPDATE_P(object); DATE_CHECK_INITIALIZED(dateobj->time, DateTime); @@ -3306,7 +2875,7 @@ PHP_FUNCTION(date_modify) size_t modify_len; if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "Os", &object, date_ce_date, &modify, &modify_len) == FAILURE) { - RETURN_FALSE; + RETURN_THROWS(); } if (!php_date_modify(object, modify, modify_len)) { @@ -3328,7 +2897,7 @@ PHP_METHOD(DateTimeImmutable, modify) object = ZEND_THIS; if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", &modify, &modify_len) == FAILURE) { - RETURN_FALSE; + RETURN_THROWS(); } date_clone_immutable(object, &new_object); @@ -3365,7 +2934,7 @@ PHP_FUNCTION(date_add) zval *object, *interval; if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "OO", &object, date_ce_date, &interval, date_ce_interval) == FAILURE) { - RETURN_FALSE; + RETURN_THROWS(); } php_date_add(object, interval, return_value); @@ -3383,7 +2952,7 @@ PHP_METHOD(DateTimeImmutable, add) object = ZEND_THIS; if (zend_parse_parameters(ZEND_NUM_ARGS(), "O", &interval, date_ce_interval) == FAILURE) { - RETURN_FALSE; + RETURN_THROWS(); } date_clone_immutable(object, &new_object); @@ -3422,7 +2991,7 @@ PHP_FUNCTION(date_sub) zval *object, *interval; if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "OO", &object, date_ce_date, &interval, date_ce_interval) == FAILURE) { - RETURN_FALSE; + RETURN_THROWS(); } php_date_sub(object, interval, return_value); @@ -3440,7 +3009,7 @@ PHP_METHOD(DateTimeImmutable, sub) object = ZEND_THIS; if (zend_parse_parameters(ZEND_NUM_ARGS(), "O", &interval, date_ce_interval) == FAILURE) { - RETURN_FALSE; + RETURN_THROWS(); } date_clone_immutable(object, &new_object); @@ -3479,7 +3048,7 @@ PHP_FUNCTION(date_timezone_get) php_date_obj *dateobj; if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "O", &object, date_ce_interface) == FAILURE) { - RETURN_FALSE; + RETURN_THROWS(); } dateobj = Z_PHPDATE_P(object); DATE_CHECK_INITIALIZED(dateobj->time, DateTime); @@ -3526,7 +3095,7 @@ PHP_FUNCTION(date_timezone_set) zval *timezone_object; if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "OO", &object, date_ce_date, &timezone_object, date_ce_timezone) == FAILURE) { - RETURN_FALSE; + RETURN_THROWS(); } php_date_timezone_set(object, timezone_object, return_value); @@ -3545,7 +3114,7 @@ PHP_METHOD(DateTimeImmutable, setTimezone) object = ZEND_THIS; if (zend_parse_parameters(ZEND_NUM_ARGS(), "O", &timezone_object, date_ce_timezone) == FAILURE) { - RETURN_FALSE; + RETURN_THROWS(); } date_clone_immutable(object, &new_object); @@ -3565,7 +3134,7 @@ PHP_FUNCTION(date_offset_get) timelib_time_offset *offset; if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "O", &object, date_ce_interface) == FAILURE) { - RETURN_FALSE; + RETURN_THROWS(); } dateobj = Z_PHPDATE_P(object); DATE_CHECK_INITIALIZED(dateobj->time, DateTime); @@ -3613,7 +3182,7 @@ PHP_FUNCTION(date_time_set) zend_long h, i, s = 0, ms = 0; if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "Oll|ll", &object, date_ce_date, &h, &i, &s, &ms) == FAILURE) { - RETURN_FALSE; + RETURN_THROWS(); } php_date_time_set(object, h, i, s, ms, return_value); @@ -3632,7 +3201,7 @@ PHP_METHOD(DateTimeImmutable, setTime) object = ZEND_THIS; if (zend_parse_parameters(ZEND_NUM_ARGS(), "ll|ll", &h, &i, &s, &ms) == FAILURE) { - RETURN_FALSE; + RETURN_THROWS(); } date_clone_immutable(object, &new_object); @@ -3663,7 +3232,7 @@ PHP_FUNCTION(date_date_set) zend_long y, m, d; if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "Olll", &object, date_ce_date, &y, &m, &d) == FAILURE) { - RETURN_FALSE; + RETURN_THROWS(); } php_date_date_set(object, y, m, d, return_value); @@ -3682,7 +3251,7 @@ PHP_METHOD(DateTimeImmutable, setDate) object = ZEND_THIS; if (zend_parse_parameters(ZEND_NUM_ARGS(), "lll", &y, &m, &d) == FAILURE) { - RETURN_FALSE; + RETURN_THROWS(); } date_clone_immutable(object, &new_object); @@ -3717,7 +3286,7 @@ PHP_FUNCTION(date_isodate_set) zend_long y, w, d = 1; if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "Oll|l", &object, date_ce_date, &y, &w, &d) == FAILURE) { - RETURN_FALSE; + RETURN_THROWS(); } php_date_isodate_set(object, y, w, d, return_value); @@ -3736,7 +3305,7 @@ PHP_METHOD(DateTimeImmutable, setISODate) object = ZEND_THIS; if (zend_parse_parameters(ZEND_NUM_ARGS(), "ll|l", &y, &w, &d) == FAILURE) { - RETURN_FALSE; + RETURN_THROWS(); } date_clone_immutable(object, &new_object); @@ -3766,7 +3335,7 @@ PHP_FUNCTION(date_timestamp_set) zend_long timestamp; if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "Ol", &object, date_ce_date, ×tamp) == FAILURE) { - RETURN_FALSE; + RETURN_THROWS(); } php_date_timestamp_set(object, timestamp, return_value); @@ -3785,7 +3354,7 @@ PHP_METHOD(DateTimeImmutable, setTimestamp) object = ZEND_THIS; if (zend_parse_parameters(ZEND_NUM_ARGS(), "l", ×tamp) == FAILURE) { - RETURN_FALSE; + RETURN_THROWS(); } date_clone_immutable(object, &new_object); @@ -3806,7 +3375,7 @@ PHP_FUNCTION(date_timestamp_get) int error; if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "O", &object, date_ce_interface) == FAILURE) { - RETURN_FALSE; + RETURN_THROWS(); } dateobj = Z_PHPDATE_P(object); DATE_CHECK_INITIALIZED(dateobj->time, DateTime); @@ -3832,7 +3401,7 @@ PHP_FUNCTION(date_diff) zend_bool absolute = 0; if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "OO|b", &object1, date_ce_interface, &object2, date_ce_interface, &absolute) == FAILURE) { - RETURN_FALSE; + RETURN_THROWS(); } dateobj1 = Z_PHPDATE_P(object1); dateobj2 = Z_PHPDATE_P(object2); @@ -3886,7 +3455,7 @@ PHP_FUNCTION(timezone_open) ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_STR(tz) - ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE); + ZEND_PARSE_PARAMETERS_END(); tzobj = Z_PHPTIMEZONE_P(php_date_instantiate(date_ce_timezone, return_value)); if (SUCCESS != timezone_initialize(tzobj, ZSTR_VAL(tz), ZSTR_LEN(tz))) { @@ -3905,7 +3474,7 @@ PHP_METHOD(DateTimeZone, __construct) php_timezone_obj *tzobj; zend_error_handling error_handling; - ZEND_PARSE_PARAMETERS_START_EX(ZEND_PARSE_PARAMS_THROW, 1, 1) + ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_STR(tz) ZEND_PARSE_PARAMETERS_END(); @@ -3969,6 +3538,8 @@ PHP_METHOD(DateTimeZone, __wakeup) php_timezone_obj *tzobj; HashTable *myht; + ZEND_PARSE_PARAMETERS_NONE(); + tzobj = Z_PHPTIMEZONE_P(object); myht = Z_OBJPROP_P(object); @@ -3988,7 +3559,7 @@ PHP_FUNCTION(timezone_name_get) php_timezone_obj *tzobj; if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "O", &object, date_ce_timezone) == FAILURE) { - RETURN_FALSE; + RETURN_THROWS(); } tzobj = Z_PHPTIMEZONE_P(object); DATE_CHECK_INITIALIZED(tzobj->initialized, DateTimeZone); @@ -4011,7 +3582,7 @@ PHP_FUNCTION(timezone_name_from_abbr) Z_PARAM_OPTIONAL Z_PARAM_LONG(gmtoffset) Z_PARAM_LONG(isdst) - ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE); + ZEND_PARSE_PARAMETERS_END(); tzid = timelib_timezone_id_from_abbr(ZSTR_VAL(abbr), gmtoffset, isdst); @@ -4034,7 +3605,7 @@ PHP_FUNCTION(timezone_offset_get) timelib_time_offset *offset; if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "OO", &object, date_ce_timezone, &dateobject, date_ce_interface) == FAILURE) { - RETURN_FALSE; + RETURN_THROWS(); } tzobj = Z_PHPTIMEZONE_P(object); DATE_CHECK_INITIALIZED(tzobj->initialized, DateTimeZone); @@ -4068,7 +3639,7 @@ PHP_FUNCTION(timezone_transitions_get) zend_long timestamp_begin = ZEND_LONG_MIN, timestamp_end = ZEND_LONG_MAX; if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "O|ll", &object, date_ce_timezone, ×tamp_begin, ×tamp_end) == FAILURE) { - RETURN_FALSE; + RETURN_THROWS(); } tzobj = Z_PHPTIMEZONE_P(object); DATE_CHECK_INITIALIZED(tzobj->initialized, DateTimeZone); @@ -4147,7 +3718,7 @@ PHP_FUNCTION(timezone_location_get) php_timezone_obj *tzobj; if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "O", &object, date_ce_timezone) == FAILURE) { - RETURN_FALSE; + RETURN_THROWS(); } tzobj = Z_PHPTIMEZONE_P(object); DATE_CHECK_INITIALIZED(tzobj->initialized, DateTimeZone); @@ -4176,6 +3747,9 @@ static int date_interval_initialize(timelib_rel_time **rt, /*const*/ char *forma if (errors->error_count > 0) { php_error_docref(NULL, E_WARNING, "Unknown or bad format (%s)", format); retval = FAILURE; + if (p) { + timelib_rel_time_dtor(p); + } } else { if(p) { *rt = p; @@ -4199,46 +3773,33 @@ static int date_interval_initialize(timelib_rel_time **rt, /*const*/ char *forma } /* }}} */ static int date_interval_compare_objects(zval *o1, zval *o2) { + ZEND_COMPARE_OBJECTS_FALLBACK(o1, o2); /* There is no well defined way to compare intervals like P1M and P30D, which may compare * smaller, equal or greater depending on the point in time at which the interval starts. As * such, we treat DateInterval objects are non-comparable and emit a warning. */ zend_error(E_WARNING, "Cannot compare DateInterval objects"); - return 1; + return ZEND_UNCOMPARABLE; } /* {{{ date_interval_read_property */ -static zval *date_interval_read_property(zval *object, zval *member, int type, void **cache_slot, zval *rv) +static zval *date_interval_read_property(zend_object *object, zend_string *name, int type, void **cache_slot, zval *rv) { php_interval_obj *obj; zval *retval; - zval tmp_member; timelib_sll value = -1; double fvalue = -1; - if (Z_TYPE_P(member) != IS_STRING) { - zend_string *str = zval_try_get_string_func(member); - if (UNEXPECTED(!str)) { - return &EG(uninitialized_zval); - } - ZVAL_STR(&tmp_member, str); - member = &tmp_member; - cache_slot = NULL; - } - - obj = Z_PHPINTERVAL_P(object); + obj = php_interval_obj_from_obj(object); if (!obj->initialized) { - retval = zend_std_read_property(object, member, type, cache_slot, rv); - if (member == &tmp_member) { - zval_ptr_dtor_str(&tmp_member); - } + retval = zend_std_read_property(object, name, type, cache_slot, rv); return retval; } #define GET_VALUE_FROM_STRUCT(n,m) \ - if (strcmp(Z_STRVAL_P(member), m) == 0) { \ - value = obj->diff->n; \ - break; \ + if (strcmp(ZSTR_VAL(name), m) == 0) { \ + value = obj->diff->n; \ + break; \ } do { GET_VALUE_FROM_STRUCT(y, "y"); @@ -4247,18 +3808,14 @@ static zval *date_interval_read_property(zval *object, zval *member, int type, v GET_VALUE_FROM_STRUCT(h, "h"); GET_VALUE_FROM_STRUCT(i, "i"); GET_VALUE_FROM_STRUCT(s, "s"); - if (strcmp(Z_STRVAL_P(member), "f") == 0) { + if (strcmp(ZSTR_VAL(name), "f") == 0) { fvalue = obj->diff->us / 1000000.0; break; } GET_VALUE_FROM_STRUCT(invert, "invert"); GET_VALUE_FROM_STRUCT(days, "days"); /* didn't find any */ - retval = zend_std_read_property(object, member, type, cache_slot, rv); - - if (member == &tmp_member) { - zval_ptr_dtor_str(&tmp_member); - } + retval = zend_std_read_property(object, name, type, cache_slot, rv); return retval; } while(0); @@ -4273,42 +3830,23 @@ static zval *date_interval_read_property(zval *object, zval *member, int type, v ZVAL_FALSE(retval); } - if (member == &tmp_member) { - zval_ptr_dtor_str(&tmp_member); - } - return retval; } /* }}} */ /* {{{ date_interval_write_property */ -static zval *date_interval_write_property(zval *object, zval *member, zval *value, void **cache_slot) +static zval *date_interval_write_property(zend_object *object, zend_string *name, zval *value, void **cache_slot) { php_interval_obj *obj; - zval tmp_member; - - if (Z_TYPE_P(member) != IS_STRING) { - zend_string *str = zval_try_get_string_func(member); - if (UNEXPECTED(!str)) { - return value; - } - ZVAL_STR(&tmp_member, str); - member = &tmp_member; - cache_slot = NULL; - } - obj = Z_PHPINTERVAL_P(object); + obj = php_interval_obj_from_obj(object); if (!obj->initialized) { - value = zend_std_write_property(object, member, value, cache_slot); - if (member == &tmp_member) { - zval_ptr_dtor_str(&tmp_member); - } - return value; + return zend_std_write_property(object, name, value, cache_slot); } -#define SET_VALUE_FROM_STRUCT(n,m) \ - if (strcmp(Z_STRVAL_P(member), m) == 0) { \ +#define SET_VALUE_FROM_STRUCT(n,m) \ + if (strcmp(ZSTR_VAL(name), m) == 0) { \ obj->diff->n = zval_get_long(value); \ break; \ } @@ -4320,55 +3858,37 @@ static zval *date_interval_write_property(zval *object, zval *member, zval *valu SET_VALUE_FROM_STRUCT(h, "h"); SET_VALUE_FROM_STRUCT(i, "i"); SET_VALUE_FROM_STRUCT(s, "s"); - if (strcmp(Z_STRVAL_P(member), "f") == 0) { + if (strcmp(ZSTR_VAL(name), "f") == 0) { obj->diff->us = zval_get_double(value) * 1000000; break; } SET_VALUE_FROM_STRUCT(invert, "invert"); /* didn't find any */ - value = zend_std_write_property(object, member, value, cache_slot); + value = zend_std_write_property(object, name, value, cache_slot); } while(0); - if (member == &tmp_member) { - zval_ptr_dtor_str(&tmp_member); - } - return value; } /* }}} */ /* {{{ date_interval_get_property_ptr_ptr */ -static zval *date_interval_get_property_ptr_ptr(zval *object, zval *member, int type, void **cache_slot) -{ - zval tmp_member, *ret; - - if (Z_TYPE_P(member) != IS_STRING) { - zend_string *str = zval_try_get_string_func(member); - if (UNEXPECTED(!str)) { - return NULL; - } - ZVAL_STR(&tmp_member, str); - member = &tmp_member; - cache_slot = NULL; - } - - if(zend_binary_strcmp("y", sizeof("y") - 1, Z_STRVAL_P(member), Z_STRLEN_P(member)) == 0 || - zend_binary_strcmp("m", sizeof("m") - 1, Z_STRVAL_P(member), Z_STRLEN_P(member)) == 0 || - zend_binary_strcmp("d", sizeof("d") - 1, Z_STRVAL_P(member), Z_STRLEN_P(member)) == 0 || - zend_binary_strcmp("h", sizeof("h") - 1, Z_STRVAL_P(member), Z_STRLEN_P(member)) == 0 || - zend_binary_strcmp("i", sizeof("i") - 1, Z_STRVAL_P(member), Z_STRLEN_P(member)) == 0 || - zend_binary_strcmp("s", sizeof("s") - 1, Z_STRVAL_P(member), Z_STRLEN_P(member)) == 0 || - zend_binary_strcmp("f", sizeof("f") - 1, Z_STRVAL_P(member), Z_STRLEN_P(member)) == 0 || - zend_binary_strcmp("days", sizeof("days") - 1, Z_STRVAL_P(member), Z_STRLEN_P(member)) == 0 || - zend_binary_strcmp("invert", sizeof("invert") - 1, Z_STRVAL_P(member), Z_STRLEN_P(member)) == 0) { +static zval *date_interval_get_property_ptr_ptr(zend_object *object, zend_string *name, int type, void **cache_slot) +{ + zval *ret; + + if(zend_binary_strcmp("y", sizeof("y") - 1, ZSTR_VAL(name), ZSTR_LEN(name)) == 0 || + zend_binary_strcmp("m", sizeof("m") - 1, ZSTR_VAL(name), ZSTR_LEN(name)) == 0 || + zend_binary_strcmp("d", sizeof("d") - 1, ZSTR_VAL(name), ZSTR_LEN(name)) == 0 || + zend_binary_strcmp("h", sizeof("h") - 1, ZSTR_VAL(name), ZSTR_LEN(name)) == 0 || + zend_binary_strcmp("i", sizeof("i") - 1, ZSTR_VAL(name), ZSTR_LEN(name)) == 0 || + zend_binary_strcmp("s", sizeof("s") - 1, ZSTR_VAL(name), ZSTR_LEN(name)) == 0 || + zend_binary_strcmp("f", sizeof("f") - 1, ZSTR_VAL(name), ZSTR_LEN(name)) == 0 || + zend_binary_strcmp("days", sizeof("days") - 1, ZSTR_VAL(name), ZSTR_LEN(name)) == 0 || + zend_binary_strcmp("invert", sizeof("invert") - 1, ZSTR_VAL(name), ZSTR_LEN(name)) == 0) { /* Fallback to read_property. */ ret = NULL; } else { - ret = zend_std_get_property_ptr_ptr(object, member, type, cache_slot); - } - - if (member == &tmp_member) { - zval_ptr_dtor_str(&tmp_member); + ret = zend_std_get_property_ptr_ptr(object, name, type, cache_slot); } return ret; @@ -4384,7 +3904,7 @@ PHP_METHOD(DateInterval, __construct) timelib_rel_time *reltime; zend_error_handling error_handling; - ZEND_PARSE_PARAMETERS_START_EX(ZEND_PARSE_PARAMS_THROW, 1, 1) + ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_STR(interval_string) ZEND_PARSE_PARAMETERS_END(); @@ -4490,7 +4010,7 @@ PHP_METHOD(DateInterval, __set_state) ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ARRAY(array) - ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE); + ZEND_PARSE_PARAMETERS_END(); myht = Z_ARRVAL_P(array); @@ -4508,6 +4028,8 @@ PHP_METHOD(DateInterval, __wakeup) php_interval_obj *intobj; HashTable *myht; + ZEND_PARSE_PARAMETERS_NONE(); + intobj = Z_PHPINTERVAL_P(object); myht = Z_OBJPROP_P(object); @@ -4528,7 +4050,7 @@ PHP_FUNCTION(date_interval_create_from_date_string) ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_STR(time_str) - ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE); + ZEND_PARSE_PARAMETERS_END(); time = timelib_strtotime(ZSTR_VAL(time_str), ZSTR_LEN(time_str), &err, DATE_TIMEZONEDB, php_date_parse_tzfile_wrapper); @@ -4631,7 +4153,7 @@ PHP_FUNCTION(date_interval_format) size_t format_len; if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "Os", &object, date_ce_interval, &format, &format_len) == FAILURE) { - RETURN_FALSE; + RETURN_THROWS(); } diobj = Z_PHPINTERVAL_P(object); DATE_CHECK_INITIALIZED(diobj->initialized, DateInterval); @@ -4653,6 +4175,9 @@ static int date_period_initialize(timelib_time **st, timelib_time **et, timelib_ if (errors->error_count > 0) { php_error_docref(NULL, E_WARNING, "Unknown or bad format (%s)", format); retval = FAILURE; + if (p) { + timelib_rel_time_dtor(p); + } } else { *st = b; *et = e; @@ -4763,13 +4288,11 @@ PHP_METHOD(DatePeriod, getStartDate) php_period_obj *dpobj; php_date_obj *dateobj; - if (zend_parse_parameters_none() == FAILURE) { - return; - } + ZEND_PARSE_PARAMETERS_NONE(); dpobj = Z_PHPPERIOD_P(ZEND_THIS); - php_date_instantiate(dpobj->start_ce, return_value); + php_date_instantiate(dpobj->start_ce, return_value); dateobj = Z_PHPDATE_P(return_value); dateobj->time = timelib_time_ctor(); *dateobj->time = *dpobj->start; @@ -4790,9 +4313,7 @@ PHP_METHOD(DatePeriod, getEndDate) php_period_obj *dpobj; php_date_obj *dateobj; - if (zend_parse_parameters_none() == FAILURE) { - return; - } + ZEND_PARSE_PARAMETERS_NONE(); dpobj = Z_PHPPERIOD_P(ZEND_THIS); @@ -4821,9 +4342,7 @@ PHP_METHOD(DatePeriod, getDateInterval) php_period_obj *dpobj; php_interval_obj *diobj; - if (zend_parse_parameters_none() == FAILURE) { - return; - } + ZEND_PARSE_PARAMETERS_NONE(); dpobj = Z_PHPPERIOD_P(ZEND_THIS); @@ -4841,14 +4360,12 @@ PHP_METHOD(DatePeriod, getRecurrences) { php_period_obj *dpobj; - if (zend_parse_parameters_none() == FAILURE) { - return; - } + ZEND_PARSE_PARAMETERS_NONE(); dpobj = Z_PHPPERIOD_P(ZEND_THIS); if (0 == dpobj->recurrences - dpobj->include_start_date) { - return; + return; } RETURN_LONG(dpobj->recurrences - dpobj->include_start_date); @@ -4886,8 +4403,8 @@ PHP_FUNCTION(timezone_identifiers_list) ZEND_PARSE_PARAMETERS_START(0, 2) Z_PARAM_OPTIONAL Z_PARAM_LONG(what) - Z_PARAM_STRING_EX(option, option_len, 1, 0) - ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE); + Z_PARAM_STRING_OR_NULL(option, option_len) + ZEND_PARSE_PARAMETERS_END(); /* Extra validation */ if (what == PHP_DATE_TIMEZONE_PER_COUNTRY && option_len != 2) { @@ -4912,13 +4429,15 @@ PHP_FUNCTION(timezone_identifiers_list) } /* }}} */ -/* {{{ proto array timezone_version_get() +/* {{{ proto string timezone_version_get() Returns the Olson database version number. */ PHP_FUNCTION(timezone_version_get) { const timelib_tzdb *tzdb; + ZEND_PARSE_PARAMETERS_NONE(); + tzdb = DATE_TIMEZONEDB; RETURN_STRING(tzdb->version); } @@ -4932,6 +4451,8 @@ PHP_FUNCTION(timezone_abbreviations_list) const timelib_tz_lookup_table *table, *entry; zval element, *abbr_array_p, abbr_array; + ZEND_PARSE_PARAMETERS_NONE(); + table = timelib_timezone_abbreviations_list(); array_init(return_value); entry = table; @@ -4968,7 +4489,7 @@ PHP_FUNCTION(date_default_timezone_set) ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_STRING(zone, zone_len) - ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE); + ZEND_PARSE_PARAMETERS_END(); if (!timelib_timezone_id_is_valid(zone, DATE_TIMEZONEDB)) { php_error_docref(NULL, E_NOTICE, "Timezone ID '%s' is invalid", zone); @@ -4988,9 +4509,7 @@ PHP_FUNCTION(date_default_timezone_set) PHP_FUNCTION(date_default_timezone_get) { timelib_tzinfo *default_tz; - if (zend_parse_parameters_none() == FAILURE) { - return; - } + ZEND_PARSE_PARAMETERS_NONE(); default_tz = get_timezone_info(); RETVAL_STRING(default_tz->name); @@ -5002,10 +4521,11 @@ PHP_FUNCTION(date_default_timezone_get) */ static void php_do_date_sunrise_sunset(INTERNAL_FUNCTION_PARAMETERS, int calc_sunset) { - double latitude = 0.0, longitude = 0.0, zenith = 0.0, gmt_offset = 0, altitude; + double latitude, longitude, zenith, gmt_offset, altitude; + zend_bool latitude_is_null = 1, longitude_is_null = 1, zenith_is_null = 1, gmt_offset_is_null = 1; double h_rise, h_set, N; timelib_sll rise, set, transit; - zend_long time, retformat = 0; + zend_long time, retformat = SUNFUNCS_RET_STRING; int rs; timelib_time *t; timelib_tzinfo *tzi; @@ -5015,33 +4535,28 @@ static void php_do_date_sunrise_sunset(INTERNAL_FUNCTION_PARAMETERS, int calc_su Z_PARAM_LONG(time) Z_PARAM_OPTIONAL Z_PARAM_LONG(retformat) - Z_PARAM_DOUBLE(latitude) - Z_PARAM_DOUBLE(longitude) - Z_PARAM_DOUBLE(zenith) - Z_PARAM_DOUBLE(gmt_offset) - ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE); - - switch (ZEND_NUM_ARGS()) { - case 1: - retformat = SUNFUNCS_RET_STRING; - case 2: - latitude = INI_FLT("date.default_latitude"); - case 3: - longitude = INI_FLT("date.default_longitude"); - case 4: - if (calc_sunset) { - zenith = INI_FLT("date.sunset_zenith"); - } else { - zenith = INI_FLT("date.sunrise_zenith"); - } - case 5: - case 6: - break; - default: - php_error_docref(NULL, E_WARNING, "invalid format"); - RETURN_FALSE; - break; + Z_PARAM_DOUBLE_OR_NULL(latitude, latitude_is_null) + Z_PARAM_DOUBLE_OR_NULL(longitude, longitude_is_null) + Z_PARAM_DOUBLE_OR_NULL(zenith, zenith_is_null) + Z_PARAM_DOUBLE_OR_NULL(gmt_offset, gmt_offset_is_null) + ZEND_PARSE_PARAMETERS_END(); + + if (latitude_is_null) { + latitude = INI_FLT("date.default_latitude"); + } + + if (longitude_is_null) { + latitude = INI_FLT("date.default_longitude"); } + + if (zenith_is_null) { + if (calc_sunset) { + zenith = INI_FLT("date.sunset_zenith"); + } else { + zenith = INI_FLT("date.sunrise_zenith"); + } + } + if (retformat != SUNFUNCS_RET_TIMESTAMP && retformat != SUNFUNCS_RET_STRING && retformat != SUNFUNCS_RET_DOUBLE) @@ -5057,7 +4572,7 @@ static void php_do_date_sunrise_sunset(INTERNAL_FUNCTION_PARAMETERS, int calc_su t->tz_info = tzi; t->zone_type = TIMELIB_ZONETYPE_ID; - if (ZEND_NUM_ARGS() <= 5) { + if (gmt_offset_is_null) { gmt_offset = timelib_get_current_offset(t) / 3600; } @@ -5123,7 +4638,7 @@ PHP_FUNCTION(date_sun_info) Z_PARAM_LONG(time) Z_PARAM_DOUBLE(latitude) Z_PARAM_DOUBLE(longitude) - ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE); + ZEND_PARSE_PARAMETERS_END(); /* Initialize time struct */ t = timelib_time_ctor(); @@ -5137,7 +4652,7 @@ PHP_FUNCTION(date_sun_info) array_init(return_value); /* Get sun up/down and transit */ - rs = timelib_astro_rise_set_altitude(t, longitude, latitude, -35.0/60, 1, &ddummy, &ddummy, &rise, &set, &transit); + rs = timelib_astro_rise_set_altitude(t, longitude, latitude, -50.0/60, 1, &ddummy, &ddummy, &rise, &set, &transit); switch (rs) { case -1: /* always below */ add_assoc_bool(return_value, "sunrise", 0); @@ -5214,20 +4729,20 @@ PHP_FUNCTION(date_sun_info) } /* }}} */ -static HashTable *date_object_get_gc_period(zval *object, zval **table, int *n) /* {{{ */ +static HashTable *date_object_get_gc_period(zend_object *object, zval **table, int *n) /* {{{ */ { *table = NULL; *n = 0; return zend_std_get_properties(object); } /* }}} */ -static HashTable *date_object_get_properties_period(zval *object) /* {{{ */ +static HashTable *date_object_get_properties_period(zend_object *object) /* {{{ */ { HashTable *props; zval zv; php_period_obj *period_obj; - period_obj = Z_PHPPERIOD_P(object); + period_obj = php_period_obj_from_obj(object); props = zend_std_get_properties(object); if (!period_obj->start) { return props; @@ -5374,7 +4889,7 @@ PHP_METHOD(DatePeriod, __set_state) ZEND_PARSE_PARAMETERS_START(1, 1) Z_PARAM_ARRAY(array) - ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE); + ZEND_PARSE_PARAMETERS_END(); myht = Z_ARRVAL_P(array); @@ -5394,6 +4909,8 @@ PHP_METHOD(DatePeriod, __wakeup) php_period_obj *period_obj; HashTable *myht; + ZEND_PARSE_PARAMETERS_NONE(); + period_obj = Z_PHPPERIOD_P(object); myht = Z_OBJPROP_P(object); @@ -5423,50 +4940,41 @@ static int date_period_is_magic_property(zend_string *name) /* }}} */ /* {{{ date_period_read_property */ -static zval *date_period_read_property(zval *object, zval *member, int type, void **cache_slot, zval *rv) +static zval *date_period_read_property(zend_object *object, zend_string *name, int type, void **cache_slot, zval *rv) { if (type != BP_VAR_IS && type != BP_VAR_R) { - zend_string *name = zval_get_string(member); if (date_period_is_magic_property(name)) { zend_throw_error(NULL, "Retrieval of DatePeriod->%s for modification is unsupported", ZSTR_VAL(name)); - zend_string_release(name); return &EG(uninitialized_zval); } - zend_string_release(name); } - Z_OBJPROP_P(object); /* build properties hash table */ + object->handlers->get_properties(object); /* build properties hash table */ - return zend_std_read_property(object, member, type, cache_slot, rv); + return zend_std_read_property(object, name, type, cache_slot, rv); } /* }}} */ /* {{{ date_period_write_property */ -static zval *date_period_write_property(zval *object, zval *member, zval *value, void **cache_slot) +static zval *date_period_write_property(zend_object *object, zend_string *name, zval *value, void **cache_slot) { - zend_string *name = zval_get_string(member); if (date_period_is_magic_property(name)) { zend_throw_error(NULL, "Writing to DatePeriod->%s is unsupported", ZSTR_VAL(name)); - zend_string_release(name); return value; } - zend_string_release(name); - return zend_std_write_property(object, member, value, cache_slot); + return zend_std_write_property(object, name, value, cache_slot); } /* }}} */ /* {{{ date_period_get_property_ptr_ptr */ -static zval *date_period_get_property_ptr_ptr(zval *object, zval *member, int type, void **cache_slot) +static zval *date_period_get_property_ptr_ptr(zend_object *object, zend_string *name, int type, void **cache_slot) { - zend_string *name = zval_get_string(member); if (date_period_is_magic_property(name)) { zend_throw_error(NULL, "Retrieval of DatePeriod->%s for modification is unsupported", ZSTR_VAL(name)); - zend_string_release(name); return &EG(error_zval); } - zend_string_release(name); - return zend_std_get_property_ptr_ptr(object, member, type, cache_slot); + return zend_std_get_property_ptr_ptr(object, name, type, cache_slot); } /* }}} */ diff --git a/ext/date/php_date.h b/ext/date/php_date.h index 009be83a3f..871114c44b 100644 --- a/ext/date/php_date.h +++ b/ext/date/php_date.h @@ -1,7 +1,5 @@ /* +----------------------------------------------------------------------+ - | PHP Version 7 | - +----------------------------------------------------------------------+ | Copyright (c) The PHP Group | +----------------------------------------------------------------------+ | This source file is subject to version 3.01 of the PHP license, | @@ -28,96 +26,6 @@ extern zend_module_entry date_module_entry; #define phpext_date_ptr &date_module_entry -PHP_FUNCTION(date); -PHP_FUNCTION(idate); -PHP_FUNCTION(gmdate); -PHP_FUNCTION(strtotime); - -PHP_FUNCTION(mktime); -PHP_FUNCTION(gmmktime); - -PHP_FUNCTION(checkdate); -PHP_FUNCTION(strftime); -PHP_FUNCTION(gmstrftime); -PHP_FUNCTION(time); -PHP_FUNCTION(localtime); -PHP_FUNCTION(getdate); - -/* Advanced Interface */ -PHP_METHOD(DateTime, __construct); -PHP_METHOD(DateTime, __wakeup); -PHP_METHOD(DateTime, __set_state); -PHP_METHOD(DateTime, createFromImmutable); -PHP_FUNCTION(date_create); -PHP_FUNCTION(date_create_immutable); -PHP_FUNCTION(date_create_from_format); -PHP_FUNCTION(date_create_immutable_from_format); -PHP_FUNCTION(date_parse); -PHP_FUNCTION(date_parse_from_format); -PHP_FUNCTION(date_get_last_errors); -PHP_FUNCTION(date_format); -PHP_FUNCTION(date_modify); -PHP_FUNCTION(date_add); -PHP_FUNCTION(date_sub); -PHP_FUNCTION(date_timezone_get); -PHP_FUNCTION(date_timezone_set); -PHP_FUNCTION(date_offset_get); -PHP_FUNCTION(date_diff); - -PHP_FUNCTION(date_time_set); -PHP_FUNCTION(date_date_set); -PHP_FUNCTION(date_isodate_set); -PHP_FUNCTION(date_timestamp_set); -PHP_FUNCTION(date_timestamp_get); - -PHP_METHOD(DateTimeImmutable, __construct); -PHP_METHOD(DateTimeImmutable, __set_state); -PHP_METHOD(DateTimeImmutable, modify); -PHP_METHOD(DateTimeImmutable, add); -PHP_METHOD(DateTimeImmutable, sub); -PHP_METHOD(DateTimeImmutable, setTimezone); -PHP_METHOD(DateTimeImmutable, setTime); -PHP_METHOD(DateTimeImmutable, setDate); -PHP_METHOD(DateTimeImmutable, setISODate); -PHP_METHOD(DateTimeImmutable, setTimestamp); -PHP_METHOD(DateTimeImmutable, createFromMutable); - -PHP_METHOD(DateTimeZone, __construct); -PHP_METHOD(DateTimeZone, __wakeup); -PHP_METHOD(DateTimeZone, __set_state); -PHP_FUNCTION(timezone_open); -PHP_FUNCTION(timezone_name_get); -PHP_FUNCTION(timezone_name_from_abbr); -PHP_FUNCTION(timezone_offset_get); -PHP_FUNCTION(timezone_transitions_get); -PHP_FUNCTION(timezone_location_get); -PHP_FUNCTION(timezone_identifiers_list); -PHP_FUNCTION(timezone_abbreviations_list); -PHP_FUNCTION(timezone_version_get); - -PHP_METHOD(DateInterval, __construct); -PHP_METHOD(DateInterval, __wakeup); -PHP_METHOD(DateInterval, __set_state); -PHP_FUNCTION(date_interval_format); -PHP_FUNCTION(date_interval_create_from_date_string); - -PHP_METHOD(DatePeriod, __construct); -PHP_METHOD(DatePeriod, __wakeup); -PHP_METHOD(DatePeriod, __set_state); -PHP_METHOD(DatePeriod, getStartDate); -PHP_METHOD(DatePeriod, getEndDate); -PHP_METHOD(DatePeriod, getDateInterval); -PHP_METHOD(DatePeriod, getRecurrences); - -/* Options and Configuration */ -PHP_FUNCTION(date_default_timezone_set); -PHP_FUNCTION(date_default_timezone_get); - -/* Astro functions */ -PHP_FUNCTION(date_sunrise); -PHP_FUNCTION(date_sunset); -PHP_FUNCTION(date_sun_info); - PHP_RINIT_FUNCTION(date); PHP_RSHUTDOWN_FUNCTION(date); PHP_MINIT_FUNCTION(date); diff --git a/ext/date/php_date.stub.php b/ext/date/php_date.stub.php new file mode 100644 index 0000000000..f360eeee0a --- /dev/null +++ b/ext/date/php_date.stub.php @@ -0,0 +1,415 @@ +<?php + +/** @generate-function-entries */ + +function strtotime(string $time, ?int $now = null): int|false {} + +function date(string $format, ?int $timestamp = null): string {} + +function idate(string $format, ?int $timestamp = null): int|false {} + +function gmdate(string $format, ?int $timestamp = null): string {} + +function mktime( + int $hour, ?int $min = null, ?int $sec = null, + ?int $mon = null, ?int $day = null, ?int $year = null): int|false {} + +function gmmktime( + int $hour, ?int $min = null, ?int $sec = null, + ?int $mon = null, ?int $day = null, ?int $year = null): int|false {} + +function checkdate(int $m, int $d, int $y): bool {} + +function strftime(string $format, ?int $timestamp = null): string|false {} + +function gmstrftime(string $format, ?int $timestamp = null): string|false {} + +function time(): int {} + +function localtime(?int $timestamp = null, bool $associative = false): array {} + +function getdate(?int $timestamp = null): array {} + +function date_create(string $time = "now", ?DateTimeZone $timezone = null): DateTime|false {} + +function date_create_immutable( + string $time = "now", ?DateTimeZone $timezone = null): DateTimeImmutable|false {} + +function date_create_from_format( + string $format, string $time, ?DateTimeZone $timezone = null): DateTime|false {} + +function date_create_immutable_from_format( + string $format, string $time, ?DateTimeZone $timezone = null): DateTimeImmutable|false {} + +function date_parse(string $date): array {} + +function date_parse_from_format(string $format, string $date): array {} + +function date_get_last_errors(): array|false {} + +function date_format(DateTimeInterface $object, string $format): string {} + +function date_modify(DateTime $object, string $modify): DateTime|false {} + +function date_add(DateTime $object, DateInterval $interval): DateTime {} + +function date_sub(DateTime $object, DateInterval $interval): DateTime {} + +function date_timezone_get(DateTimeInterface $object): DateTimeZone|false {} + +function date_timezone_set(DateTimeInterface $object, DateTimeZone $timezone): DateTime {} + +function date_offset_get(DateTimeInterface $object): int {} + +function date_diff( + DateTimeInterface $object, DateTimeInterface $object2, bool $absolute = false): DateInterval {} + +function date_time_set( + DateTime $object, int $hour, int $minute, int $second = 0, int $microseconds = 0): DateTime {} + +function date_date_set(DateTime $object, int $year, int $month, int $day): DateTime {} + +function date_isodate_set(DateTime $object, int $year, int $week, int $day = 1): DateTime {} + +function date_timestamp_set(DateTime $object, int $timestamp): DateTime {} + +function date_timestamp_get(DateTimeInterface $object): int|false {} + +function timezone_open(string $timezone): DateTimeZone|false {} + +function timezone_name_get(DateTimeZone $object): string {} + +function timezone_name_from_abbr(string $abbr, int $gmtoffset = -1, int $isdst = -1): string|false {} + +function timezone_offset_get(DateTimeZone $object, DateTimeInterface $datetime): int {} + +function timezone_transitions_get( + DateTimeZone $object, int $timestamp_begin = PHP_INT_MIN, int $timestamp_end = PHP_INT_MAX): array|false {} + +function timezone_location_get(DateTimeZone $object): array|false {} + +function timezone_identifiers_list(int $what = DateTimeZone::ALL, ?string $country = null): array|false {} + +function timezone_abbreviations_list(): array {} + +function timezone_version_get(): string {} + +function date_interval_create_from_date_string(string $time): DateInterval|false {} + +function date_interval_format(DateInterval $object, string $format): string {} + +function date_default_timezone_set(string $timezone_identifier): bool {} + +function date_default_timezone_get(): string {} + +function date_sunrise( + int $time, int $retformat = SUNFUNCS_RET_STRING, + ?float $latitude = null, ?float $longitude = null, ?float $zenith = null, + float $gmt_offset = 0): string|int|float|false {} + +function date_sunset( + int $time, int $retformat = SUNFUNCS_RET_STRING, + ?float $latitude = null, ?float $longitude = null, ?float $zenith = null, + float $gmt_offset = 0): string|int|float|false {} + +function date_sun_info(int $time, float $latitude, float $longitude): array {} + +// NB: Adding return types to methods is a BC break! +// For now only using @return annotations here. + +interface DateTimeInterface +{ + /** @return string */ + public function format(string $format); + + /** @return DateTimeZone|false */ + public function getTimezone(); + + /** @return int|false */ + public function getOffset(); + + /** @return int|false */ + public function getTimestamp(); + + /** @return DateInterval|false */ + public function diff(DateTimeInterface $object, bool $absolute = false); + + public function __wakeup(); +} + +class DateTime implements DateTimeInterface +{ + public function __construct(string $time = "now", ?DateTimeZone $timezone = null) {} + + public function __wakeup() {} + + /** @return DateTime */ + public static function __set_state(array $array) {} + + /** @return DateTime */ + public static function createFromImmutable(DateTimeImmutable $object) {} + + public static function createFromInterface(DateTimeInterface $object): DateTime {} + + /** + * @return DateTime|false + * @alias date_create_from_format + */ + public static function createFromFormat(string $format, string $time, ?DateTimeZone $timezone = null) {} + + /** + * @return array|false + * @alias date_get_last_errors + */ + public static function getLastErrors() {} + + /** + * @return string + * @alias date_format + */ + public function format(string $format) {} + + /** + * @return DateTime|false + * @alias date_modify + */ + public function modify(string $modify) {} + + /** + * @return DateTime + * @alias date_add + */ + public function add(DateInterval $interval) {} + + /** + * @return DateTime + * @alias date_sub + */ + public function sub(DateInterval $interval) {} + + /** + * @return DateTimeZone|false + * @alias date_timezone_get + */ + public function getTimezone() {} + + /** + * @return DateTime + * @alias date_timezone_set + */ + public function setTimezone(DateTimeZone $timezone) {} + + /** + * @return int|false + * @alias date_offset_get + */ + public function getOffset() {} + + /** + * @return DateTime + * @alias date_time_set + */ + public function setTime(int $hour, int $minute, int $second = 0, int $microseconds = 0) {} + + /** + * @return DateTime + * @alias date_date_set + */ + public function setDate(int $year, int $month, int $day) {} + + /** + * @return DateTime + * @alias date_isodate_set + */ + public function setISODate(int $year, int $week, int $day = 1) {} + + /** + * @return DateTime + * @alias date_timestamp_set + */ + public function setTimestamp(int $timestamp) {} + + /** + * @return int|false + * @alias date_timestamp_get + */ + public function getTimestamp() {} + + /** + * @return DateInterval|false + * @alias date_diff + */ + public function diff(DateTimeInterface $object, bool $absolute = false) {} +} + +class DateTimeImmutable implements DateTimeInterface +{ + public function __construct(string $time = "now", ?DateTimeZone $timezone = null) {} + + public function __wakeup() {} + + /** @return DateTimeZone */ + public static function __set_state(array $array) {} + + /** + * @return DateTimeImmutable|false + * @alias date_create_immutable_from_format + */ + public static function createFromFormat(string $format, string $time, ?DateTimeZone $timezone = null) {} + + /** + * @return array|false + * @alias date_get_last_errors + */ + public static function getLastErrors() {} + + /** + * @return string + * @alias date_format + */ + public function format(string $format) {} + + /** + * @return DateTimeZone|false + * @alias date_timezone_get + */ + public function getTimezone() {} + + /** + * @return int|false + * @alias date_offset_get + */ + public function getOffset() {} + + /** + * @return int|false + * @alias date_timestamp_get + */ + public function getTimestamp() {} + + /** + * @return DateInterval|false + * @alias date_diff + */ + public function diff(DateTimeInterface $object, bool $absolute = false) {} + + /** @return DateTimeImmutable|false */ + public function modify(string $modify) {} + + /** @return DateTimeImmutable */ + public function add(DateInterval $interval) {} + + /** @return DateTimeImmutable */ + public function sub(DateInterval $interval) {} + + /** @return DateTimeImmutable */ + public function setTimezone(DateTimeZone $timezone) {} + + /** @return DateTimeImmutable */ + public function setTime(int $hour, int $minute, int $second = 0, int $microseconds = 0) {} + + /** @return DateTimeImmutable */ + public function setDate(int $year, int $month, int $day) {} + + /** @return DateTimeImmutable */ + public function setISODate(int $year, int $week, int $day = 1) {} + + /** @return DateTimeImmutable */ + public function setTimestamp(int $timestamp) {} + + /** @return DateTimeImmutable */ + public static function createFromMutable(DateTime $object) {} + + public static function createFromInterface(DateTimeInterface $object): DateTimeImmutable {} +} + +class DateTimeZone +{ + public function __construct(string $timezone) {} + + /** + * @return string + * @alias timezone_name_get + */ + public function getName() {} + + /** + * @return int + * @alias timezone_offset_get + */ + public function getOffset(DateTimeInterface $datetime) {} + + /** + * @return array|false + * @alias timezone_transitions_get + */ + public function getTransitions(int $timestamp_begin = PHP_INT_MIN, int $timestamp_end = PHP_INT_MAX) {} + + /** + * @return array|false + * @alias timezone_location_get + */ + public function getLocation() {} + + /** + * @return array + * @alias timezone_abbreviations_list + */ + public static function listAbbreviations() {} + + /** + * @return array|false + * @alias timezone_identifiers_list + */ + public static function listIdentifiers(int $what = DateTimeZone::ALL, ?string $country = null) {} + + public function __wakeup() {} + + /** @return DateTimeZone */ + public static function __set_state(array $array) {} +} + +class DateInterval +{ + public function __construct(string $interval_spec) {} + + /** + * @return DateInterval|false + * @alias date_interval_create_from_date_string + */ + public static function createFromDateString(string $time) {} + + /** + * @return string + * @alias date_interval_format + */ + public function format(string $format) {} + + public function __wakeup() {} + + /** @return DateInterval */ + public static function __set_state(array $array) {} +} + +class DatePeriod implements Traversable +{ + /* Has an overloaded signature */ + public function __construct($start, $interval = UNKNOWN, $end = UNKNOWN) {} + + /** @return DateTimeInterface */ + public function getStartDate() {} + + /** @return DateTimeInterface|null */ + public function getEndDate() {} + + /** @return DateInterval */ + public function getDateInterval() {} + + /** @return int|null */ + public function getRecurrences() {} + + public function __wakeup() {} + + /** @return DatePeriod */ + public static function __set_state(array $array) {} +} diff --git a/ext/date/php_date_arginfo.h b/ext/date/php_date_arginfo.h new file mode 100644 index 0000000000..e3fa982811 --- /dev/null +++ b/ext/date/php_date_arginfo.h @@ -0,0 +1,654 @@ +/* This is a generated file, edit the .stub.php file instead. */ + +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_strtotime, 0, 1, MAY_BE_LONG|MAY_BE_FALSE) + ZEND_ARG_TYPE_INFO(0, time, IS_STRING, 0) + ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, now, IS_LONG, 1, "null") +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_date, 0, 1, IS_STRING, 0) + ZEND_ARG_TYPE_INFO(0, format, IS_STRING, 0) + ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, timestamp, IS_LONG, 1, "null") +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_idate, 0, 1, MAY_BE_LONG|MAY_BE_FALSE) + ZEND_ARG_TYPE_INFO(0, format, IS_STRING, 0) + ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, timestamp, IS_LONG, 1, "null") +ZEND_END_ARG_INFO() + +#define arginfo_gmdate arginfo_date + +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_mktime, 0, 1, MAY_BE_LONG|MAY_BE_FALSE) + ZEND_ARG_TYPE_INFO(0, hour, IS_LONG, 0) + ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, min, IS_LONG, 1, "null") + ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, sec, IS_LONG, 1, "null") + ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, mon, IS_LONG, 1, "null") + ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, day, IS_LONG, 1, "null") + ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, year, IS_LONG, 1, "null") +ZEND_END_ARG_INFO() + +#define arginfo_gmmktime arginfo_mktime + +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_checkdate, 0, 3, _IS_BOOL, 0) + ZEND_ARG_TYPE_INFO(0, m, IS_LONG, 0) + ZEND_ARG_TYPE_INFO(0, d, IS_LONG, 0) + ZEND_ARG_TYPE_INFO(0, y, IS_LONG, 0) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_strftime, 0, 1, MAY_BE_STRING|MAY_BE_FALSE) + ZEND_ARG_TYPE_INFO(0, format, IS_STRING, 0) + ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, timestamp, IS_LONG, 1, "null") +ZEND_END_ARG_INFO() + +#define arginfo_gmstrftime arginfo_strftime + +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_time, 0, 0, IS_LONG, 0) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_localtime, 0, 0, IS_ARRAY, 0) + ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, timestamp, IS_LONG, 1, "null") + ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, associative, _IS_BOOL, 0, "false") +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_getdate, 0, 0, IS_ARRAY, 0) + ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, timestamp, IS_LONG, 1, "null") +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_WITH_RETURN_OBJ_TYPE_MASK_EX(arginfo_date_create, 0, 0, DateTime, MAY_BE_FALSE) + ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, time, IS_STRING, 0, "\"now\"") + ZEND_ARG_OBJ_INFO_WITH_DEFAULT_VALUE(0, timezone, DateTimeZone, 1, "null") +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_WITH_RETURN_OBJ_TYPE_MASK_EX(arginfo_date_create_immutable, 0, 0, DateTimeImmutable, MAY_BE_FALSE) + ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, time, IS_STRING, 0, "\"now\"") + ZEND_ARG_OBJ_INFO_WITH_DEFAULT_VALUE(0, timezone, DateTimeZone, 1, "null") +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_WITH_RETURN_OBJ_TYPE_MASK_EX(arginfo_date_create_from_format, 0, 2, DateTime, MAY_BE_FALSE) + ZEND_ARG_TYPE_INFO(0, format, IS_STRING, 0) + ZEND_ARG_TYPE_INFO(0, time, IS_STRING, 0) + ZEND_ARG_OBJ_INFO_WITH_DEFAULT_VALUE(0, timezone, DateTimeZone, 1, "null") +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_WITH_RETURN_OBJ_TYPE_MASK_EX(arginfo_date_create_immutable_from_format, 0, 2, DateTimeImmutable, MAY_BE_FALSE) + ZEND_ARG_TYPE_INFO(0, format, IS_STRING, 0) + ZEND_ARG_TYPE_INFO(0, time, IS_STRING, 0) + ZEND_ARG_OBJ_INFO_WITH_DEFAULT_VALUE(0, timezone, DateTimeZone, 1, "null") +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_date_parse, 0, 1, IS_ARRAY, 0) + ZEND_ARG_TYPE_INFO(0, date, IS_STRING, 0) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_date_parse_from_format, 0, 2, IS_ARRAY, 0) + ZEND_ARG_TYPE_INFO(0, format, IS_STRING, 0) + ZEND_ARG_TYPE_INFO(0, date, IS_STRING, 0) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_date_get_last_errors, 0, 0, MAY_BE_ARRAY|MAY_BE_FALSE) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_date_format, 0, 2, IS_STRING, 0) + ZEND_ARG_OBJ_INFO(0, object, DateTimeInterface, 0) + ZEND_ARG_TYPE_INFO(0, format, IS_STRING, 0) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_WITH_RETURN_OBJ_TYPE_MASK_EX(arginfo_date_modify, 0, 2, DateTime, MAY_BE_FALSE) + ZEND_ARG_OBJ_INFO(0, object, DateTime, 0) + ZEND_ARG_TYPE_INFO(0, modify, IS_STRING, 0) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_date_add, 0, 2, DateTime, 0) + ZEND_ARG_OBJ_INFO(0, object, DateTime, 0) + ZEND_ARG_OBJ_INFO(0, interval, DateInterval, 0) +ZEND_END_ARG_INFO() + +#define arginfo_date_sub arginfo_date_add + +ZEND_BEGIN_ARG_WITH_RETURN_OBJ_TYPE_MASK_EX(arginfo_date_timezone_get, 0, 1, DateTimeZone, MAY_BE_FALSE) + ZEND_ARG_OBJ_INFO(0, object, DateTimeInterface, 0) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_date_timezone_set, 0, 2, DateTime, 0) + ZEND_ARG_OBJ_INFO(0, object, DateTimeInterface, 0) + ZEND_ARG_OBJ_INFO(0, timezone, DateTimeZone, 0) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_date_offset_get, 0, 1, IS_LONG, 0) + ZEND_ARG_OBJ_INFO(0, object, DateTimeInterface, 0) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_date_diff, 0, 2, DateInterval, 0) + ZEND_ARG_OBJ_INFO(0, object, DateTimeInterface, 0) + ZEND_ARG_OBJ_INFO(0, object2, DateTimeInterface, 0) + ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, absolute, _IS_BOOL, 0, "false") +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_date_time_set, 0, 3, DateTime, 0) + ZEND_ARG_OBJ_INFO(0, object, DateTime, 0) + ZEND_ARG_TYPE_INFO(0, hour, IS_LONG, 0) + ZEND_ARG_TYPE_INFO(0, minute, IS_LONG, 0) + ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, second, IS_LONG, 0, "0") + ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, microseconds, IS_LONG, 0, "0") +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_date_date_set, 0, 4, DateTime, 0) + ZEND_ARG_OBJ_INFO(0, object, DateTime, 0) + ZEND_ARG_TYPE_INFO(0, year, IS_LONG, 0) + ZEND_ARG_TYPE_INFO(0, month, IS_LONG, 0) + ZEND_ARG_TYPE_INFO(0, day, IS_LONG, 0) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_date_isodate_set, 0, 3, DateTime, 0) + ZEND_ARG_OBJ_INFO(0, object, DateTime, 0) + ZEND_ARG_TYPE_INFO(0, year, IS_LONG, 0) + ZEND_ARG_TYPE_INFO(0, week, IS_LONG, 0) + ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, day, IS_LONG, 0, "1") +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_date_timestamp_set, 0, 2, DateTime, 0) + ZEND_ARG_OBJ_INFO(0, object, DateTime, 0) + ZEND_ARG_TYPE_INFO(0, timestamp, IS_LONG, 0) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_date_timestamp_get, 0, 1, MAY_BE_LONG|MAY_BE_FALSE) + ZEND_ARG_OBJ_INFO(0, object, DateTimeInterface, 0) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_WITH_RETURN_OBJ_TYPE_MASK_EX(arginfo_timezone_open, 0, 1, DateTimeZone, MAY_BE_FALSE) + ZEND_ARG_TYPE_INFO(0, timezone, IS_STRING, 0) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_timezone_name_get, 0, 1, IS_STRING, 0) + ZEND_ARG_OBJ_INFO(0, object, DateTimeZone, 0) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_timezone_name_from_abbr, 0, 1, MAY_BE_STRING|MAY_BE_FALSE) + ZEND_ARG_TYPE_INFO(0, abbr, IS_STRING, 0) + ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, gmtoffset, IS_LONG, 0, "-1") + ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, isdst, IS_LONG, 0, "-1") +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_timezone_offset_get, 0, 2, IS_LONG, 0) + ZEND_ARG_OBJ_INFO(0, object, DateTimeZone, 0) + ZEND_ARG_OBJ_INFO(0, datetime, DateTimeInterface, 0) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_timezone_transitions_get, 0, 1, MAY_BE_ARRAY|MAY_BE_FALSE) + ZEND_ARG_OBJ_INFO(0, object, DateTimeZone, 0) + ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, timestamp_begin, IS_LONG, 0, "PHP_INT_MIN") + ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, timestamp_end, IS_LONG, 0, "PHP_INT_MAX") +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_timezone_location_get, 0, 1, MAY_BE_ARRAY|MAY_BE_FALSE) + ZEND_ARG_OBJ_INFO(0, object, DateTimeZone, 0) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_timezone_identifiers_list, 0, 0, MAY_BE_ARRAY|MAY_BE_FALSE) + ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, what, IS_LONG, 0, "DateTimeZone::ALL") + ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, country, IS_STRING, 1, "null") +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_timezone_abbreviations_list, 0, 0, IS_ARRAY, 0) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_timezone_version_get, 0, 0, IS_STRING, 0) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_WITH_RETURN_OBJ_TYPE_MASK_EX(arginfo_date_interval_create_from_date_string, 0, 1, DateInterval, MAY_BE_FALSE) + ZEND_ARG_TYPE_INFO(0, time, IS_STRING, 0) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_date_interval_format, 0, 2, IS_STRING, 0) + ZEND_ARG_OBJ_INFO(0, object, DateInterval, 0) + ZEND_ARG_TYPE_INFO(0, format, IS_STRING, 0) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_date_default_timezone_set, 0, 1, _IS_BOOL, 0) + ZEND_ARG_TYPE_INFO(0, timezone_identifier, IS_STRING, 0) +ZEND_END_ARG_INFO() + +#define arginfo_date_default_timezone_get arginfo_timezone_version_get + +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_date_sunrise, 0, 1, MAY_BE_STRING|MAY_BE_LONG|MAY_BE_DOUBLE|MAY_BE_FALSE) + ZEND_ARG_TYPE_INFO(0, time, IS_LONG, 0) + ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, retformat, IS_LONG, 0, "SUNFUNCS_RET_STRING") + ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, latitude, IS_DOUBLE, 1, "null") + ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, longitude, IS_DOUBLE, 1, "null") + ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, zenith, IS_DOUBLE, 1, "null") + ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, gmt_offset, IS_DOUBLE, 0, "0") +ZEND_END_ARG_INFO() + +#define arginfo_date_sunset arginfo_date_sunrise + +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_date_sun_info, 0, 3, IS_ARRAY, 0) + ZEND_ARG_TYPE_INFO(0, time, IS_LONG, 0) + ZEND_ARG_TYPE_INFO(0, latitude, IS_DOUBLE, 0) + ZEND_ARG_TYPE_INFO(0, longitude, IS_DOUBLE, 0) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO_EX(arginfo_class_DateTimeInterface_format, 0, 0, 1) + ZEND_ARG_TYPE_INFO(0, format, IS_STRING, 0) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO_EX(arginfo_class_DateTimeInterface_getTimezone, 0, 0, 0) +ZEND_END_ARG_INFO() + +#define arginfo_class_DateTimeInterface_getOffset arginfo_class_DateTimeInterface_getTimezone + +#define arginfo_class_DateTimeInterface_getTimestamp arginfo_class_DateTimeInterface_getTimezone + +ZEND_BEGIN_ARG_INFO_EX(arginfo_class_DateTimeInterface_diff, 0, 0, 1) + ZEND_ARG_OBJ_INFO(0, object, DateTimeInterface, 0) + ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, absolute, _IS_BOOL, 0, "false") +ZEND_END_ARG_INFO() + +#define arginfo_class_DateTimeInterface___wakeup arginfo_class_DateTimeInterface_getTimezone + +ZEND_BEGIN_ARG_INFO_EX(arginfo_class_DateTime___construct, 0, 0, 0) + ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, time, IS_STRING, 0, "\"now\"") + ZEND_ARG_OBJ_INFO_WITH_DEFAULT_VALUE(0, timezone, DateTimeZone, 1, "null") +ZEND_END_ARG_INFO() + +#define arginfo_class_DateTime___wakeup arginfo_class_DateTimeInterface_getTimezone + +ZEND_BEGIN_ARG_INFO_EX(arginfo_class_DateTime___set_state, 0, 0, 1) + ZEND_ARG_TYPE_INFO(0, array, IS_ARRAY, 0) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO_EX(arginfo_class_DateTime_createFromImmutable, 0, 0, 1) + ZEND_ARG_OBJ_INFO(0, object, DateTimeImmutable, 0) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_class_DateTime_createFromInterface, 0, 1, DateTime, 0) + ZEND_ARG_OBJ_INFO(0, object, DateTimeInterface, 0) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO_EX(arginfo_class_DateTime_createFromFormat, 0, 0, 2) + ZEND_ARG_TYPE_INFO(0, format, IS_STRING, 0) + ZEND_ARG_TYPE_INFO(0, time, IS_STRING, 0) + ZEND_ARG_OBJ_INFO_WITH_DEFAULT_VALUE(0, timezone, DateTimeZone, 1, "null") +ZEND_END_ARG_INFO() + +#define arginfo_class_DateTime_getLastErrors arginfo_class_DateTimeInterface_getTimezone + +#define arginfo_class_DateTime_format arginfo_class_DateTimeInterface_format + +ZEND_BEGIN_ARG_INFO_EX(arginfo_class_DateTime_modify, 0, 0, 1) + ZEND_ARG_TYPE_INFO(0, modify, IS_STRING, 0) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO_EX(arginfo_class_DateTime_add, 0, 0, 1) + ZEND_ARG_OBJ_INFO(0, interval, DateInterval, 0) +ZEND_END_ARG_INFO() + +#define arginfo_class_DateTime_sub arginfo_class_DateTime_add + +#define arginfo_class_DateTime_getTimezone arginfo_class_DateTimeInterface_getTimezone + +ZEND_BEGIN_ARG_INFO_EX(arginfo_class_DateTime_setTimezone, 0, 0, 1) + ZEND_ARG_OBJ_INFO(0, timezone, DateTimeZone, 0) +ZEND_END_ARG_INFO() + +#define arginfo_class_DateTime_getOffset arginfo_class_DateTimeInterface_getTimezone + +ZEND_BEGIN_ARG_INFO_EX(arginfo_class_DateTime_setTime, 0, 0, 2) + ZEND_ARG_TYPE_INFO(0, hour, IS_LONG, 0) + ZEND_ARG_TYPE_INFO(0, minute, IS_LONG, 0) + ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, second, IS_LONG, 0, "0") + ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, microseconds, IS_LONG, 0, "0") +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO_EX(arginfo_class_DateTime_setDate, 0, 0, 3) + ZEND_ARG_TYPE_INFO(0, year, IS_LONG, 0) + ZEND_ARG_TYPE_INFO(0, month, IS_LONG, 0) + ZEND_ARG_TYPE_INFO(0, day, IS_LONG, 0) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO_EX(arginfo_class_DateTime_setISODate, 0, 0, 2) + ZEND_ARG_TYPE_INFO(0, year, IS_LONG, 0) + ZEND_ARG_TYPE_INFO(0, week, IS_LONG, 0) + ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, day, IS_LONG, 0, "1") +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO_EX(arginfo_class_DateTime_setTimestamp, 0, 0, 1) + ZEND_ARG_TYPE_INFO(0, timestamp, IS_LONG, 0) +ZEND_END_ARG_INFO() + +#define arginfo_class_DateTime_getTimestamp arginfo_class_DateTimeInterface_getTimezone + +#define arginfo_class_DateTime_diff arginfo_class_DateTimeInterface_diff + +#define arginfo_class_DateTimeImmutable___construct arginfo_class_DateTime___construct + +#define arginfo_class_DateTimeImmutable___wakeup arginfo_class_DateTimeInterface_getTimezone + +#define arginfo_class_DateTimeImmutable___set_state arginfo_class_DateTime___set_state + +#define arginfo_class_DateTimeImmutable_createFromFormat arginfo_class_DateTime_createFromFormat + +#define arginfo_class_DateTimeImmutable_getLastErrors arginfo_class_DateTimeInterface_getTimezone + +#define arginfo_class_DateTimeImmutable_format arginfo_class_DateTimeInterface_format + +#define arginfo_class_DateTimeImmutable_getTimezone arginfo_class_DateTimeInterface_getTimezone + +#define arginfo_class_DateTimeImmutable_getOffset arginfo_class_DateTimeInterface_getTimezone + +#define arginfo_class_DateTimeImmutable_getTimestamp arginfo_class_DateTimeInterface_getTimezone + +#define arginfo_class_DateTimeImmutable_diff arginfo_class_DateTimeInterface_diff + +#define arginfo_class_DateTimeImmutable_modify arginfo_class_DateTime_modify + +#define arginfo_class_DateTimeImmutable_add arginfo_class_DateTime_add + +#define arginfo_class_DateTimeImmutable_sub arginfo_class_DateTime_add + +#define arginfo_class_DateTimeImmutable_setTimezone arginfo_class_DateTime_setTimezone + +#define arginfo_class_DateTimeImmutable_setTime arginfo_class_DateTime_setTime + +#define arginfo_class_DateTimeImmutable_setDate arginfo_class_DateTime_setDate + +#define arginfo_class_DateTimeImmutable_setISODate arginfo_class_DateTime_setISODate + +#define arginfo_class_DateTimeImmutable_setTimestamp arginfo_class_DateTime_setTimestamp + +ZEND_BEGIN_ARG_INFO_EX(arginfo_class_DateTimeImmutable_createFromMutable, 0, 0, 1) + ZEND_ARG_OBJ_INFO(0, object, DateTime, 0) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_class_DateTimeImmutable_createFromInterface, 0, 1, DateTimeImmutable, 0) + ZEND_ARG_OBJ_INFO(0, object, DateTimeInterface, 0) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO_EX(arginfo_class_DateTimeZone___construct, 0, 0, 1) + ZEND_ARG_TYPE_INFO(0, timezone, IS_STRING, 0) +ZEND_END_ARG_INFO() + +#define arginfo_class_DateTimeZone_getName arginfo_class_DateTimeInterface_getTimezone + +ZEND_BEGIN_ARG_INFO_EX(arginfo_class_DateTimeZone_getOffset, 0, 0, 1) + ZEND_ARG_OBJ_INFO(0, datetime, DateTimeInterface, 0) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO_EX(arginfo_class_DateTimeZone_getTransitions, 0, 0, 0) + ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, timestamp_begin, IS_LONG, 0, "PHP_INT_MIN") + ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, timestamp_end, IS_LONG, 0, "PHP_INT_MAX") +ZEND_END_ARG_INFO() + +#define arginfo_class_DateTimeZone_getLocation arginfo_class_DateTimeInterface_getTimezone + +#define arginfo_class_DateTimeZone_listAbbreviations arginfo_class_DateTimeInterface_getTimezone + +ZEND_BEGIN_ARG_INFO_EX(arginfo_class_DateTimeZone_listIdentifiers, 0, 0, 0) + ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, what, IS_LONG, 0, "DateTimeZone::ALL") + ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, country, IS_STRING, 1, "null") +ZEND_END_ARG_INFO() + +#define arginfo_class_DateTimeZone___wakeup arginfo_class_DateTimeInterface_getTimezone + +#define arginfo_class_DateTimeZone___set_state arginfo_class_DateTime___set_state + +ZEND_BEGIN_ARG_INFO_EX(arginfo_class_DateInterval___construct, 0, 0, 1) + ZEND_ARG_TYPE_INFO(0, interval_spec, IS_STRING, 0) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO_EX(arginfo_class_DateInterval_createFromDateString, 0, 0, 1) + ZEND_ARG_TYPE_INFO(0, time, IS_STRING, 0) +ZEND_END_ARG_INFO() + +#define arginfo_class_DateInterval_format arginfo_class_DateTimeInterface_format + +#define arginfo_class_DateInterval___wakeup arginfo_class_DateTimeInterface_getTimezone + +#define arginfo_class_DateInterval___set_state arginfo_class_DateTime___set_state + +ZEND_BEGIN_ARG_INFO_EX(arginfo_class_DatePeriod___construct, 0, 0, 1) + ZEND_ARG_INFO(0, start) + ZEND_ARG_INFO(0, interval) + ZEND_ARG_INFO(0, end) +ZEND_END_ARG_INFO() + +#define arginfo_class_DatePeriod_getStartDate arginfo_class_DateTimeInterface_getTimezone + +#define arginfo_class_DatePeriod_getEndDate arginfo_class_DateTimeInterface_getTimezone + +#define arginfo_class_DatePeriod_getDateInterval arginfo_class_DateTimeInterface_getTimezone + +#define arginfo_class_DatePeriod_getRecurrences arginfo_class_DateTimeInterface_getTimezone + +#define arginfo_class_DatePeriod___wakeup arginfo_class_DateTimeInterface_getTimezone + +#define arginfo_class_DatePeriod___set_state arginfo_class_DateTime___set_state + + +ZEND_FUNCTION(strtotime); +ZEND_FUNCTION(date); +ZEND_FUNCTION(idate); +ZEND_FUNCTION(gmdate); +ZEND_FUNCTION(mktime); +ZEND_FUNCTION(gmmktime); +ZEND_FUNCTION(checkdate); +ZEND_FUNCTION(strftime); +ZEND_FUNCTION(gmstrftime); +ZEND_FUNCTION(time); +ZEND_FUNCTION(localtime); +ZEND_FUNCTION(getdate); +ZEND_FUNCTION(date_create); +ZEND_FUNCTION(date_create_immutable); +ZEND_FUNCTION(date_create_from_format); +ZEND_FUNCTION(date_create_immutable_from_format); +ZEND_FUNCTION(date_parse); +ZEND_FUNCTION(date_parse_from_format); +ZEND_FUNCTION(date_get_last_errors); +ZEND_FUNCTION(date_format); +ZEND_FUNCTION(date_modify); +ZEND_FUNCTION(date_add); +ZEND_FUNCTION(date_sub); +ZEND_FUNCTION(date_timezone_get); +ZEND_FUNCTION(date_timezone_set); +ZEND_FUNCTION(date_offset_get); +ZEND_FUNCTION(date_diff); +ZEND_FUNCTION(date_time_set); +ZEND_FUNCTION(date_date_set); +ZEND_FUNCTION(date_isodate_set); +ZEND_FUNCTION(date_timestamp_set); +ZEND_FUNCTION(date_timestamp_get); +ZEND_FUNCTION(timezone_open); +ZEND_FUNCTION(timezone_name_get); +ZEND_FUNCTION(timezone_name_from_abbr); +ZEND_FUNCTION(timezone_offset_get); +ZEND_FUNCTION(timezone_transitions_get); +ZEND_FUNCTION(timezone_location_get); +ZEND_FUNCTION(timezone_identifiers_list); +ZEND_FUNCTION(timezone_abbreviations_list); +ZEND_FUNCTION(timezone_version_get); +ZEND_FUNCTION(date_interval_create_from_date_string); +ZEND_FUNCTION(date_interval_format); +ZEND_FUNCTION(date_default_timezone_set); +ZEND_FUNCTION(date_default_timezone_get); +ZEND_FUNCTION(date_sunrise); +ZEND_FUNCTION(date_sunset); +ZEND_FUNCTION(date_sun_info); +ZEND_METHOD(DateTime, __construct); +ZEND_METHOD(DateTime, __wakeup); +ZEND_METHOD(DateTime, __set_state); +ZEND_METHOD(DateTime, createFromImmutable); +ZEND_METHOD(DateTime, createFromInterface); +ZEND_METHOD(DateTimeImmutable, __construct); +ZEND_METHOD(DateTimeImmutable, __wakeup); +ZEND_METHOD(DateTimeImmutable, __set_state); +ZEND_METHOD(DateTimeImmutable, modify); +ZEND_METHOD(DateTimeImmutable, add); +ZEND_METHOD(DateTimeImmutable, sub); +ZEND_METHOD(DateTimeImmutable, setTimezone); +ZEND_METHOD(DateTimeImmutable, setTime); +ZEND_METHOD(DateTimeImmutable, setDate); +ZEND_METHOD(DateTimeImmutable, setISODate); +ZEND_METHOD(DateTimeImmutable, setTimestamp); +ZEND_METHOD(DateTimeImmutable, createFromMutable); +ZEND_METHOD(DateTimeImmutable, createFromInterface); +ZEND_METHOD(DateTimeZone, __construct); +ZEND_METHOD(DateTimeZone, __wakeup); +ZEND_METHOD(DateTimeZone, __set_state); +ZEND_METHOD(DateInterval, __construct); +ZEND_METHOD(DateInterval, __wakeup); +ZEND_METHOD(DateInterval, __set_state); +ZEND_METHOD(DatePeriod, __construct); +ZEND_METHOD(DatePeriod, getStartDate); +ZEND_METHOD(DatePeriod, getEndDate); +ZEND_METHOD(DatePeriod, getDateInterval); +ZEND_METHOD(DatePeriod, getRecurrences); +ZEND_METHOD(DatePeriod, __wakeup); +ZEND_METHOD(DatePeriod, __set_state); + + +static const zend_function_entry ext_functions[] = { + ZEND_FE(strtotime, arginfo_strtotime) + ZEND_FE(date, arginfo_date) + ZEND_FE(idate, arginfo_idate) + ZEND_FE(gmdate, arginfo_gmdate) + ZEND_FE(mktime, arginfo_mktime) + ZEND_FE(gmmktime, arginfo_gmmktime) + ZEND_FE(checkdate, arginfo_checkdate) + ZEND_FE(strftime, arginfo_strftime) + ZEND_FE(gmstrftime, arginfo_gmstrftime) + ZEND_FE(time, arginfo_time) + ZEND_FE(localtime, arginfo_localtime) + ZEND_FE(getdate, arginfo_getdate) + ZEND_FE(date_create, arginfo_date_create) + ZEND_FE(date_create_immutable, arginfo_date_create_immutable) + ZEND_FE(date_create_from_format, arginfo_date_create_from_format) + ZEND_FE(date_create_immutable_from_format, arginfo_date_create_immutable_from_format) + ZEND_FE(date_parse, arginfo_date_parse) + ZEND_FE(date_parse_from_format, arginfo_date_parse_from_format) + ZEND_FE(date_get_last_errors, arginfo_date_get_last_errors) + ZEND_FE(date_format, arginfo_date_format) + ZEND_FE(date_modify, arginfo_date_modify) + ZEND_FE(date_add, arginfo_date_add) + ZEND_FE(date_sub, arginfo_date_sub) + ZEND_FE(date_timezone_get, arginfo_date_timezone_get) + ZEND_FE(date_timezone_set, arginfo_date_timezone_set) + ZEND_FE(date_offset_get, arginfo_date_offset_get) + ZEND_FE(date_diff, arginfo_date_diff) + ZEND_FE(date_time_set, arginfo_date_time_set) + ZEND_FE(date_date_set, arginfo_date_date_set) + ZEND_FE(date_isodate_set, arginfo_date_isodate_set) + ZEND_FE(date_timestamp_set, arginfo_date_timestamp_set) + ZEND_FE(date_timestamp_get, arginfo_date_timestamp_get) + ZEND_FE(timezone_open, arginfo_timezone_open) + ZEND_FE(timezone_name_get, arginfo_timezone_name_get) + ZEND_FE(timezone_name_from_abbr, arginfo_timezone_name_from_abbr) + ZEND_FE(timezone_offset_get, arginfo_timezone_offset_get) + ZEND_FE(timezone_transitions_get, arginfo_timezone_transitions_get) + ZEND_FE(timezone_location_get, arginfo_timezone_location_get) + ZEND_FE(timezone_identifiers_list, arginfo_timezone_identifiers_list) + ZEND_FE(timezone_abbreviations_list, arginfo_timezone_abbreviations_list) + ZEND_FE(timezone_version_get, arginfo_timezone_version_get) + ZEND_FE(date_interval_create_from_date_string, arginfo_date_interval_create_from_date_string) + ZEND_FE(date_interval_format, arginfo_date_interval_format) + ZEND_FE(date_default_timezone_set, arginfo_date_default_timezone_set) + ZEND_FE(date_default_timezone_get, arginfo_date_default_timezone_get) + ZEND_FE(date_sunrise, arginfo_date_sunrise) + ZEND_FE(date_sunset, arginfo_date_sunset) + ZEND_FE(date_sun_info, arginfo_date_sun_info) + ZEND_FE_END +}; + + +static const zend_function_entry class_DateTimeInterface_methods[] = { + ZEND_ABSTRACT_ME_WITH_FLAGS(DateTimeInterface, format, arginfo_class_DateTimeInterface_format, ZEND_ACC_PUBLIC|ZEND_ACC_ABSTRACT) + ZEND_ABSTRACT_ME_WITH_FLAGS(DateTimeInterface, getTimezone, arginfo_class_DateTimeInterface_getTimezone, ZEND_ACC_PUBLIC|ZEND_ACC_ABSTRACT) + ZEND_ABSTRACT_ME_WITH_FLAGS(DateTimeInterface, getOffset, arginfo_class_DateTimeInterface_getOffset, ZEND_ACC_PUBLIC|ZEND_ACC_ABSTRACT) + ZEND_ABSTRACT_ME_WITH_FLAGS(DateTimeInterface, getTimestamp, arginfo_class_DateTimeInterface_getTimestamp, ZEND_ACC_PUBLIC|ZEND_ACC_ABSTRACT) + ZEND_ABSTRACT_ME_WITH_FLAGS(DateTimeInterface, diff, arginfo_class_DateTimeInterface_diff, ZEND_ACC_PUBLIC|ZEND_ACC_ABSTRACT) + ZEND_ABSTRACT_ME_WITH_FLAGS(DateTimeInterface, __wakeup, arginfo_class_DateTimeInterface___wakeup, ZEND_ACC_PUBLIC|ZEND_ACC_ABSTRACT) + ZEND_FE_END +}; + + +static const zend_function_entry class_DateTime_methods[] = { + ZEND_ME(DateTime, __construct, arginfo_class_DateTime___construct, ZEND_ACC_PUBLIC) + ZEND_ME(DateTime, __wakeup, arginfo_class_DateTime___wakeup, ZEND_ACC_PUBLIC) + ZEND_ME(DateTime, __set_state, arginfo_class_DateTime___set_state, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC) + ZEND_ME(DateTime, createFromImmutable, arginfo_class_DateTime_createFromImmutable, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC) + ZEND_ME(DateTime, createFromInterface, arginfo_class_DateTime_createFromInterface, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC) + ZEND_ME_MAPPING(createFromFormat, date_create_from_format, arginfo_class_DateTime_createFromFormat, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC) + ZEND_ME_MAPPING(getLastErrors, date_get_last_errors, arginfo_class_DateTime_getLastErrors, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC) + ZEND_ME_MAPPING(format, date_format, arginfo_class_DateTime_format, ZEND_ACC_PUBLIC) + ZEND_ME_MAPPING(modify, date_modify, arginfo_class_DateTime_modify, ZEND_ACC_PUBLIC) + ZEND_ME_MAPPING(add, date_add, arginfo_class_DateTime_add, ZEND_ACC_PUBLIC) + ZEND_ME_MAPPING(sub, date_sub, arginfo_class_DateTime_sub, ZEND_ACC_PUBLIC) + ZEND_ME_MAPPING(getTimezone, date_timezone_get, arginfo_class_DateTime_getTimezone, ZEND_ACC_PUBLIC) + ZEND_ME_MAPPING(setTimezone, date_timezone_set, arginfo_class_DateTime_setTimezone, ZEND_ACC_PUBLIC) + ZEND_ME_MAPPING(getOffset, date_offset_get, arginfo_class_DateTime_getOffset, ZEND_ACC_PUBLIC) + ZEND_ME_MAPPING(setTime, date_time_set, arginfo_class_DateTime_setTime, ZEND_ACC_PUBLIC) + ZEND_ME_MAPPING(setDate, date_date_set, arginfo_class_DateTime_setDate, ZEND_ACC_PUBLIC) + ZEND_ME_MAPPING(setISODate, date_isodate_set, arginfo_class_DateTime_setISODate, ZEND_ACC_PUBLIC) + ZEND_ME_MAPPING(setTimestamp, date_timestamp_set, arginfo_class_DateTime_setTimestamp, ZEND_ACC_PUBLIC) + ZEND_ME_MAPPING(getTimestamp, date_timestamp_get, arginfo_class_DateTime_getTimestamp, ZEND_ACC_PUBLIC) + ZEND_ME_MAPPING(diff, date_diff, arginfo_class_DateTime_diff, ZEND_ACC_PUBLIC) + ZEND_FE_END +}; + + +static const zend_function_entry class_DateTimeImmutable_methods[] = { + ZEND_ME(DateTimeImmutable, __construct, arginfo_class_DateTimeImmutable___construct, ZEND_ACC_PUBLIC) + ZEND_ME(DateTimeImmutable, __wakeup, arginfo_class_DateTimeImmutable___wakeup, ZEND_ACC_PUBLIC) + ZEND_ME(DateTimeImmutable, __set_state, arginfo_class_DateTimeImmutable___set_state, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC) + ZEND_ME_MAPPING(createFromFormat, date_create_immutable_from_format, arginfo_class_DateTimeImmutable_createFromFormat, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC) + ZEND_ME_MAPPING(getLastErrors, date_get_last_errors, arginfo_class_DateTimeImmutable_getLastErrors, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC) + ZEND_ME_MAPPING(format, date_format, arginfo_class_DateTimeImmutable_format, ZEND_ACC_PUBLIC) + ZEND_ME_MAPPING(getTimezone, date_timezone_get, arginfo_class_DateTimeImmutable_getTimezone, ZEND_ACC_PUBLIC) + ZEND_ME_MAPPING(getOffset, date_offset_get, arginfo_class_DateTimeImmutable_getOffset, ZEND_ACC_PUBLIC) + ZEND_ME_MAPPING(getTimestamp, date_timestamp_get, arginfo_class_DateTimeImmutable_getTimestamp, ZEND_ACC_PUBLIC) + ZEND_ME_MAPPING(diff, date_diff, arginfo_class_DateTimeImmutable_diff, ZEND_ACC_PUBLIC) + ZEND_ME(DateTimeImmutable, modify, arginfo_class_DateTimeImmutable_modify, ZEND_ACC_PUBLIC) + ZEND_ME(DateTimeImmutable, add, arginfo_class_DateTimeImmutable_add, ZEND_ACC_PUBLIC) + ZEND_ME(DateTimeImmutable, sub, arginfo_class_DateTimeImmutable_sub, ZEND_ACC_PUBLIC) + ZEND_ME(DateTimeImmutable, setTimezone, arginfo_class_DateTimeImmutable_setTimezone, ZEND_ACC_PUBLIC) + ZEND_ME(DateTimeImmutable, setTime, arginfo_class_DateTimeImmutable_setTime, ZEND_ACC_PUBLIC) + ZEND_ME(DateTimeImmutable, setDate, arginfo_class_DateTimeImmutable_setDate, ZEND_ACC_PUBLIC) + ZEND_ME(DateTimeImmutable, setISODate, arginfo_class_DateTimeImmutable_setISODate, ZEND_ACC_PUBLIC) + ZEND_ME(DateTimeImmutable, setTimestamp, arginfo_class_DateTimeImmutable_setTimestamp, ZEND_ACC_PUBLIC) + ZEND_ME(DateTimeImmutable, createFromMutable, arginfo_class_DateTimeImmutable_createFromMutable, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC) + ZEND_ME(DateTimeImmutable, createFromInterface, arginfo_class_DateTimeImmutable_createFromInterface, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC) + ZEND_FE_END +}; + + +static const zend_function_entry class_DateTimeZone_methods[] = { + ZEND_ME(DateTimeZone, __construct, arginfo_class_DateTimeZone___construct, ZEND_ACC_PUBLIC) + ZEND_ME_MAPPING(getName, timezone_name_get, arginfo_class_DateTimeZone_getName, ZEND_ACC_PUBLIC) + ZEND_ME_MAPPING(getOffset, timezone_offset_get, arginfo_class_DateTimeZone_getOffset, ZEND_ACC_PUBLIC) + ZEND_ME_MAPPING(getTransitions, timezone_transitions_get, arginfo_class_DateTimeZone_getTransitions, ZEND_ACC_PUBLIC) + ZEND_ME_MAPPING(getLocation, timezone_location_get, arginfo_class_DateTimeZone_getLocation, ZEND_ACC_PUBLIC) + ZEND_ME_MAPPING(listAbbreviations, timezone_abbreviations_list, arginfo_class_DateTimeZone_listAbbreviations, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC) + ZEND_ME_MAPPING(listIdentifiers, timezone_identifiers_list, arginfo_class_DateTimeZone_listIdentifiers, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC) + ZEND_ME(DateTimeZone, __wakeup, arginfo_class_DateTimeZone___wakeup, ZEND_ACC_PUBLIC) + ZEND_ME(DateTimeZone, __set_state, arginfo_class_DateTimeZone___set_state, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC) + ZEND_FE_END +}; + + +static const zend_function_entry class_DateInterval_methods[] = { + ZEND_ME(DateInterval, __construct, arginfo_class_DateInterval___construct, ZEND_ACC_PUBLIC) + ZEND_ME_MAPPING(createFromDateString, date_interval_create_from_date_string, arginfo_class_DateInterval_createFromDateString, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC) + ZEND_ME_MAPPING(format, date_interval_format, arginfo_class_DateInterval_format, ZEND_ACC_PUBLIC) + ZEND_ME(DateInterval, __wakeup, arginfo_class_DateInterval___wakeup, ZEND_ACC_PUBLIC) + ZEND_ME(DateInterval, __set_state, arginfo_class_DateInterval___set_state, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC) + ZEND_FE_END +}; + + +static const zend_function_entry class_DatePeriod_methods[] = { + ZEND_ME(DatePeriod, __construct, arginfo_class_DatePeriod___construct, ZEND_ACC_PUBLIC) + ZEND_ME(DatePeriod, getStartDate, arginfo_class_DatePeriod_getStartDate, ZEND_ACC_PUBLIC) + ZEND_ME(DatePeriod, getEndDate, arginfo_class_DatePeriod_getEndDate, ZEND_ACC_PUBLIC) + ZEND_ME(DatePeriod, getDateInterval, arginfo_class_DatePeriod_getDateInterval, ZEND_ACC_PUBLIC) + ZEND_ME(DatePeriod, getRecurrences, arginfo_class_DatePeriod_getRecurrences, ZEND_ACC_PUBLIC) + ZEND_ME(DatePeriod, __wakeup, arginfo_class_DatePeriod___wakeup, ZEND_ACC_PUBLIC) + ZEND_ME(DatePeriod, __set_state, arginfo_class_DatePeriod___set_state, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC) + ZEND_FE_END +}; diff --git a/ext/date/tests/002.phpt b/ext/date/tests/002.phpt index adbea5e231..36dc43d760 100644 --- a/ext/date/tests/002.phpt +++ b/ext/date/tests/002.phpt @@ -8,45 +8,45 @@ if (!@putenv("TZ=EST5") || getenv("TZ") != 'EST5') { ?> --FILE-- <?php - $dates = array ( - "1999-10-13", - "Oct 13 1999", - "2000-01-19", - "Jan 19 2000", - "2001-12-21", - "Dec 21 2001", - "2001-12-21 12:16", - "Dec 21 2001 12:16", - "Dec 21 12:16", - "2001-10-22 21:19:58", - "2001-10-22 21:19:58-02", - "2001-10-22 21:19:58-0213", - "2001-10-22 21:19:58+02", - "2001-10-22 21:19:58+0213", - "2001-10-22T21:20:58-03:40", - "2001-10-22T211958-2", - "20011022T211958+0213", - "20011022T21:20+0215", - "1997W011", - "2004W101T05:00+0", - ); + $dates = array ( + "1999-10-13", + "Oct 13 1999", + "2000-01-19", + "Jan 19 2000", + "2001-12-21", + "Dec 21 2001", + "2001-12-21 12:16", + "Dec 21 2001 12:16", + "Dec 21 12:16", + "2001-10-22 21:19:58", + "2001-10-22 21:19:58-02", + "2001-10-22 21:19:58-0213", + "2001-10-22 21:19:58+02", + "2001-10-22 21:19:58+0213", + "2001-10-22T21:20:58-03:40", + "2001-10-22T211958-2", + "20011022T211958+0213", + "20011022T21:20+0215", + "1997W011", + "2004W101T05:00+0", + ); - echo "*** GMT0\n"; - date_default_timezone_set("GMT0"); - foreach ($dates as $date) { - echo date ("Y-m-d H:i:s\n", strtotime ($date)); - } + echo "*** GMT0\n"; + date_default_timezone_set("GMT0"); + foreach ($dates as $date) { + echo date ("Y-m-d H:i:s\n", strtotime ($date)); + } - echo "*** US/Eastern\n"; - date_default_timezone_set("US/Eastern"); - if( date("T") == "GMT" ) { - // POSIX style - date_default_timezone_set("EST5EDT4,M4.1.0,M10.5.0"); - } + echo "*** US/Eastern\n"; + date_default_timezone_set("US/Eastern"); + if( date("T") == "GMT" ) { + // POSIX style + date_default_timezone_set("EST5EDT4,M4.1.0,M10.5.0"); + } - foreach ($dates as $date) { - echo date ("Y-m-d H:i:s\n", strtotime ($date)); - } + foreach ($dates as $date) { + echo date ("Y-m-d H:i:s\n", strtotime ($date)); + } ?> --EXPECTF-- *** GMT0 diff --git a/ext/date/tests/003.phpt b/ext/date/tests/003.phpt index 501899cc5f..ae7fcce23c 100644 --- a/ext/date/tests/003.phpt +++ b/ext/date/tests/003.phpt @@ -5,7 +5,7 @@ date suffixes test date_default_timezone_set('UTC'); for ($i = 0; $i < 32; $i++) { - var_dump(date("jS", mktime(0,0,0, 1, $i, 2006))); + var_dump(date("jS", mktime(0,0,0, 1, $i, 2006))); } echo "Done\n"; diff --git a/ext/date/tests/004.phpt b/ext/date/tests/004.phpt index 986c9c9179..23cb508458 100644 --- a/ext/date/tests/004.phpt +++ b/ext/date/tests/004.phpt @@ -8,19 +8,19 @@ $tz = array("UTC", "Asia/Jerusalem", "America/Chicago", "Europe/London"); $t = mktime(0, 0, 0, 6, 27, 2006); foreach ($tz as $zone) { - date_default_timezone_set($zone); + date_default_timezone_set($zone); - var_dump(date("w", $t)); - var_dump(date("z", $t)); - var_dump(date("n", $t)); - var_dump(date("t", $t)); - var_dump(date("L", $t)); - var_dump(date("a", $t)); - var_dump(date("B", $t)); - var_dump(date("g", $t)); - var_dump(date("G", $t)); - var_dump(date("Z", $t)); - var_dump(date("U", $t)); + var_dump(date("w", $t)); + var_dump(date("z", $t)); + var_dump(date("n", $t)); + var_dump(date("t", $t)); + var_dump(date("L", $t)); + var_dump(date("a", $t)); + var_dump(date("B", $t)); + var_dump(date("g", $t)); + var_dump(date("G", $t)); + var_dump(date("Z", $t)); + var_dump(date("U", $t)); } echo "Done\n"; diff --git a/ext/date/tests/005.phpt b/ext/date/tests/005.phpt index e1075ef248..23fff3b731 100644 --- a/ext/date/tests/005.phpt +++ b/ext/date/tests/005.phpt @@ -6,9 +6,6 @@ date_default_timezone_set('UTC'); $t = mktime(0,0,0, 6, 27, 2006); -var_dump(idate()); -var_dump(idate(1,1,1)); - var_dump(idate(1,1)); var_dump(idate("")); var_dump(idate(0)); @@ -20,12 +17,6 @@ var_dump(idate("'")); echo "Done\n"; ?> --EXPECTF-- -Warning: idate() expects at least 1 parameter, 0 given in %s on line %d -bool(false) - -Warning: idate() expects at most 2 parameters, 3 given in %s on line %d -bool(false) - Warning: idate(): Unrecognized date format token. in %s on line %d bool(false) diff --git a/ext/date/tests/006.phpt b/ext/date/tests/006.phpt index 425430a470..5171c430e2 100644 --- a/ext/date/tests/006.phpt +++ b/ext/date/tests/006.phpt @@ -4,7 +4,6 @@ checkdate() tests <?php date_default_timezone_set('UTC'); -var_dump(checkdate()); var_dump(checkdate(1,1,1)); var_dump(checkdate(2,29,2006)); @@ -18,9 +17,7 @@ var_dump(checkdate(1,1,-1)); echo "Done\n"; ?> ---EXPECTF-- -Warning: checkdate() expects exactly 3 parameters, 0 given in %s on line %d -bool(false) +--EXPECT-- bool(true) bool(false) bool(false) diff --git a/ext/date/tests/007.phpt b/ext/date/tests/007.phpt index 141e251753..4e0b24ce75 100644 --- a/ext/date/tests/007.phpt +++ b/ext/date/tests/007.phpt @@ -5,7 +5,6 @@ localtime() tests date_default_timezone_set('UTC'); $t = mktime(0,0,0, 6, 27, 2006); -var_dump(localtime(1,1,1)); var_dump(localtime()); var_dump(localtime($t)); @@ -15,8 +14,6 @@ var_dump(localtime($t, false)); echo "Done\n"; ?> --EXPECTF-- -Warning: localtime() expects at most 2 parameters, 3 given in %s on line %d -bool(false) array(9) { [0]=> int(%d) diff --git a/ext/date/tests/008.phpt b/ext/date/tests/008.phpt index e67b4bd0a4..701403d1f8 100644 --- a/ext/date/tests/008.phpt +++ b/ext/date/tests/008.phpt @@ -5,7 +5,6 @@ getdate() tests date_default_timezone_set('UTC'); $t = mktime(0,0,0, 6, 27, 2006); -var_dump(getdate(1,1)); var_dump(getdate($t)); var_dump(getdate()); @@ -13,8 +12,6 @@ var_dump(getdate()); echo "Done\n"; ?> --EXPECTF-- -Warning: getdate() expects at most 1 parameter, 2 given in %s on line %d -bool(false) array(11) { ["seconds"]=> int(0) diff --git a/ext/date/tests/009.phpt b/ext/date/tests/009.phpt index 4812d63de6..9d77a552cc 100644 --- a/ext/date/tests/009.phpt +++ b/ext/date/tests/009.phpt @@ -10,16 +10,12 @@ date_default_timezone_set('Asia/Jerusalem'); $t = mktime(0,0,0, 6, 27, 2006); -var_dump(strftime()); - var_dump(strftime("")); var_dump(strftime("%a %A %b %B %c %C %d %D %e %g %G %h %H %I %j %m %M %n %p %r %R %S %t %T %u %U %V %W %w %x %X %y %Y %Z %z %%", $t)); var_dump(strftime("%%q %%a", $t)); var_dump(strftime("%q", $t)); var_dump(strftime("blah", $t)); -var_dump(gmstrftime()); - var_dump(gmstrftime("")); var_dump(gmstrftime("%a %A %b %B %c %C %d %D %e %g %G %h %H %I %j %m %M %n %p %r %R %S %t %T %u %U %V %W %w %x %X %y %Y %Z %z %%", $t)); var_dump(gmstrftime("%%q %%a", $t)); @@ -29,17 +25,12 @@ var_dump(gmstrftime("blah", $t)); echo "Done\n"; ?> --EXPECTF-- -Warning: strftime() expects at least 1 parameter, 0 given in %s on line %d -bool(false) bool(false) string(%d) "Tue Tuesday Jun June Tue Jun 27 00:00:00 2006 %s %s %" string(5) "%q %a" string(%d) "%s" string(4) "blah" - -Warning: gmstrftime() expects at least 1 parameter, 0 given in %s on line %d -bool(false) bool(false) string(%d) "Mon Monday Jun June Mon Jun 26 21:00:00 2006 %s %s %" diff --git a/ext/date/tests/009_win32.phpt b/ext/date/tests/009_win32.phpt index 91c1b261ce..dcd118c97d 100644 --- a/ext/date/tests/009_win32.phpt +++ b/ext/date/tests/009_win32.phpt @@ -14,8 +14,6 @@ setlocale(LC_TIME, "en-us"); $t = mktime(0,0,0, 6, 27, 2006); -var_dump(strftime()); - var_dump(strftime("")); var_dump(strftime("%a %A %b %B %c %d %H %I %j %m %M %p %S %U %W %w %x %X %y %Y %Z %z %%", $t)); @@ -24,8 +22,6 @@ var_dump(strftime("%%q %%a", $t)); var_dump(strftime("blah", $t)); -var_dump(gmstrftime()); - var_dump(gmstrftime("")); var_dump(gmstrftime("%a %A %b %B %c %d %H %I %j %m %M %p %S %U %W %w %x %X %y %Y %Z %z %%", $t)); @@ -39,15 +35,10 @@ echo "Done\n"; setlocale(LC_TIME, $loc); ?> --EXPECTF-- -Warning: strftime() expects at least 1 parameter, 0 given in %s on line %d -bool(false) bool(false) string(%d) "Tue Tuesday Jun June 6/27/2006 12:00:00 AM 27 00 12 178 06 00 AM 00 26 26 2 6/27/2006 12:00:00 AM 06 2006 %s" string(5) "%q %a" string(4) "blah" - -Warning: gmstrftime() expects at least 1 parameter, 0 given in %s on line %d -bool(false) bool(false) string(%d) "Mon Monday Jun June 6/26/2006 9:00:00 PM 26 21 09 177 06 00 PM 00 26 26 1 6/26/2006 9:00:00 PM 06 2006 %s" string(5) "%q %a" diff --git a/ext/date/tests/011.phpt b/ext/date/tests/011.phpt index 092a4b7758..ca9820c4ef 100644 --- a/ext/date/tests/011.phpt +++ b/ext/date/tests/011.phpt @@ -4,7 +4,6 @@ timezone_name_from_abbr() tests <?php date_default_timezone_set('UTC'); -var_dump(timezone_name_from_abbr()); var_dump(timezone_name_from_abbr("CET")); var_dump(timezone_name_from_abbr("AXST")); var_dump(timezone_name_from_abbr("", 3600)); @@ -12,9 +11,7 @@ var_dump(timezone_name_from_abbr("", 3600, 0)); echo "Done\n"; ?> ---EXPECTF-- -Warning: timezone_name_from_abbr() expects at least 1 parameter, 0 given in %s on line %d -bool(false) +--EXPECT-- string(13) "Europe/Berlin" bool(false) bool(false) diff --git a/ext/date/tests/012.phpt b/ext/date/tests/012.phpt index be7e4e32af..0997ef047c 100644 --- a/ext/date/tests/012.phpt +++ b/ext/date/tests/012.phpt @@ -7,18 +7,13 @@ date_default_timezone_set('UTC'); $dto = date_create("2006-12-12"); var_dump(date_isodate_set($dto, 2006, 2, 15)); var_dump($dto->format("Y/m/d H:i:s")); -var_dump(date_isodate_set($dto, 2006)); -var_dump($dto->format("Y/m/d H:i:s")); var_dump(date_isodate_set($dto, 2006, 5)); var_dump($dto->format("Y/m/d H:i:s")); var_dump(date_isodate_set($dto, 2006, 100, 15)); var_dump($dto->format("Y/m/d H:i:s")); -var_dump(date_isodate_set($dto, 2006, 100, 15, 10)); -var_dump($dto->format("Y/m/d H:i:s")); - echo "Done\n"; ?> ---EXPECTF-- +--EXPECT-- object(DateTime)#1 (3) { ["date"]=> string(26) "2006-01-23 00:00:00.000000" @@ -28,10 +23,6 @@ object(DateTime)#1 (3) { string(3) "UTC" } string(19) "2006/01/23 00:00:00" - -Warning: date_isodate_set() expects at least 3 parameters, 2 given in %s on line %d -bool(false) -string(19) "2006/01/23 00:00:00" object(DateTime)#1 (3) { ["date"]=> string(26) "2006-01-30 00:00:00.000000" @@ -50,8 +41,4 @@ object(DateTime)#1 (3) { string(3) "UTC" } string(19) "2007/12/10 00:00:00" - -Warning: date_isodate_set() expects at most 4 parameters, 5 given in %s on line %d -bool(false) -string(19) "2007/12/10 00:00:00" Done diff --git a/ext/date/tests/013.phpt b/ext/date/tests/013.phpt index 266dafe06a..6010071be6 100644 --- a/ext/date/tests/013.phpt +++ b/ext/date/tests/013.phpt @@ -7,10 +7,6 @@ date_default_timezone_set('UTC'); $dto = date_create("2006-12-12"); var_dump($dto); var_dump($dto->format("Y.m.d H:i:s")); -var_dump(date_date_set()); -var_dump($dto->format("Y.m.d H:i:s")); -var_dump(date_date_set($dto, 2006, 5)); -var_dump($dto->format("Y.m.d H:i:s")); var_dump(date_date_set($dto, 2006, 2, 15)); var_dump($dto->format("Y.m.d H:i:s")); var_dump(date_date_set($dto, 2006, 24, 60)); @@ -28,14 +24,6 @@ object(DateTime)#%d (3) { string(3) "UTC" } string(19) "2006.12.12 00:00:00" - -Warning: date_date_set() expects exactly 4 parameters, 0 given in %s on line %d -bool(false) -string(19) "2006.12.12 00:00:00" - -Warning: date_date_set() expects exactly 4 parameters, 3 given in %s on line %d -bool(false) -string(19) "2006.12.12 00:00:00" object(DateTime)#1 (3) { ["date"]=> string(26) "2006-02-15 00:00:00.000000" diff --git a/ext/date/tests/014.phpt b/ext/date/tests/014.phpt index 2e72bdabe0..a2f81090e7 100644 --- a/ext/date/tests/014.phpt +++ b/ext/date/tests/014.phpt @@ -10,7 +10,6 @@ var_dump($dto); $dtz = date_timezone_get($dto); var_dump($dtz); -var_dump(timezone_offset_get()); var_dump(timezone_offset_get($dtz, $dto)); var_dump(timezone_offset_get($dto, $dtz)); @@ -32,12 +31,9 @@ object(DateTimeZone)#%d (2) { ["timezone"]=> string(3) "UTC" } - -Warning: timezone_offset_get() expects exactly 2 parameters, 0 given in %s on line %d -bool(false) int(0) -Fatal error: Uncaught TypeError: Argument 1 passed to timezone_offset_get() must be an instance of DateTimeZone, instance of DateTime given in %s:%d +Fatal error: Uncaught TypeError: timezone_offset_get(): Argument #1 ($object) must be of type DateTimeZone, object given in %s:%d Stack trace: #0 %s(%d): timezone_offset_get(Object(DateTime), Object(DateTimeZone)) #1 {main} diff --git a/ext/date/tests/68062.phpt b/ext/date/tests/68062.phpt index 6b1e16ae67..2a7c6ad61a 100644 --- a/ext/date/tests/68062.phpt +++ b/ext/date/tests/68062.phpt @@ -6,8 +6,12 @@ DateTimeZone::getOffset() accepts a DateTimeInterface object $tz = new DateTimeZone('Europe/London'); $dt = new DateTimeImmutable('2014-09-20', $tz); -echo $tz->getOffset($dt); -echo $tz->getOffset(1); ---EXPECTF-- +echo $tz->getOffset($dt), "\n"; +try { + echo $tz->getOffset(1); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} +--EXPECT-- 3600 -Warning: DateTimeZone::getOffset() expects parameter 1 to be DateTimeInterface, int given in %s +DateTimeZone::getOffset(): Argument #1 ($datetime) must be of type DateTimeInterface, int given diff --git a/ext/date/tests/DatePeriod_wrong_recurrence_on_constructor.phpt b/ext/date/tests/DatePeriod_wrong_recurrence_on_constructor.phpt index 715ea63dc9..f96753b019 100644 --- a/ext/date/tests/DatePeriod_wrong_recurrence_on_constructor.phpt +++ b/ext/date/tests/DatePeriod_wrong_recurrence_on_constructor.phpt @@ -14,6 +14,6 @@ try { echo $exception->getMessage(), "\n"; } ?> ---EXPECTF-- +--EXPECT-- DatePeriod::__construct(): The recurrence count '0' is invalid. Needs to be > 0 DatePeriod::__construct(): The recurrence count '-1' is invalid. Needs to be > 0 diff --git a/ext/date/tests/DateTimeImmutable_createFromInterface.phpt b/ext/date/tests/DateTimeImmutable_createFromInterface.phpt new file mode 100644 index 0000000000..31e3847ef7 --- /dev/null +++ b/ext/date/tests/DateTimeImmutable_createFromInterface.phpt @@ -0,0 +1,79 @@ +--TEST-- +Tests for DateTimeImmutable::createFromInterface +--INI-- +date.timezone=Europe/London +--FILE-- +<?php +$current = "2014-03-02 16:24:08"; + +$i = DateTimeImmutable::createFromInterface( date_create( $current ) ); +var_dump( $i ); + +$i = DateTimeImmutable::createFromInterface( date_create_immutable( $current ) ); +var_dump( $i ); + +$current = "2019-12-16 15:06:46 CET"; + +$i = DateTimeImmutable::createFromInterface( date_create( $current ) ); +var_dump( $i ); + +$i = DateTimeImmutable::createFromInterface( date_create_immutable( $current ) ); +var_dump( $i ); + +$current = "2019-12-16 15:08:20 +0100"; + +$i = DateTimeImmutable::createFromInterface( date_create( $current ) ); +var_dump( $i ); + +$i = DateTimeImmutable::createFromInterface( date_create_immutable( $current ) ); +var_dump( $i ); +?> +--EXPECTF-- +object(DateTimeImmutable)#%d (3) { + ["date"]=> + string(26) "2014-03-02 16:24:08.000000" + ["timezone_type"]=> + int(3) + ["timezone"]=> + string(13) "Europe/London" +} +object(DateTimeImmutable)#%d (3) { + ["date"]=> + string(26) "2014-03-02 16:24:08.000000" + ["timezone_type"]=> + int(3) + ["timezone"]=> + string(13) "Europe/London" +} +object(DateTimeImmutable)#%d (3) { + ["date"]=> + string(26) "2019-12-16 15:06:46.000000" + ["timezone_type"]=> + int(2) + ["timezone"]=> + string(3) "CET" +} +object(DateTimeImmutable)#%d (3) { + ["date"]=> + string(26) "2019-12-16 15:06:46.000000" + ["timezone_type"]=> + int(2) + ["timezone"]=> + string(3) "CET" +} +object(DateTimeImmutable)#%d (3) { + ["date"]=> + string(26) "2019-12-16 15:08:20.000000" + ["timezone_type"]=> + int(1) + ["timezone"]=> + string(6) "+01:00" +} +object(DateTimeImmutable)#%d (3) { + ["date"]=> + string(26) "2019-12-16 15:08:20.000000" + ["timezone_type"]=> + int(1) + ["timezone"]=> + string(6) "+01:00" +} diff --git a/ext/date/tests/DateTimeImmutable_createFromMutable.phpt b/ext/date/tests/DateTimeImmutable_createFromMutable.phpt index ac92fb4bb4..3ac17de49f 100644 --- a/ext/date/tests/DateTimeImmutable_createFromMutable.phpt +++ b/ext/date/tests/DateTimeImmutable_createFromMutable.phpt @@ -1,5 +1,5 @@ --TEST-- -Tests for DateTimeImmutable::createFromMutable. +Tests for DateTimeImmutable::createFromMutable --INI-- date.timezone=Europe/London --FILE-- @@ -9,8 +9,11 @@ $current = "2014-03-02 16:24:08"; $i = DateTimeImmutable::createFromMutable( date_create( $current ) ); var_dump( $i ); -$i = DateTimeImmutable::createFromMutable( date_create_immutable( $current ) ); -var_dump( $i ); +try { + DateTimeImmutable::createFromMutable( date_create_immutable( $current ) ); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} ?> --EXPECTF-- object(DateTimeImmutable)#%d (3) { @@ -21,6 +24,4 @@ object(DateTimeImmutable)#%d (3) { ["timezone"]=> string(13) "Europe/London" } - -Warning: DateTimeImmutable::createFromMutable() expects parameter 1 to be DateTime, object given in %stests%eDateTimeImmutable_createFromMutable.php on line %d -NULL +DateTimeImmutable::createFromMutable(): Argument #1 ($object) must be of type DateTime, object given diff --git a/ext/date/tests/DateTimeZone_clone_basic1.phpt b/ext/date/tests/DateTimeZone_clone_basic1.phpt index 5f527202cd..3d154512f6 100644 --- a/ext/date/tests/DateTimeZone_clone_basic1.phpt +++ b/ext/date/tests/DateTimeZone_clone_basic1.phpt @@ -18,15 +18,14 @@ var_dump($orig); var_dump($clone); if ($clone != $orig) { - echo "TEST FAILED : objects not equal\n"; + echo "TEST FAILED : objects not equal\n"; }else if ($clone === $orig) { - echo "TEST FAILED : objects identical\n"; + echo "TEST FAILED : objects identical\n"; } else { - echo "TEST PASSED : Objects equal but not indetical\n"; + echo "TEST PASSED : Objects equal but not indetical\n"; } ?> -===DONE=== --EXPECTF-- *** Testing clone on DateTime objects *** object(DateTimeZone)#%d (2) { @@ -42,4 +41,3 @@ object(DateTimeZone)#%d (2) { string(3) "GMT" } TEST PASSED : Objects equal but not indetical -===DONE=== diff --git a/ext/date/tests/DateTimeZone_clone_basic2.phpt b/ext/date/tests/DateTimeZone_clone_basic2.phpt index 6cd07393e2..b41eeddfbd 100644 --- a/ext/date/tests/DateTimeZone_clone_basic2.phpt +++ b/ext/date/tests/DateTimeZone_clone_basic2.phpt @@ -1,21 +1,21 @@ --TEST-- -Testing clone on objects whoose class derived from DateTimeZone class +Testing clone on objects whose class derived from DateTimeZone class --FILE-- <?php //Set the default time zone date_default_timezone_set("Europe/London"); class DateTimeZoneExt1 extends DateTimeZone { - public $property1 = 99; - public $property2 = "Hello"; + public $property1 = 99; + public $property2 = "Hello"; } class DateTimeZoneExt2 extends DateTimeZoneExt1 { - public $property3 = true; - public $property4 = 10.5; + public $property3 = true; + public $property4 = 10.5; } -echo "*** Testing clone on objects whoose class derived from DateTimeZone class ***\n"; +echo "*** Testing clone on objects whose class derived from DateTimeZone class ***\n"; $d1 = new DateTimeZoneExt1("Europe/London"); var_dump($d1); @@ -28,9 +28,8 @@ $d2_clone = clone $d2; var_dump($d2_clone); ?> -===DONE=== --EXPECTF-- -*** Testing clone on objects whoose class derived from DateTimeZone class *** +*** Testing clone on objects whose class derived from DateTimeZone class *** object(DateTimeZoneExt1)#%d (4) { ["property1"]=> int(99) @@ -79,4 +78,3 @@ object(DateTimeZoneExt2)#%d (6) { ["timezone"]=> string(13) "Europe/London" } -===DONE=== diff --git a/ext/date/tests/DateTimeZone_clone_basic3.phpt b/ext/date/tests/DateTimeZone_clone_basic3.phpt index c573af9571..5f85333789 100644 --- a/ext/date/tests/DateTimeZone_clone_basic3.phpt +++ b/ext/date/tests/DateTimeZone_clone_basic3.phpt @@ -25,7 +25,6 @@ echo "\n-- clone it --\n"; $d2_clone = clone $d1_clone; var_dump($d2_clone); ?> -===DONE=== --EXPECTF-- *** Testing clone on DateTime objects *** @@ -92,4 +91,3 @@ object(DateTimeZone)#%d (6) { ["timezone"]=> string(13) "Europe/London" } -===DONE=== diff --git a/ext/date/tests/DateTimeZone_clone_basic4.phpt b/ext/date/tests/DateTimeZone_clone_basic4.phpt index 70bd7f3bb1..9f99bc5b3e 100644 --- a/ext/date/tests/DateTimeZone_clone_basic4.phpt +++ b/ext/date/tests/DateTimeZone_clone_basic4.phpt @@ -6,9 +6,9 @@ Test clone of DateTimeZone derived objects with __clone magic method date_default_timezone_set("Europe/London"); class DateTimeZoneExt1 extends DateTimeZone { - public function __clone() { - echo "-- DateTimeExt1 __clone magic method called --\n"; - } + public function __clone() { + echo "-- DateTimeExt1 __clone magic method called --\n"; + } } echo "*** Testing clone of objects derived from DateTimeZone class with __clone magic method***\n"; @@ -20,9 +20,7 @@ $d1_clone = clone $d1; var_dump( $d1_clone->getName() ); ?> -===DONE=== --EXPECT-- *** Testing clone of objects derived from DateTimeZone class with __clone magic method*** -- DateTimeExt1 __clone magic method called -- string(16) "America/New_York" -===DONE=== diff --git a/ext/date/tests/DateTimeZone_construct_basic.phpt b/ext/date/tests/DateTimeZone_construct_basic.phpt index 737d655b9c..c2ded65412 100644 --- a/ext/date/tests/DateTimeZone_construct_basic.phpt +++ b/ext/date/tests/DateTimeZone_construct_basic.phpt @@ -18,7 +18,6 @@ var_dump( new DateTimeZone("Europe/London") ); var_dump( new DateTimeZone("America/Los_Angeles") ); ?> -===DONE=== --EXPECTF-- *** Testing new DateTimeZone() : basic functionality *** object(DateTimeZone)#%d (2) { @@ -39,4 +38,3 @@ object(DateTimeZone)#%d (2) { ["timezone"]=> string(19) "America/Los_Angeles" } -===DONE=== diff --git a/ext/date/tests/DateTimeZone_construct_error.phpt b/ext/date/tests/DateTimeZone_construct_error.phpt index 6bde64c4a2..4ae5d2d228 100644 --- a/ext/date/tests/DateTimeZone_construct_error.phpt +++ b/ext/date/tests/DateTimeZone_construct_error.phpt @@ -22,10 +22,8 @@ try { } ?> -===DONE=== --EXPECT-- *** Testing DateTimeZone() : error conditions *** -- Testing new DateTimeZone() with more than expected no. of arguments -- DateTimeZone::__construct() expects exactly 1 parameter, 2 given -===DONE=== diff --git a/ext/date/tests/DateTimeZone_extends_basic1.phpt b/ext/date/tests/DateTimeZone_extends_basic1.phpt index 462cb155d2..ace71c3ffa 100644 --- a/ext/date/tests/DateTimeZone_extends_basic1.phpt +++ b/ext/date/tests/DateTimeZone_extends_basic1.phpt @@ -10,10 +10,10 @@ echo "*** Testing basic DateTimeZone inheritance() ***\n"; class DateTimeZoneExt extends DateTimeZone { - public function __toString() - { - return parent::getName(); - } + public function __toString() + { + return parent::getName(); + } } echo "\n-- Create an instance of DateTimeZoneExt --\n"; @@ -23,7 +23,6 @@ echo "\n-- Invoke __toString --\n"; echo $d . "\n"; ?> -===DONE=== --EXPECT-- *** Testing basic DateTimeZone inheritance() *** @@ -31,4 +30,3 @@ echo $d . "\n"; -- Invoke __toString -- America/Los_Angeles -===DONE=== diff --git a/ext/date/tests/DateTimeZone_getName_basic1.phpt b/ext/date/tests/DateTimeZone_getName_basic1.phpt index c226aa39bb..6d320b5ae0 100644 --- a/ext/date/tests/DateTimeZone_getName_basic1.phpt +++ b/ext/date/tests/DateTimeZone_getName_basic1.phpt @@ -23,10 +23,8 @@ $tz3 = new DateTimeZone("America/Los_Angeles"); var_dump( $tz3->getName() ); ?> -===DONE=== --EXPECT-- *** Testing DateTimeZone::getName() : basic functionality *** string(13) "Europe/London" string(16) "America/New_York" string(19) "America/Los_Angeles" -===DONE=== diff --git a/ext/date/tests/DateTimeZone_getOffset_basic1.phpt b/ext/date/tests/DateTimeZone_getOffset_basic1.phpt index ce1c04336e..b0617a47a4 100644 --- a/ext/date/tests/DateTimeZone_getOffset_basic1.phpt +++ b/ext/date/tests/DateTimeZone_getOffset_basic1.phpt @@ -24,10 +24,8 @@ $tz3 = new DateTimeZone("America/Los_Angeles"); var_dump( $tz3->getOffset($date) ); ?> -===DONE=== --EXPECTF-- *** Testing DateTimeZone::getOffset() : basic functionality *** %rint\(0\)|int\(3600\)%r %rint\(-18000\)|int\(-14400\)%r %rint\(-28800\)|int\(-25200\)%r -===DONE=== diff --git a/ext/date/tests/DateTimeZone_getTransitions_basic1.phpt b/ext/date/tests/DateTimeZone_getTransitions_basic1.phpt index ee88321fca..7559143466 100644 --- a/ext/date/tests/DateTimeZone_getTransitions_basic1.phpt +++ b/ext/date/tests/DateTimeZone_getTransitions_basic1.phpt @@ -19,7 +19,7 @@ $tz = new DateTimeZone("Europe/London"); $tran = $tz->getTransitions(-306972000, -37241999); if (!is_array($tran)) { - echo "TEST FAILED: Expected an array\n"; + echo "TEST FAILED: Expected an array\n"; } echo "\n-- Total number of transitions: " . count($tran). " --\n"; @@ -28,7 +28,6 @@ echo "\n-- Format a sample entry for Spring 1963 --\n"; var_dump( $tran[6] ); ?> -===DONE=== --EXPECT-- *** Testing DateTimeZone::getTransitions() : basic functionality *** @@ -47,4 +46,3 @@ array(5) { ["abbr"]=> string(3) "BST" } -===DONE=== diff --git a/ext/date/tests/DateTimeZone_listAbbreviations_basic1.phpt b/ext/date/tests/DateTimeZone_listAbbreviations_basic1.phpt index 0154839ae4..670dcb2ee3 100644 --- a/ext/date/tests/DateTimeZone_listAbbreviations_basic1.phpt +++ b/ext/date/tests/DateTimeZone_listAbbreviations_basic1.phpt @@ -22,8 +22,7 @@ echo "\n-- Format a sample entry --\n"; var_dump( $abbr["acst"] ); ?> -===DONE=== ---EXPECTF-- +--EXPECT-- *** Testing DateTimeZone::listAbbreviations() : basic functionality *** string(5) "array" int(144) @@ -85,4 +84,3 @@ array(6) { string(20) "Australia/Yancowinna" } } -===DONE=== diff --git a/ext/date/tests/DateTimeZone_listIdentifiers_basic1.phpt b/ext/date/tests/DateTimeZone_listIdentifiers_basic1.phpt index 26a0c2fca2..05ced8701e 100644 --- a/ext/date/tests/DateTimeZone_listIdentifiers_basic1.phpt +++ b/ext/date/tests/DateTimeZone_listIdentifiers_basic1.phpt @@ -23,7 +23,6 @@ var_dump(in_array("America/New_York", $zones)); var_dump(in_array("UTC", $zones)); ?> -===DONE=== --EXPECT-- *** Testing DateTimeZone::listIdentifiers() : basic functionality *** Check return tpe is ARRAY @@ -32,5 +31,4 @@ Check array contains some common timezones bool(true) bool(true) bool(true) -===DONE=== diff --git a/ext/date/tests/DateTimeZone_serialize_type_1.phpt b/ext/date/tests/DateTimeZone_serialize_type_1.phpt index e6835f3daf..f35a133cfb 100644 --- a/ext/date/tests/DateTimeZone_serialize_type_1.phpt +++ b/ext/date/tests/DateTimeZone_serialize_type_1.phpt @@ -16,7 +16,6 @@ var_dump($tz2); var_dump( $tz2->getName() ); ?> -===DONE=== --EXPECTF-- object(DateTimeZone)#%d (2) { ["timezone_type"]=> @@ -32,4 +31,3 @@ object(DateTimeZone)#%d (2) { string(6) "+01:00" } string(6) "+01:00" -===DONE=== diff --git a/ext/date/tests/DateTimeZone_serialize_type_2.phpt b/ext/date/tests/DateTimeZone_serialize_type_2.phpt index 92f1e70bc4..a823ee08c0 100644 --- a/ext/date/tests/DateTimeZone_serialize_type_2.phpt +++ b/ext/date/tests/DateTimeZone_serialize_type_2.phpt @@ -16,7 +16,6 @@ var_dump($tz2); var_dump( $tz2->getName() ); ?> -===DONE=== --EXPECTF-- object(DateTimeZone)#%d (2) { ["timezone_type"]=> @@ -32,4 +31,3 @@ object(DateTimeZone)#%d (2) { string(3) "EST" } string(3) "EST" -===DONE=== diff --git a/ext/date/tests/DateTimeZone_serialize_type_3.phpt b/ext/date/tests/DateTimeZone_serialize_type_3.phpt index cffef81b6b..92ac958dc3 100644 --- a/ext/date/tests/DateTimeZone_serialize_type_3.phpt +++ b/ext/date/tests/DateTimeZone_serialize_type_3.phpt @@ -16,7 +16,6 @@ var_dump($tz2); var_dump( $tz2->getName() ); ?> -===DONE=== --EXPECT-- object(DateTimeZone)#1 (2) { ["timezone_type"]=> @@ -32,4 +31,3 @@ object(DateTimeZone)#2 (2) { string(16) "America/New_York" } string(16) "America/New_York" -===DONE=== diff --git a/ext/date/tests/DateTimeZone_verify.phpt b/ext/date/tests/DateTimeZone_verify.phpt deleted file mode 100644 index 2cba7c859e..0000000000 --- a/ext/date/tests/DateTimeZone_verify.phpt +++ /dev/null @@ -1,125 +0,0 @@ ---TEST-- -Test DateTimeZone class registration ---FILE-- -<?php - -echo "*** Verify DateTimeZone class ***\n"; - -echo "Verify DateTimeZone class registered OK\n"; -$class = new ReflectionClass('DateTimeZone'); -var_dump($class); - -echo "..and get names of all its methods\n"; -$methods = $class->getMethods(); -var_dump($methods); - -echo "..and get names of all its class constants\n"; -$constants = $class->getConstants(); -var_dump($constants); -?> -===DONE=== ---EXPECTF-- -*** Verify DateTimeZone class *** -Verify DateTimeZone class registered OK -object(ReflectionClass)#%d (1) { - ["name"]=> - string(12) "DateTimeZone" -} -..and get names of all its methods -array(9) { - [0]=> - object(ReflectionMethod)#%d (2) { - ["name"]=> - string(11) "__construct" - ["class"]=> - string(12) "DateTimeZone" - } - [1]=> - object(ReflectionMethod)#%d (2) { - ["name"]=> - string(8) "__wakeup" - ["class"]=> - string(12) "DateTimeZone" - } - [2]=> - object(ReflectionMethod)#%d (2) { - ["name"]=> - string(11) "__set_state" - ["class"]=> - string(12) "DateTimeZone" - } - [3]=> - object(ReflectionMethod)#%d (2) { - ["name"]=> - string(7) "getName" - ["class"]=> - string(12) "DateTimeZone" - } - [4]=> - object(ReflectionMethod)#%d (2) { - ["name"]=> - string(9) "getOffset" - ["class"]=> - string(12) "DateTimeZone" - } - [5]=> - object(ReflectionMethod)#%d (2) { - ["name"]=> - string(14) "getTransitions" - ["class"]=> - string(12) "DateTimeZone" - } - [6]=> - object(ReflectionMethod)#%d (2) { - ["name"]=> - string(11) "getLocation" - ["class"]=> - string(12) "DateTimeZone" - } - [7]=> - object(ReflectionMethod)#%d (2) { - ["name"]=> - string(17) "listAbbreviations" - ["class"]=> - string(12) "DateTimeZone" - } - [8]=> - object(ReflectionMethod)#%d (2) { - ["name"]=> - string(15) "listIdentifiers" - ["class"]=> - string(12) "DateTimeZone" - } -} -..and get names of all its class constants -array(14) { - ["AFRICA"]=> - int(1) - ["AMERICA"]=> - int(2) - ["ANTARCTICA"]=> - int(4) - ["ARCTIC"]=> - int(8) - ["ASIA"]=> - int(16) - ["ATLANTIC"]=> - int(32) - ["AUSTRALIA"]=> - int(64) - ["EUROPE"]=> - int(128) - ["INDIAN"]=> - int(256) - ["PACIFIC"]=> - int(512) - ["UTC"]=> - int(1024) - ["ALL"]=> - int(2047) - ["ALL_WITH_BC"]=> - int(4095) - ["PER_COUNTRY"]=> - int(4096) -} -===DONE=== diff --git a/ext/date/tests/DateTime_clone_basic1.phpt b/ext/date/tests/DateTime_clone_basic1.phpt index 318d5c3d7f..714f9a174d 100644 --- a/ext/date/tests/DateTime_clone_basic1.phpt +++ b/ext/date/tests/DateTime_clone_basic1.phpt @@ -21,9 +21,7 @@ echo "Original: " . $orig->format("H:i:s") . "\n"; echo "Clone: " . $clone->format("H:i:s") . "\n"; ?> -===DONE=== --EXPECT-- *** Testing clone on DateTime objects *** Original: 22:41:50 Clone: 14:25:41 -===DONE=== diff --git a/ext/date/tests/DateTime_clone_basic2.phpt b/ext/date/tests/DateTime_clone_basic2.phpt index e4ca0c1cab..261879283e 100644 --- a/ext/date/tests/DateTime_clone_basic2.phpt +++ b/ext/date/tests/DateTime_clone_basic2.phpt @@ -1,22 +1,22 @@ --TEST-- -Test clone of objects whoose class derived from DateTime class +Test clone of objects whose class derived from DateTime class --FILE-- <?php //Set the default time zone date_default_timezone_set("Europe/London"); class DateTimeExt1 extends DateTime { - public $property1 = 99; - public $property2 = "Hello"; + public $property1 = 99; + public $property2 = "Hello"; } class DateTimeExt2 extends DateTimeExt1 { - public $property3 = true; - public $property4 = 10.5; + public $property3 = true; + public $property4 = 10.5; } -echo "*** Testing clone on objects whoose class derived from DateTime class ***\n"; +echo "*** Testing clone on objects whose class derived from DateTime class ***\n"; $d1 = new DateTimeExt1("2009-02-03 12:34:41 GMT"); var_dump($d1); @@ -28,9 +28,8 @@ var_dump($d2); $d2_clone = clone $d2; var_dump($d2_clone); ?> -===DONE=== --EXPECTF-- -*** Testing clone on objects whoose class derived from DateTime class *** +*** Testing clone on objects whose class derived from DateTime class *** object(DateTimeExt1)#%d (5) { ["property1"]=> int(99) @@ -87,4 +86,3 @@ object(DateTimeExt2)#%d (7) { ["timezone"]=> string(3) "GMT" } -===DONE=== diff --git a/ext/date/tests/DateTime_clone_basic3.phpt b/ext/date/tests/DateTime_clone_basic3.phpt index ebda6a8428..dd7220799d 100644 --- a/ext/date/tests/DateTime_clone_basic3.phpt +++ b/ext/date/tests/DateTime_clone_basic3.phpt @@ -25,7 +25,6 @@ echo "\n-- clone it --\n"; $d2_clone = clone $d1_clone; var_dump($d2_clone); ?> -===DONE=== --EXPECTF-- *** Testing clone on DateTime objects *** @@ -102,4 +101,3 @@ object(DateTime)#%d (7) { ["timezone"]=> string(3) "GMT" } -===DONE=== diff --git a/ext/date/tests/DateTime_clone_basic4.phpt b/ext/date/tests/DateTime_clone_basic4.phpt index e228783a96..3633cb56e0 100644 --- a/ext/date/tests/DateTime_clone_basic4.phpt +++ b/ext/date/tests/DateTime_clone_basic4.phpt @@ -9,9 +9,9 @@ date_default_timezone_set("Europe/London"); date_default_timezone_set("Europe/London"); class DateTimeExt1 extends DateTime { - public function __clone() { - echo "-- DateTimeExt1 __clone magic method called --\n"; - } + public function __clone() { + echo "-- DateTimeExt1 __clone magic method called --\n"; + } } echo "*** Testing clone of objects derived from DateTime class with __clone magic method***\n"; @@ -23,9 +23,7 @@ $d1_clone = clone $d1; var_dump( $d1_clone->format( "m.d.y") ); ?> -===DONE=== --EXPECT-- *** Testing clone of objects derived from DateTime class with __clone magic method*** -- DateTimeExt1 __clone magic method called -- string(8) "02.03.09" -===DONE=== diff --git a/ext/date/tests/DateTime_compare_basic1.phpt b/ext/date/tests/DateTime_compare_basic1.phpt index 0d3f15360d..93c7b1f34e 100644 --- a/ext/date/tests/DateTime_compare_basic1.phpt +++ b/ext/date/tests/DateTime_compare_basic1.phpt @@ -12,8 +12,8 @@ class DateTimeExt1 extends DateTime { } class DateTimeExt2 extends DateTime{ - public $foo = "Hello"; - private $bar = 99; + public $foo = "Hello"; + private $bar = 99; } class DateTimeExt3 extends DateTimeExt2 { @@ -49,7 +49,6 @@ var_dump($obj1 == $obj2); var_dump($obj1 == $obj3); var_dump($obj1 == $obj4); ?> -===DONE=== --EXPECT-- Simple test for DateTime compare object handler @@ -74,4 +73,3 @@ bool(false) bool(true) bool(true) bool(true) -===DONE=== diff --git a/ext/date/tests/DateTime_construct_basic1.phpt b/ext/date/tests/DateTime_construct_basic1.phpt index f2a341b053..37ed61c8d0 100644 --- a/ext/date/tests/DateTime_construct_basic1.phpt +++ b/ext/date/tests/DateTime_construct_basic1.phpt @@ -20,7 +20,6 @@ var_dump( new DateTime("2005-07-14 22:30:41") ); var_dump( new DateTime("2005-07-14 22:30:41 GMT") ); ?> -===DONE=== --EXPECTF-- *** Testing new DateTime() : basic functionality *** object(DateTime)#%d (3) { @@ -55,4 +54,3 @@ object(DateTime)#%d (3) { ["timezone"]=> string(3) "GMT" } -===DONE=== diff --git a/ext/date/tests/DateTime_construct_error.phpt b/ext/date/tests/DateTime_construct_error.phpt index 7219d2b712..00b0394ff9 100644 --- a/ext/date/tests/DateTime_construct_error.phpt +++ b/ext/date/tests/DateTime_construct_error.phpt @@ -23,10 +23,8 @@ try { } ?> -===DONE=== --EXPECT-- *** Testing date_create() : error conditions *** -- Testing new DateTime() with more than expected no. of arguments -- DateTime::__construct() expects at most 2 parameters, 3 given -===DONE=== diff --git a/ext/date/tests/DateTime_createFromImmutable.phpt b/ext/date/tests/DateTime_createFromImmutable.phpt index ee7731855a..6407333f06 100644 --- a/ext/date/tests/DateTime_createFromImmutable.phpt +++ b/ext/date/tests/DateTime_createFromImmutable.phpt @@ -14,8 +14,11 @@ $m->modify('+ 1 hour'); var_dump( $i->format('Y-m-d H:i:s') === $current ); -$m = DateTime::createFromImmutable( date_create( $current ) ); -var_dump( $m ); +try { + DateTime::createFromImmutable( date_create( $current ) ); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} ?> --EXPECTF-- object(DateTime)#%d (3) { @@ -27,6 +30,4 @@ object(DateTime)#%d (3) { string(13) "Europe/London" } bool(true) - -Warning: DateTime::createFromImmutable() expects parameter 1 to be DateTimeImmutable, object given in %stests%eDateTime_createFromImmutable.php on line %d -NULL +DateTime::createFromImmutable(): Argument #1 ($object) must be of type DateTimeImmutable, object given diff --git a/ext/date/tests/DateTime_createFromInterface.phpt b/ext/date/tests/DateTime_createFromInterface.phpt new file mode 100644 index 0000000000..a1ad5a3784 --- /dev/null +++ b/ext/date/tests/DateTime_createFromInterface.phpt @@ -0,0 +1,79 @@ +--TEST-- +Tests for DateTime::createFromInterface +--INI-- +date.timezone=Europe/London +--FILE-- +<?php +$current = "2014-03-02 16:24:08"; + +$i = DateTime::createFromInterface( date_create( $current ) ); +var_dump( $i ); + +$i = DateTime::createFromInterface( date_create_immutable( $current ) ); +var_dump( $i ); + +$current = "2019-12-16 15:06:46 CET"; + +$i = DateTime::createFromInterface( date_create( $current ) ); +var_dump( $i ); + +$i = DateTime::createFromInterface( date_create_immutable( $current ) ); +var_dump( $i ); + +$current = "2019-12-16 15:08:20 +0100"; + +$i = DateTime::createFromInterface( date_create( $current ) ); +var_dump( $i ); + +$i = DateTime::createFromInterface( date_create_immutable( $current ) ); +var_dump( $i ); +?> +--EXPECTF-- +object(DateTime)#%d (3) { + ["date"]=> + string(26) "2014-03-02 16:24:08.000000" + ["timezone_type"]=> + int(3) + ["timezone"]=> + string(13) "Europe/London" +} +object(DateTime)#%d (3) { + ["date"]=> + string(26) "2014-03-02 16:24:08.000000" + ["timezone_type"]=> + int(3) + ["timezone"]=> + string(13) "Europe/London" +} +object(DateTime)#%d (3) { + ["date"]=> + string(26) "2019-12-16 15:06:46.000000" + ["timezone_type"]=> + int(2) + ["timezone"]=> + string(3) "CET" +} +object(DateTime)#%d (3) { + ["date"]=> + string(26) "2019-12-16 15:06:46.000000" + ["timezone_type"]=> + int(2) + ["timezone"]=> + string(3) "CET" +} +object(DateTime)#%d (3) { + ["date"]=> + string(26) "2019-12-16 15:08:20.000000" + ["timezone_type"]=> + int(1) + ["timezone"]=> + string(6) "+01:00" +} +object(DateTime)#%d (3) { + ["date"]=> + string(26) "2019-12-16 15:08:20.000000" + ["timezone_type"]=> + int(1) + ["timezone"]=> + string(6) "+01:00" +} diff --git a/ext/date/tests/DateTime_extends_basic1.phpt b/ext/date/tests/DateTime_extends_basic1.phpt index 04f4f76acc..1a4c004c89 100644 --- a/ext/date/tests/DateTime_extends_basic1.phpt +++ b/ext/date/tests/DateTime_extends_basic1.phpt @@ -11,12 +11,12 @@ echo "*** Testing basic DateTime inheritance() ***\n"; class DateTimeExt extends DateTime { - public static $format = "F j, Y, g:i:s a"; + public static $format = "F j, Y, g:i:s a"; - public function __toString() - { - return parent::format(self::$format); - } + public function __toString() + { + return parent::format(self::$format); + } } echo "\n-- Create an instance of DateTimeExt --\n"; @@ -33,7 +33,6 @@ echo "\n-- Invoke __toString again --\n"; echo $d . "\n"; ?> -===DONE=== --EXPECT-- *** Testing basic DateTime inheritance() *** @@ -46,4 +45,3 @@ May 1, 1967, 10:30:41 pm -- Invoke __toString again -- July 2, 1963, 10:45:30 am -===DONE=== diff --git a/ext/date/tests/DateTime_extends_basic2.phpt b/ext/date/tests/DateTime_extends_basic2.phpt index 364fd55514..03d1e03283 100644 --- a/ext/date/tests/DateTime_extends_basic2.phpt +++ b/ext/date/tests/DateTime_extends_basic2.phpt @@ -10,7 +10,7 @@ echo "*** Testing new DateTime() : with user space __construct magic method ***\ class DateTimeExt extends DateTime { - public function __construct ($date = null, DateTimeZone $dtz = null) + public function __construct ($date = null, DateTimeZone $dtz = null) { if($dtz === null) { @@ -24,8 +24,6 @@ $d = new DateTimeExt("1967-05-01 22:30:41"); echo $d->format("F j, Y, g:i:s a") . "\n"; ?> -===DONE=== --EXPECT-- *** Testing new DateTime() : with user space __construct magic method *** May 1, 1967, 10:30:41 pm -===DONE=== diff --git a/ext/date/tests/DateTime_extends_basic3.phpt b/ext/date/tests/DateTime_extends_basic3.phpt index cc44d72640..27fc602e00 100644 --- a/ext/date/tests/DateTime_extends_basic3.phpt +++ b/ext/date/tests/DateTime_extends_basic3.phpt @@ -1,5 +1,5 @@ --TEST-- -Test DateTime class inheritance : with user space fromat() method +Test DateTime class inheritance : with user space format() method --FILE-- <?php //Set the default time zone @@ -9,18 +9,16 @@ echo "*** Testing new DateTime() : with user format() method ***\n"; class DateTimeExt extends DateTime { - public function format($format = "F j, Y, g:i:s a") - { - return parent::format($format); - } + public function format($format = "F j, Y, g:i:s a") + { + return parent::format($format); + } } $d = new DateTimeExt("1967-05-01 22:30:41"); echo $d->format() . "\n"; ?> -===DONE=== --EXPECT-- *** Testing new DateTime() : with user format() method *** May 1, 1967, 10:30:41 pm -===DONE=== diff --git a/ext/date/tests/DateTime_fix_createFromFormat.phpt b/ext/date/tests/DateTime_fix_createFromFormat.phpt index dff0a0338c..ec1ca81c2a 100644 --- a/ext/date/tests/DateTime_fix_createFromFormat.phpt +++ b/ext/date/tests/DateTime_fix_createFromFormat.phpt @@ -21,9 +21,7 @@ echo "Format method: " . $orig->format("D., M. j, Y g:iA") . "\n"; echo "createFromFormat method: " . $fromFormat->format("D., M. j, Y g:iA") . "\n"; ?> -===DONE=== --EXPECT-- *** Testing clone on DateTime objects *** Format method: Thu., Nov. 29, 2012 5:00PM createFromFormat method: Thu., Nov. 29, 2012 5:00PM -===DONE=== diff --git a/ext/date/tests/DateTime_format_basic1.phpt b/ext/date/tests/DateTime_format_basic1.phpt index 883f9a7a8e..a7bbd29913 100644 --- a/ext/date/tests/DateTime_format_basic1.phpt +++ b/ext/date/tests/DateTime_format_basic1.phpt @@ -25,7 +25,6 @@ var_dump( $date->format( 'H:m:s \m \i\s\ \m\o\n\t\h') ); var_dump( $date->format( "H:i:s") ); ?> -===DONE=== --EXPECT-- *** Testing DateTime::format() : basic functionality *** string(23) "July 14, 2005, 10:30 pm" @@ -37,4 +36,3 @@ string(19) "it is the 14th day." string(28) "Thu Jul 14 22:30:41 BST 2005" string(19) "22:07:41 m is month" string(8) "22:30:41" -===DONE=== diff --git a/ext/date/tests/DateTime_format_basic2.phpt b/ext/date/tests/DateTime_format_basic2.phpt index 958b702ea4..fa5c1a24be 100644 --- a/ext/date/tests/DateTime_format_basic2.phpt +++ b/ext/date/tests/DateTime_format_basic2.phpt @@ -27,7 +27,6 @@ var_dump( $date->format( DateTime::RSS) ) ; var_dump( $date->format( DateTime::W3C) ) ; ?> -===DONE=== --EXPECT-- *** Testing date_format() : basic functionality - formatting coinstants *** string(25) "2005-07-14T22:30:41+01:00" @@ -41,4 +40,3 @@ string(31) "Thu, 14 Jul 2005 22:30:41 +0100" string(25) "2005-07-14T22:30:41+01:00" string(31) "Thu, 14 Jul 2005 22:30:41 +0100" string(25) "2005-07-14T22:30:41+01:00" -===DONE=== diff --git a/ext/date/tests/DateTime_getOffset_basic1.phpt b/ext/date/tests/DateTime_getOffset_basic1.phpt index 9a2d22f4a1..f6c7d8c8aa 100644 --- a/ext/date/tests/DateTime_getOffset_basic1.phpt +++ b/ext/date/tests/DateTime_getOffset_basic1.phpt @@ -20,9 +20,7 @@ echo "Winter offset: " . $winter->getOffset() / 3600 . " hours\n"; echo "Summer offset: " . $summer->getOffset() / 3600 . " hours\n"; ?> -===DONE=== --EXPECT-- *** Testing DateTime::getOffset() : basic functionality *** Winter offset: 0 hours Summer offset: 1 hours -===DONE=== diff --git a/ext/date/tests/DateTime_getTimeZone_basic1.phpt b/ext/date/tests/DateTime_getTimeZone_basic1.phpt index 3c2f76c640..d29812ad1c 100644 --- a/ext/date/tests/DateTime_getTimeZone_basic1.phpt +++ b/ext/date/tests/DateTime_getTimeZone_basic1.phpt @@ -24,10 +24,8 @@ $object->setTimeZone($la_time); var_dump( $object->getTimeZone()->getName() ); ?> -===DONE=== --EXPECT-- *** Testing DateTime::getTimezone() : basic functionality *** string(13) "Europe/London" string(16) "America/New_York" string(19) "America/Los_Angeles" -===DONE=== diff --git a/ext/date/tests/DateTime_modify_basic1.phpt b/ext/date/tests/DateTime_modify_basic1.phpt index 5b0d5bd2a1..3147ca63cc 100644 --- a/ext/date/tests/DateTime_modify_basic1.phpt +++ b/ext/date/tests/DateTime_modify_basic1.phpt @@ -29,11 +29,9 @@ $datetime->modify("last Sunday"); echo "After modification 4: " . $datetime->format("D, d M Y") . "\n"; ?> -===DONE=== --EXPECT-- *** Testing DateTime::modify() : basic functionality *** After modification 1: Sun, 01 Feb 2009 After modification 2: Tue, 10 Feb 2009 18:28:43 After modification 3: Thu, 12 Feb 2009 After modification 4: Sun, 08 Feb 2009 -===DONE=== diff --git a/ext/date/tests/DateTime_serialize.phpt b/ext/date/tests/DateTime_serialize.phpt index 48b8b01cf9..8424a3e082 100644 --- a/ext/date/tests/DateTime_serialize.phpt +++ b/ext/date/tests/DateTime_serialize.phpt @@ -16,7 +16,6 @@ var_dump($date2); var_dump( $date2->format( "F j, Y, g:i a") ); ?> -===DONE=== --EXPECTF-- object(DateTime)#%d (3) { ["date"]=> @@ -36,4 +35,3 @@ object(DateTime)#%d (3) { string(13) "Europe/London" } string(23) "July 14, 2005, 10:30 pm" -===DONE=== diff --git a/ext/date/tests/DateTime_setDate_basic1.phpt b/ext/date/tests/DateTime_setDate_basic1.phpt index e3c9c587ac..d8fe4989e7 100644 --- a/ext/date/tests/DateTime_setDate_basic1.phpt +++ b/ext/date/tests/DateTime_setDate_basic1.phpt @@ -22,9 +22,7 @@ $datetime->setDate(2008, 02, 01); echo $datetime->format(DATE_RFC2822) . "\n"; ?> -===DONE=== --EXPECT-- *** Testing DateTime::setDate() : basic functionality *** Fri, 30 Jan 2009 19:34:10 +0000 Fri, 01 Feb 2008 19:34:10 +0000 -===DONE=== diff --git a/ext/date/tests/DateTime_setISODate_basic1.phpt b/ext/date/tests/DateTime_setISODate_basic1.phpt index bcb7f30694..d4319bc60f 100644 --- a/ext/date/tests/DateTime_setISODate_basic1.phpt +++ b/ext/date/tests/DateTime_setISODate_basic1.phpt @@ -29,10 +29,8 @@ $datetime->setISODate(2008, 30, 3); echo "..same day last year was \"" . $datetime->format("D M j") . "\"\n"; ?> -===DONE=== --EXPECT-- *** Testing DateTime::setISODate() : basic functionality *** Week 40 of 2009 is in "September" Week 30 day 3 of 2009 is "Wed Jul 22" ..same day last year was "Wed Jul 23" -===DONE=== diff --git a/ext/date/tests/DateTime_setTime_basic1.phpt b/ext/date/tests/DateTime_setTime_basic1.phpt index e5505a0501..fff22c5e1a 100644 --- a/ext/date/tests/DateTime_setTime_basic1.phpt +++ b/ext/date/tests/DateTime_setTime_basic1.phpt @@ -34,7 +34,6 @@ $datetime->setTime(54, 25); echo "After modification5 " . $datetime ->format(DATE_RFC2822) . "\n"; ?> -===DONE=== --EXPECT-- *** Testing DateTime::setTime() : basic functionality *** Initial date: Sat, 31 Jan 2009 15:14:10 +0000 @@ -43,4 +42,3 @@ After modification2 Sat, 31 Jan 2009 19:05:59 +0000 After modification3 Sun, 01 Feb 2009 00:10:00 +0000 After modification4 Mon, 02 Feb 2009 23:35:47 +0000 After modification5 Wed, 04 Feb 2009 06:25:00 +0000 -===DONE=== diff --git a/ext/date/tests/DateTime_setTimezone_basic1.phpt b/ext/date/tests/DateTime_setTimezone_basic1.phpt index 90e799e20c..88da0ef33a 100644 --- a/ext/date/tests/DateTime_setTimezone_basic1.phpt +++ b/ext/date/tests/DateTime_setTimezone_basic1.phpt @@ -21,9 +21,7 @@ $datetime->setTimezone($la_time); echo "New timezone: " . date_timezone_get($datetime)->getName() . "\n"; ?> -===DONE=== --EXPECT-- *** Testing DateTime::setTimezone() : basic functionality *** Default timezone: Europe/London New timezone: America/Los_Angeles -===DONE=== diff --git a/ext/date/tests/ExtendDateTime.phpt b/ext/date/tests/ExtendDateTime.phpt index 164221709c..212d44ab82 100644 --- a/ext/date/tests/ExtendDateTime.phpt +++ b/ext/date/tests/ExtendDateTime.phpt @@ -9,4 +9,4 @@ class MyDateTime extends DateTime { } ?> --EXPECTF-- -Warning: Declaration of MyDateTime::__set_state() should be compatible with DateTime::__set_state(array $array) in %s on line %d +Fatal error: Declaration of MyDateTime::__set_state() must be compatible with DateTime::__set_state(array $array) in %s on line %d diff --git a/ext/date/tests/bug13142.phpt b/ext/date/tests/bug13142.phpt index 5550d5ce9c..80d4fa82fc 100644 --- a/ext/date/tests/bug13142.phpt +++ b/ext/date/tests/bug13142.phpt @@ -15,7 +15,7 @@ if (!@putenv("TZ=US/Eastern") || getenv("TZ") != 'US/Eastern') { <?php if (date('T') == 'GMT') { - putenv("TZ=EST5EDT4,M4.1.0,M10.5.0"); + putenv("TZ=EST5EDT4,M4.1.0,M10.5.0"); } echo date("r\n", strtotime("Sep 04 16:39:45 2001")); echo date("r\n", strtotime("Sep 04 2001 16:39:45")); diff --git a/ext/date/tests/bug20382-1.phpt b/ext/date/tests/bug20382-1.phpt index 162852115b..8c0583767a 100644 --- a/ext/date/tests/bug20382-1.phpt +++ b/ext/date/tests/bug20382-1.phpt @@ -4,12 +4,12 @@ Bug #20382 [1] (strtotime ("Monday", $date) produces wrong result on DST changeo date.timezone=Europe/Amsterdam --FILE-- <?php - $tStamp = mktime (17, 17, 17, 10, 27, 2004); - echo "tStamp=". date("l Y-m-d H:i:s T", $tStamp). "\n"; + $tStamp = mktime (17, 17, 17, 10, 27, 2004); + echo "tStamp=". date("l Y-m-d H:i:s T", $tStamp). "\n"; - $strtotime_timestamp = strtotime ("Monday", $tStamp); - echo "result=". date("l Y-m-d H:i:s T", $strtotime_timestamp). "\n"; - echo "wanted=Monday 2004-11-01 00:00:00 CET\n"; + $strtotime_timestamp = strtotime ("Monday", $tStamp); + echo "result=". date("l Y-m-d H:i:s T", $strtotime_timestamp). "\n"; + echo "wanted=Monday 2004-11-01 00:00:00 CET\n"; ?> --EXPECT-- tStamp=Wednesday 2004-10-27 17:17:17 CEST diff --git a/ext/date/tests/bug20382-2.phpt b/ext/date/tests/bug20382-2.phpt index 2488c4729e..d963708ce3 100644 --- a/ext/date/tests/bug20382-2.phpt +++ b/ext/date/tests/bug20382-2.phpt @@ -4,43 +4,43 @@ Bug #20382 [2] (strtotime ("Monday", $date) produces wrong result on DST changeo <?php $tests = array( - array("Europe/Andorra", 17, 17, 17, 1, 24764, 1970), - array("Asia/Dubai", 17, 17, 17, 1, 1, 1970), - array("Asia/Kabul", 17, 17, 17, 1, 1, 1970), - array("America/Antigua", 17, 17, 17, 1, 1, 1970), - array("America/Anguilla", 17, 17, 17, 1, 1, 1970), - array("Europe/Tirane", 17, 17, 17, 1, 4849, 1970), - array("Asia/Yerevan", 17, 17, 17, 1, 24764, 1970), - array("America/Curacao", 17, 17, 17, 1, 1, 1970), - array("Africa/Luanda", 17, 17, 17, 1, 1, 1970), - array("Antarctica/McMurdo", 17, 17, 17, 1, 24743, 1970), - array("Australia/Adelaide", 17, 17, 17, 1, 1, 1971), - array("Australia/Darwin", 17, 17, 17, 1, 88, 1971), - array("Australia/Perth", 17, 17, 17, 1, 1, 1971), - array("America/Aruba", 17, 17, 17, 1, 88, 1971), - array("Asia/Baku", 17, 17, 17, 1, 1, 1971), - array("Europe/Sarajevo", 17, 17, 17, 1, 1, 1971), - array("America/Barbados", 17, 17, 17, 1, 1, 1971), - array("Asia/Dacca", 17, 17, 17, 1, 1, 1971), - array("Europe/Brussels", 17, 17, 17, 1, 1, 1971), - array("Africa/Ouagadougou", 17, 17, 17, 1, 88, 1971), - array("Europe/Tirane", 17, 17, 17, 1, 4849, 1970), - array("America/Buenos_Aires", 17, 17, 17, 1, 1734, 1970), - array("America/Rosario", 17, 17, 17, 1, 1734, 1970), - array("Europe/Vienna", 17, 17, 17, 1, 3743, 1970), - array("Asia/Baku", 17, 17, 17, 1, 9490, 1970), + array("Europe/Andorra", 17, 17, 17, 1, 24764, 1970), + array("Asia/Dubai", 17, 17, 17, 1, 1, 1970), + array("Asia/Kabul", 17, 17, 17, 1, 1, 1970), + array("America/Antigua", 17, 17, 17, 1, 1, 1970), + array("America/Anguilla", 17, 17, 17, 1, 1, 1970), + array("Europe/Tirane", 17, 17, 17, 1, 4849, 1970), + array("Asia/Yerevan", 17, 17, 17, 1, 24764, 1970), + array("America/Curacao", 17, 17, 17, 1, 1, 1970), + array("Africa/Luanda", 17, 17, 17, 1, 1, 1970), + array("Antarctica/McMurdo", 17, 17, 17, 1, 24743, 1970), + array("Australia/Adelaide", 17, 17, 17, 1, 1, 1971), + array("Australia/Darwin", 17, 17, 17, 1, 88, 1971), + array("Australia/Perth", 17, 17, 17, 1, 1, 1971), + array("America/Aruba", 17, 17, 17, 1, 88, 1971), + array("Asia/Baku", 17, 17, 17, 1, 1, 1971), + array("Europe/Sarajevo", 17, 17, 17, 1, 1, 1971), + array("America/Barbados", 17, 17, 17, 1, 1, 1971), + array("Asia/Dacca", 17, 17, 17, 1, 1, 1971), + array("Europe/Brussels", 17, 17, 17, 1, 1, 1971), + array("Africa/Ouagadougou", 17, 17, 17, 1, 88, 1971), + array("Europe/Tirane", 17, 17, 17, 1, 4849, 1970), + array("America/Buenos_Aires", 17, 17, 17, 1, 1734, 1970), + array("America/Rosario", 17, 17, 17, 1, 1734, 1970), + array("Europe/Vienna", 17, 17, 17, 1, 3743, 1970), + array("Asia/Baku", 17, 17, 17, 1, 9490, 1970), ); foreach ($tests as $test) { - date_default_timezone_set($test[0]); - print "{$test[0]}\n"; - array_shift($test); - $timestamp = call_user_func_array('mktime', $test); - - print "ts = ". date("l Y-m-d H:i:s T", $timestamp). "\n"; - $strtotime_tstamp = strtotime("first monday", $timestamp); - print "result = ".date("l Y-m-d H:i:s T", $strtotime_tstamp)."\n"; - print "wanted = Monday 00:00:00\n\n"; + date_default_timezone_set($test[0]); + print "{$test[0]}\n"; + array_shift($test); + $timestamp = call_user_func_array('mktime', $test); + + print "ts = ". date("l Y-m-d H:i:s T", $timestamp). "\n"; + $strtotime_tstamp = strtotime("first monday", $timestamp); + print "result = ".date("l Y-m-d H:i:s T", $strtotime_tstamp)."\n"; + print "wanted = Monday 00:00:00\n\n"; } ?> --EXPECTF-- diff --git a/ext/date/tests/bug21399.phpt b/ext/date/tests/bug21399.phpt index a295c8bd8b..c7ad8caf4a 100644 --- a/ext/date/tests/bug21399.phpt +++ b/ext/date/tests/bug21399.phpt @@ -4,7 +4,7 @@ Bug #21399 (strtotime() request for "YYYYMMDDhhmmss [ZZZ]") date.timezone=GMT --FILE-- <?php - echo gmdate("Y-m-d H:i:s", strtotime("20050620091407 GMT")); + echo gmdate("Y-m-d H:i:s", strtotime("20050620091407 GMT")); ?> --EXPECT-- 2005-06-20 09:14:07 diff --git a/ext/date/tests/bug26198.phpt b/ext/date/tests/bug26198.phpt index c957bfcf7a..f59a628b62 100644 --- a/ext/date/tests/bug26198.phpt +++ b/ext/date/tests/bug26198.phpt @@ -2,9 +2,9 @@ Bug #26198 (strtotime handling of "M Y" and "Y M" format) --FILE-- <?php - date_default_timezone_set("GMT"); - echo gmdate("F Y (Y-m-d H:i:s T)\n", strtotime("Oct 2001")); - echo gmdate("M Y (Y-m-d H:i:s T)\n", strtotime("2001 Oct")); + date_default_timezone_set("GMT"); + echo gmdate("F Y (Y-m-d H:i:s T)\n", strtotime("Oct 2001")); + echo gmdate("M Y (Y-m-d H:i:s T)\n", strtotime("2001 Oct")); ?> --EXPECT-- October 2001 (2001-10-01 00:00:00 GMT) diff --git a/ext/date/tests/bug26317.phpt b/ext/date/tests/bug26317.phpt index 652cc67879..38c724ed57 100644 --- a/ext/date/tests/bug26317.phpt +++ b/ext/date/tests/bug26317.phpt @@ -10,9 +10,9 @@ if (!@putenv("TZ=GMT0") || getenv("TZ") != 'GMT0') { ?> --FILE-- <?php - echo date("Y-m-d H:i:s\n", strtotime("2003-11-19 16:20:42 Z")); - echo date("Y-m-d H:i:s\n", strtotime("2003-11-19 09:20:42 T")); - echo date("Y-m-d H:i:s\n", strtotime("2003-11-19 19:20:42 C")); + echo date("Y-m-d H:i:s\n", strtotime("2003-11-19 16:20:42 Z")); + echo date("Y-m-d H:i:s\n", strtotime("2003-11-19 09:20:42 T")); + echo date("Y-m-d H:i:s\n", strtotime("2003-11-19 19:20:42 C")); ?> --EXPECT-- 2003-11-19 16:20:42 diff --git a/ext/date/tests/bug26320.phpt b/ext/date/tests/bug26320.phpt index 48e901117c..563e39ab30 100644 --- a/ext/date/tests/bug26320.phpt +++ b/ext/date/tests/bug26320.phpt @@ -10,8 +10,8 @@ if (!@putenv("TZ=GMT0") || getenv("TZ") != 'GMT0') { ?> --FILE-- <?php - echo date("Y-m-d H:i:s\n", strtotime("2003-11-19T12:30:42")); - echo date("Y-m-d H:i:s\n", strtotime("2003-11-19T12:30:42Z")); + echo date("Y-m-d H:i:s\n", strtotime("2003-11-19T12:30:42")); + echo date("Y-m-d H:i:s\n", strtotime("2003-11-19T12:30:42Z")); ?> --EXPECT-- 2003-11-19 12:30:42 diff --git a/ext/date/tests/bug26694.phpt b/ext/date/tests/bug26694.phpt index 939b04c136..a82496124f 100644 --- a/ext/date/tests/bug26694.phpt +++ b/ext/date/tests/bug26694.phpt @@ -4,7 +4,7 @@ Bug #26694 (strtotime() request for "Sun, 21 Dec 2003 20:38:33 +0000 GMT") date.timezone=GMT --FILE-- <?php - echo gmdate("Y-m-d H:i:s", strtotime("Sun, 21 Dec 2003 20:38:33 +0000 GMT")); + echo gmdate("Y-m-d H:i:s", strtotime("Sun, 21 Dec 2003 20:38:33 +0000 GMT")); ?> --EXPECT-- 2003-12-21 20:38:33 diff --git a/ext/date/tests/bug27780.phpt b/ext/date/tests/bug27780.phpt index b1cfa831a2..f6f21e4185 100644 --- a/ext/date/tests/bug27780.phpt +++ b/ext/date/tests/bug27780.phpt @@ -8,37 +8,37 @@ if (defined('PHP_WINDOWS_VERSION_MAJOR')) { --FILE-- <?php $timezones = array ( - "America/Chicago", "Europe/Amsterdam", "Asia/Jerusalem", - "Asia/Singapore", "America/Sao_Paulo" + "America/Chicago", "Europe/Amsterdam", "Asia/Jerusalem", + "Asia/Singapore", "America/Sao_Paulo" ); $timestrings = array ( - "2004-04-07 00:00:00 -2 months +7 days +23 hours +59 minutes +59 seconds", - "2004-04-07 00:00:00 -2 months +7 days +23 hours +59 minutes +60 seconds", - "2004-04-07 00:00:00 -2 months +7 days +23 hours +59 minutes +61 seconds", - "2004-04-07 00:00:00 -21 days", - "2004-04-07 00:00:00 11 days ago", - "2004-04-07 00:00:00 -10 day +2 hours", - "2004-04-07 00:00:00 -1 day", - "2004-04-07 00:00:00", - "2004-04-07 00:00:00 +1 hour", - "2004-04-07 00:00:00 +2 hour", - "2004-04-07 00:00:00 +1 day", - "2004-04-07 00:00:00 1 day", - "2004-04-07 00:00:00 +21 days", + "2004-04-07 00:00:00 -2 months +7 days +23 hours +59 minutes +59 seconds", + "2004-04-07 00:00:00 -2 months +7 days +23 hours +59 minutes +60 seconds", + "2004-04-07 00:00:00 -2 months +7 days +23 hours +59 minutes +61 seconds", + "2004-04-07 00:00:00 -21 days", + "2004-04-07 00:00:00 11 days ago", + "2004-04-07 00:00:00 -10 day +2 hours", + "2004-04-07 00:00:00 -1 day", + "2004-04-07 00:00:00", + "2004-04-07 00:00:00 +1 hour", + "2004-04-07 00:00:00 +2 hour", + "2004-04-07 00:00:00 +1 day", + "2004-04-07 00:00:00 1 day", + "2004-04-07 00:00:00 +21 days", ); foreach ($timezones as $timezone) { - date_default_timezone_set($timezone); - echo $timezone, "\n"; + date_default_timezone_set($timezone); + echo $timezone, "\n"; - foreach ($timestrings as $timestring) { - $time = strtotime($timestring); + foreach ($timestrings as $timestring) { + $time = strtotime($timestring); - echo $time, strftime(" [%Y-%m-%d %H:%M:%S %Z]", $time), " [$timestring]\n"; - } + echo $time, strftime(" [%Y-%m-%d %H:%M:%S %Z]", $time), " [$timestring]\n"; + } - echo "\n"; + echo "\n"; } ?> --EXPECTF-- diff --git a/ext/date/tests/bug28024.phpt b/ext/date/tests/bug28024.phpt index b5f97bd5c9..8229f1cd7b 100644 --- a/ext/date/tests/bug28024.phpt +++ b/ext/date/tests/bug28024.phpt @@ -4,8 +4,8 @@ Bug #28024 (Changed behavior of strtotime()) date.timezone=Europe/Berlin --FILE-- <?php - echo strtotime("17:00 2004-01-01"), "\n"; - echo date("Y-m-d H:i:s T", strtotime("17:00 2004-01-01")); + echo strtotime("17:00 2004-01-01"), "\n"; + echo date("Y-m-d H:i:s T", strtotime("17:00 2004-01-01")); ?> --EXPECT-- 1072972800 diff --git a/ext/date/tests/bug29150.phpt b/ext/date/tests/bug29150.phpt index d91d68d919..15edffa898 100644 --- a/ext/date/tests/bug29150.phpt +++ b/ext/date/tests/bug29150.phpt @@ -4,7 +4,7 @@ Bug #29150 (Roman number format for months) date.timezone=GMT --FILE-- <?php - echo gmdate("Y-m-d H:i:s", strtotime("20 VI. 2005")); + echo gmdate("Y-m-d H:i:s", strtotime("20 VI. 2005")); ?> --EXPECT-- 2005-06-20 00:00:00 diff --git a/ext/date/tests/bug30096.phpt b/ext/date/tests/bug30096.phpt index 9ca45c4ffe..5d40aa3d34 100644 --- a/ext/date/tests/bug30096.phpt +++ b/ext/date/tests/bug30096.phpt @@ -1,5 +1,5 @@ --TEST-- -Bug #30096 (gmmktime does not return the corrent time) +Bug #30096 (gmmktime does not return the correct time) --INI-- error_reporting=2047 --FILE-- @@ -19,18 +19,18 @@ gm_date_check(03,00,00,10,30,2005); gm_date_check(04,00,00,10,30,2005); function gm_date_check($hour, $minute, $second, $month, $day, $year) { - global $ts, $tsold; + global $ts, $tsold; - echo "gmmktime($hour,$minute,$second,$month,$day,$year): "; + echo "gmmktime($hour,$minute,$second,$month,$day,$year): "; - $tsold = $ts; - $ts = gmmktime($hour, $minute, $second, $month, $day, $year); + $tsold = $ts; + $ts = gmmktime($hour, $minute, $second, $month, $day, $year); - echo $ts, " | gmdate('r', $ts):", gmdate('r', $ts); - if ($tsold > 0) { - echo " | Diff: " . ($ts - $tsold); - } - echo "\n"; + echo $ts, " | gmdate('r', $ts):", gmdate('r', $ts); + if ($tsold > 0) { + echo " | Diff: " . ($ts - $tsold); + } + echo "\n"; } ?> diff --git a/ext/date/tests/bug33578.phpt b/ext/date/tests/bug33578.phpt index 4ba6df8597..6c0d4d3bd7 100644 --- a/ext/date/tests/bug33578.phpt +++ b/ext/date/tests/bug33578.phpt @@ -2,14 +2,14 @@ Bug #33578 (strtotime() doesn't parse "11 Oct" format") --FILE-- <?php - date_default_timezone_set("UTC"); - echo date('m/d/Y', strtotime('Oct 11')), "\n"; - echo date('m/d/Y', strtotime('11 Oct')), "\n"; - echo date('m/d/Y', strtotime('11 Oct 2005')), "\n"; - echo date('m/d/Y', strtotime('Oct11')), "\n"; - echo date('m/d/Y', strtotime('11Oct')), "\n"; - echo date('m/d/Y', strtotime('11Oct 2005')), "\n"; - echo date('m/d/Y', strtotime('11Oct2005')), "\n"; + date_default_timezone_set("UTC"); + echo date('m/d/Y', strtotime('Oct 11')), "\n"; + echo date('m/d/Y', strtotime('11 Oct')), "\n"; + echo date('m/d/Y', strtotime('11 Oct 2005')), "\n"; + echo date('m/d/Y', strtotime('Oct11')), "\n"; + echo date('m/d/Y', strtotime('11Oct')), "\n"; + echo date('m/d/Y', strtotime('11Oct 2005')), "\n"; + echo date('m/d/Y', strtotime('11Oct2005')), "\n"; ?> --EXPECTF-- 10/11/%d diff --git a/ext/date/tests/bug33869.phpt b/ext/date/tests/bug33869.phpt index 6957a6b7e2..8f8e957c95 100644 --- a/ext/date/tests/bug33869.phpt +++ b/ext/date/tests/bug33869.phpt @@ -2,20 +2,20 @@ Bug #33869 (strtotime() doesn't parse "+1days" format) --FILE-- <?php - date_default_timezone_set("UTC"); - $tm = strtotime("2005-01-01 01:01:01"); - echo date(DATE_ISO8601, strtotime('+5days', $tm)); - echo "\n"; - echo date(DATE_ISO8601, strtotime('+1month', $tm)); - echo "\n"; - echo date(DATE_ISO8601, strtotime('+1year', $tm)); - echo "\n"; - echo date(DATE_ISO8601, strtotime('+5 days', $tm)); - echo "\n"; - echo date(DATE_ISO8601, strtotime('+1 month', $tm)); - echo "\n"; - echo date(DATE_ISO8601, strtotime('+1 year', $tm)); - echo "\n"; + date_default_timezone_set("UTC"); + $tm = strtotime("2005-01-01 01:01:01"); + echo date(DATE_ISO8601, strtotime('+5days', $tm)); + echo "\n"; + echo date(DATE_ISO8601, strtotime('+1month', $tm)); + echo "\n"; + echo date(DATE_ISO8601, strtotime('+1year', $tm)); + echo "\n"; + echo date(DATE_ISO8601, strtotime('+5 days', $tm)); + echo "\n"; + echo date(DATE_ISO8601, strtotime('+1 month', $tm)); + echo "\n"; + echo date(DATE_ISO8601, strtotime('+1 year', $tm)); + echo "\n"; ?> --EXPECT-- 2005-01-06T01:01:01+0000 diff --git a/ext/date/tests/bug33957.phpt b/ext/date/tests/bug33957.phpt index 43f14ee315..6ae97d7de8 100644 --- a/ext/date/tests/bug33957.phpt +++ b/ext/date/tests/bug33957.phpt @@ -5,33 +5,33 @@ Bug #33957 (gmdate('W')/date('W') sometimes returns wrong week number) date_default_timezone_set("UTC"); for ($i = 14; $i <= 31; $i++) { - echo "1992-12-$i ", date("W", strtotime("1992-12-$i")), "\n"; + echo "1992-12-$i ", date("W", strtotime("1992-12-$i")), "\n"; } for ($i = 1; $i <= 8; $i++) { - echo "1993-01-$i ", date("W", strtotime("1993-01-$i")), "\n"; + echo "1993-01-$i ", date("W", strtotime("1993-01-$i")), "\n"; } echo "----\n"; echo " "; foreach (range(1992, 2019) as $year) { - echo "$year "; + echo "$year "; } echo "\n"; for ($i = 14; $i <= 31; $i++) { - echo " (12-$i) "; - foreach (range(1992, 2019) as $year) { - echo sprintf(" %02d-", date("W", strtotime("$year-12-$i"))); - echo sprintf("%04d ", date("o", strtotime("$year-12-$i"))); - } - echo "\n"; + echo " (12-$i) "; + foreach (range(1992, 2019) as $year) { + echo sprintf(" %02d-", date("W", strtotime("$year-12-$i"))); + echo sprintf("%04d ", date("o", strtotime("$year-12-$i"))); + } + echo "\n"; } for ($i = 1; $i <= 18; $i++) { - printf("+1 (01-%02d) ", $i); - foreach (range(1993, 2020) as $year) { - echo sprintf(" %02d-", date("W", strtotime("$year-1-$i"))); - echo sprintf("%04d ", date("o", strtotime("$year-1-$i"))); - } - echo "\n"; + printf("+1 (01-%02d) ", $i); + foreach (range(1993, 2020) as $year) { + echo sprintf(" %02d-", date("W", strtotime("$year-1-$i"))); + echo sprintf("%04d ", date("o", strtotime("$year-1-$i"))); + } + echo "\n"; } echo "----\n"; ?> diff --git a/ext/date/tests/bug34676.phpt b/ext/date/tests/bug34676.phpt index 6f616feb40..ec2fcf9270 100644 --- a/ext/date/tests/bug34676.phpt +++ b/ext/date/tests/bug34676.phpt @@ -5,12 +5,12 @@ Bug #34676 (missing support for strtotime("midnight") and strtotime("noon")) date_default_timezone_set("UTC"); $tests = array( - 'noon', 'midnight' + 'noon', 'midnight' ); foreach ($tests as $test) { - $t = strtotime("2005-12-22 ". $test); - printf("%-10s => %s\n", $test, date(DATE_ISO8601, $t)); + $t = strtotime("2005-12-22 ". $test); + printf("%-10s => %s\n", $test, date(DATE_ISO8601, $t)); } ?> diff --git a/ext/date/tests/bug34771.phpt b/ext/date/tests/bug34771.phpt index a27d085a1d..d3134d1d6b 100644 --- a/ext/date/tests/bug34771.phpt +++ b/ext/date/tests/bug34771.phpt @@ -5,15 +5,15 @@ Bug #34771 (strtotime() fails with 1-12am/pm) date_default_timezone_set("UTC"); $tests = array( - '12am', '1am', '1pm', - '12a.m.', '1a.m.', '1p.m.', - '12:00am', '1:00am', '1:00pm', - '12:00a.m.', '1:00a.m.', '1:00p.m.' + '12am', '1am', '1pm', + '12a.m.', '1a.m.', '1p.m.', + '12:00am', '1:00am', '1:00pm', + '12:00a.m.', '1:00a.m.', '1:00p.m.' ); foreach ($tests as $test) { - $t = strtotime("2005-12-22 ". $test); - printf("%-10s => %s\n", $test, date(DATE_ISO8601, $t)); + $t = strtotime("2005-12-22 ". $test); + printf("%-10s => %s\n", $test, date(DATE_ISO8601, $t)); } ?> diff --git a/ext/date/tests/bug35425.phpt b/ext/date/tests/bug35425.phpt index e55a4f5219..ed9f87fd58 100644 --- a/ext/date/tests/bug35425.phpt +++ b/ext/date/tests/bug35425.phpt @@ -7,7 +7,7 @@ date.timezone=America/Montreal $time = mktime(1,1,1,1,1,2005); foreach (array('B','d','h','H','i','I','L','m','s','t','U','w','W','y','Y','z','Z') as $v) { - var_dump(idate($v, $time)); + var_dump(idate($v, $time)); } ?> diff --git a/ext/date/tests/bug35624.phpt b/ext/date/tests/bug35624.phpt index 722adba823..39fe555224 100644 --- a/ext/date/tests/bug35624.phpt +++ b/ext/date/tests/bug35624.phpt @@ -7,9 +7,9 @@ date_default_timezone_set("UTC"); $days = array("monday","mon","tuesday","tue","wednesday","wed","thursday","thu","friday","fri","saturday","sat","sunday","sun"); foreach ($days as $day) { - echo date("D", strtotime($day)); - echo date("D", strtotime(ucfirst($day))); - echo "\n"; + echo date("D", strtotime($day)); + echo date("D", strtotime(ucfirst($day))); + echo "\n"; } ?> --EXPECT-- diff --git a/ext/date/tests/bug35885.phpt b/ext/date/tests/bug35885.phpt index b3074f7f34..974c2c2c85 100644 --- a/ext/date/tests/bug35885.phpt +++ b/ext/date/tests/bug35885.phpt @@ -12,8 +12,8 @@ $res = ($ts == $ts2); var_dump($res); if (!$res) { - var_dump($ts); - var_dump($ts2); + var_dump($ts); + var_dump($ts2); } ?> diff --git a/ext/date/tests/bug36988.phpt b/ext/date/tests/bug36988.phpt index ab0f3a3c8a..3235980851 100644 --- a/ext/date/tests/bug36988.phpt +++ b/ext/date/tests/bug36988.phpt @@ -6,7 +6,11 @@ Bug #36988 (mktime freezes on long numbers) <?php date_default_timezone_set('GMT'); $start = microtime(true); -$a = mktime(1, 1, 1, 1, 1, 11111111111); +try { + $a = mktime(1, 1, 1, 1, 1, 11111111111); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} ?> ---EXPECTF-- -Warning: mktime() expects parameter 6 to be int, float given in %s on line %d +--EXPECT-- +mktime(): Argument #6 ($year) must be of type ?int, float given diff --git a/ext/date/tests/bug37747.phpt b/ext/date/tests/bug37747.phpt index 465f791c41..8c3d000341 100644 --- a/ext/date/tests/bug37747.phpt +++ b/ext/date/tests/bug37747.phpt @@ -4,7 +4,7 @@ Bug #37747 (strtotime segfaults when given "nextyear") <?php date_default_timezone_set("Europe/Oslo"); var_dump(strtotime("nextyear")); - echo "ALIVE\n"; + echo "ALIVE\n"; ?> --EXPECT-- bool(false) diff --git a/ext/date/tests/bug42910.phpt b/ext/date/tests/bug42910.phpt index e741db2ebc..f93ccedeaf 100644 --- a/ext/date/tests/bug42910.phpt +++ b/ext/date/tests/bug42910.phpt @@ -2,18 +2,18 @@ Bug #42910 (Constructing DateTime with TimeZone Indicator invalidates DateTimeZone) --FILE-- <?php - date_default_timezone_set('America/Los_Angeles'); - $foo = new DateTime('2007-03-11'); - $bar = new DateTime('2007-03-11T00:00:00-0800'); + date_default_timezone_set('America/Los_Angeles'); + $foo = new DateTime('2007-03-11'); + $bar = new DateTime('2007-03-11T00:00:00-0800'); - print $foo->format(DateTime::ISO8601) . ' - ' . $foo->getTimezone()->getName() . ' - ' . $foo->format('U') . "\r\n"; - print $bar->format(DateTime::ISO8601) . ' - ' . $bar->getTimezone()->getName() . ' - ' . $bar->format('U') . "\r\n"; + print $foo->format(DateTime::ISO8601) . ' - ' . $foo->getTimezone()->getName() . ' - ' . $foo->format('U') . "\r\n"; + print $bar->format(DateTime::ISO8601) . ' - ' . $bar->getTimezone()->getName() . ' - ' . $bar->format('U') . "\r\n"; - $foo->setDate(2007, 03, 12); - $bar->setDate(2007, 03, 12); + $foo->setDate(2007, 03, 12); + $bar->setDate(2007, 03, 12); - print $foo->format(DateTime::ISO8601) . ' - ' . $foo->getTimezone()->getName() . ' - ' . $foo->format('U') . "\r\n"; - print $bar->format(DateTime::ISO8601) . ' - ' . $bar->getTimezone()->getName() . ' - ' . $bar->format('U') . "\r\n"; + print $foo->format(DateTime::ISO8601) . ' - ' . $foo->getTimezone()->getName() . ' - ' . $foo->format('U') . "\r\n"; + print $bar->format(DateTime::ISO8601) . ' - ' . $bar->getTimezone()->getName() . ' - ' . $bar->format('U') . "\r\n"; // -------------- diff --git a/ext/date/tests/bug43808.phpt b/ext/date/tests/bug43808.phpt index 74b2317a20..9a1c4fad1f 100644 --- a/ext/date/tests/bug43808.phpt +++ b/ext/date/tests/bug43808.phpt @@ -5,7 +5,7 @@ Bug #43808 (date_create never fails (even when it should)) $date = date_create('asdfasdf'); if ($date instanceof DateTime) { - echo "this is wrong, should be bool"; + echo "this is wrong, should be bool"; } var_dump( $date ); diff --git a/ext/date/tests/bug44562.phpt b/ext/date/tests/bug44562.phpt index 5610474108..b4b721168f 100644 --- a/ext/date/tests/bug44562.phpt +++ b/ext/date/tests/bug44562.phpt @@ -6,11 +6,11 @@ date_default_timezone_set('Europe/Oslo'); try { - $dp = new DatePeriod('2D'); + $dp = new DatePeriod('2D'); } catch ( Exception $e ) { - echo $e->getMessage(), "\n"; + echo $e->getMessage(), "\n"; } $begin = new DateTime( "2008-07-20T22:44:53+0200" ); @@ -19,7 +19,7 @@ $interval = DateInterval::createFromDateString( "1 day" ); $dp = new DatePeriod( $begin, $interval, 10 ); foreach ( $dp as $d ) { - var_dump ($d->format( DATE_ISO8601 ) ); + var_dump ($d->format( DATE_ISO8601 ) ); } ?> diff --git a/ext/date/tests/bug44742.phpt b/ext/date/tests/bug44742.phpt index 48952b4e6c..e87c1acb06 100644 --- a/ext/date/tests/bug44742.phpt +++ b/ext/date/tests/bug44742.phpt @@ -4,22 +4,22 @@ Bug #44742 (timezone_offset_get() causes segmentation faults) <?php date_default_timezone_set('Europe/London'); $dates = array( - "2008-04-11 00:00:00+0000", - "2008-04-11 00:00:00+0200", - "2008-04-11 00:00:00+0330", - "2008-04-11 00:00:00-0500", - "2008-04-11 00:00:00-1130", - "2008-04-11 00:00:00 CEST", - "2008-04-11 00:00:00 CET", - "2008-04-11 00:00:00 UTC", - "2008-04-11 00:00:00 America/New_York", - "2008-04-11 00:00:00 Europe/Oslo", - "2008-04-11 00:00:00 Asia/Singapore", + "2008-04-11 00:00:00+0000", + "2008-04-11 00:00:00+0200", + "2008-04-11 00:00:00+0330", + "2008-04-11 00:00:00-0500", + "2008-04-11 00:00:00-1130", + "2008-04-11 00:00:00 CEST", + "2008-04-11 00:00:00 CET", + "2008-04-11 00:00:00 UTC", + "2008-04-11 00:00:00 America/New_York", + "2008-04-11 00:00:00 Europe/Oslo", + "2008-04-11 00:00:00 Asia/Singapore", ); foreach ($dates as $date) { - $date = date_create($date); - var_dump(timezone_offset_get(date_timezone_get($date), $date)); + $date = date_create($date); + var_dump(timezone_offset_get(date_timezone_get($date), $date)); } ?> --EXPECT-- diff --git a/ext/date/tests/bug45543.phpt b/ext/date/tests/bug45543.phpt index 42a97ab20c..ed785a715a 100644 --- a/ext/date/tests/bug45543.phpt +++ b/ext/date/tests/bug45543.phpt @@ -5,21 +5,21 @@ date.timezone=UTC --FILE-- <?php $test_dates = array( - '2008-01-01 12:00:00 PDT', - '2008-01-01 12:00:00 +02:00', + '2008-01-01 12:00:00 PDT', + '2008-01-01 12:00:00 +02:00', ); foreach ($test_dates as $test_date) { - $d1 = new DateTime($test_date); - $d2 = new DateTime('2008-01-01 12:00:00 UTC'); - echo $d1->format(DATE_ISO8601), PHP_EOL; - echo $d2->format(DATE_ISO8601), PHP_EOL; - $tz = $d1->getTimeZone(); - $d2->setTimeZone($tz); - echo $d1->format(DATE_ISO8601), PHP_EOL; - echo $d2->format(DATE_ISO8601), PHP_EOL; - echo PHP_EOL; + $d1 = new DateTime($test_date); + $d2 = new DateTime('2008-01-01 12:00:00 UTC'); + echo $d1->format(DATE_ISO8601), PHP_EOL; + echo $d2->format(DATE_ISO8601), PHP_EOL; + $tz = $d1->getTimeZone(); + $d2->setTimeZone($tz); + echo $d1->format(DATE_ISO8601), PHP_EOL; + echo $d2->format(DATE_ISO8601), PHP_EOL; + echo PHP_EOL; } --EXPECT-- 2008-01-01T12:00:00-0700 diff --git a/ext/date/tests/bug48476.phpt b/ext/date/tests/bug48476.phpt index 1335025c76..139c2e17e2 100644 --- a/ext/date/tests/bug48476.phpt +++ b/ext/date/tests/bug48476.phpt @@ -3,29 +3,35 @@ Bug #48476 (cloning extended DateTime class without calling parent::__constr cra --FILE-- <?php class MyDateTime extends DateTime { - public function __construct() { } + public function __construct() { } } class MyDateTimeZone extends DateTimeZone { - public function __construct() { } + public function __construct() { } } $o = new MyDateTime; -var_dump($o->format("d")); +try { + var_dump($o->format("d")); +} catch (Error $e) { + echo $e->getMessage(), "\n"; +} $x = clone $o; -var_dump($x->format("d")); +try { + var_dump($x->format("d")); +} catch (Error $e) { + echo $e->getMessage(), "\n"; +} clone $o; - -var_dump(timezone_location_get(clone new MyDateTimezone)); +try { + var_dump(timezone_location_get(clone new MyDateTimezone)); +} catch (Error $e) { + echo $e->getMessage(), "\n"; +} ?> ---EXPECTF-- -Warning: DateTime::format(): The DateTime object has not been correctly initialized by its constructor in %sbug48476.php on line 10 -bool(false) - -Warning: DateTime::format(): The DateTime object has not been correctly initialized by its constructor in %sbug48476.php on line 13 -bool(false) - -Warning: timezone_location_get(): The DateTimeZone object has not been correctly initialized by its constructor in %sbug48476.php on line 18 -bool(false) +--EXPECT-- +The DateTime object has not been correctly initialized by its constructor +The DateTime object has not been correctly initialized by its constructor +The DateTimeZone object has not been correctly initialized by its constructor diff --git a/ext/date/tests/bug50392.phpt b/ext/date/tests/bug50392.phpt index 9b1002317d..64def49f66 100644 --- a/ext/date/tests/bug50392.phpt +++ b/ext/date/tests/bug50392.phpt @@ -7,14 +7,14 @@ date_default_timezone_set('Europe/Bratislava'); $base = '2009-03-01 18:00:00'; for ($i = 0; $i < 8; $i++) { - $string = $base . '.' . str_repeat($i, $i); - echo $string, "\n- "; - $result = date_parse_from_format('Y-m-d H:i:s.u', $string); - echo $result['fraction'] ? $result['fraction'] : 'X', "\n"; - foreach( $result['errors'] as $error ) { - echo "- ", $error, "\n"; - } - echo "\n"; + $string = $base . '.' . str_repeat($i, $i); + echo $string, "\n- "; + $result = date_parse_from_format('Y-m-d H:i:s.u', $string); + echo $result['fraction'] ? $result['fraction'] : 'X', "\n"; + foreach( $result['errors'] as $error ) { + echo "- ", $error, "\n"; + } + echo "\n"; } ?> --EXPECT-- diff --git a/ext/date/tests/bug51096.phpt b/ext/date/tests/bug51096.phpt index 2b479a94a6..dafb60bcde 100644 --- a/ext/date/tests/bug51096.phpt +++ b/ext/date/tests/bug51096.phpt @@ -3,26 +3,26 @@ Bug #51096 (Test for "first day" vs "first day of") --FILE-- <?php $tests = array( - 'first day', - 'last day', - 'next month', - 'first day next month', - 'last day next month', - 'first day of next month', - 'last day of next month' + 'first day', + 'last day', + 'next month', + 'first day next month', + 'last day next month', + 'first day of next month', + 'last day of next month' ); foreach ( $tests as $test ) { - $result = date_parse( $test ); - $rel = $result['relative']; - echo $test, "\n- month: ", $rel['month'], '; day: ', $rel['day'], - '; first-day-of: ', isset( $rel['first_day_of_month'] ) ? 'true' : 'false', - '; last-day-of: ', isset( $rel['last_day_of_month'] ) ? 'true' : 'false', "\n"; - $date = new DateTime( '2010-03-06 15:21 UTC' ); - echo '- ', $date->format( DateTime::ISO8601 ); - $date->modify( $test ); - echo ' -> ', $date->format( DateTime::ISO8601 ), "\n\n"; + $result = date_parse( $test ); + $rel = $result['relative']; + echo $test, "\n- month: ", $rel['month'], '; day: ', $rel['day'], + '; first-day-of: ', isset( $rel['first_day_of_month'] ) ? 'true' : 'false', + '; last-day-of: ', isset( $rel['last_day_of_month'] ) ? 'true' : 'false', "\n"; + $date = new DateTime( '2010-03-06 15:21 UTC' ); + echo '- ', $date->format( DateTime::ISO8601 ); + $date->modify( $test ); + echo ' -> ', $date->format( DateTime::ISO8601 ), "\n\n"; } ?> --EXPECT-- diff --git a/ext/date/tests/bug51866.phpt b/ext/date/tests/bug51866.phpt index 9481aebe9d..1874e32706 100644 --- a/ext/date/tests/bug51866.phpt +++ b/ext/date/tests/bug51866.phpt @@ -5,22 +5,22 @@ Bug #51866 (Lenient parsing with parseFromFormat) date_default_timezone_set('UTC'); $tests = array( - array( 'Y-m-d', '2001-11-29 13:20:01' ), - array( 'Y-m-d+', '2001-11-29 13:20:01' ), - array( 'Y-m-d +', '2001-11-29 13:20:01' ), - array( 'Y-m-d+', '2001-11-29' ), - array( 'Y-m-d +', '2001-11-29' ), - array( 'Y-m-d +', '2001-11-29 ' ), + array( 'Y-m-d', '2001-11-29 13:20:01' ), + array( 'Y-m-d+', '2001-11-29 13:20:01' ), + array( 'Y-m-d +', '2001-11-29 13:20:01' ), + array( 'Y-m-d+', '2001-11-29' ), + array( 'Y-m-d +', '2001-11-29' ), + array( 'Y-m-d +', '2001-11-29 ' ), ); foreach( $tests as $test ) { - list($format, $str) = $test; - var_dump($format, $str); - $d = DateTime::createFromFormat($format, $str); - var_dump($d); - var_dump(DateTime::getLastErrors()); + list($format, $str) = $test; + var_dump($format, $str); + $d = DateTime::createFromFormat($format, $str); + var_dump($d); + var_dump(DateTime::getLastErrors()); - echo "\n\n"; + echo "\n\n"; } --EXPECTF-- string(5) "Y-m-d" diff --git a/ext/date/tests/bug52062.phpt b/ext/date/tests/bug52062.phpt index cbcccf84b9..de2936c853 100644 --- a/ext/date/tests/bug52062.phpt +++ b/ext/date/tests/bug52062.phpt @@ -13,7 +13,11 @@ var_dump($d->format('Y-m-d H:i:s U')); var_dump($d->getTimestamp()); var_dump($d->format('U')); -$d->setTimestamp(100000000000); +try { + $d->setTimestamp(100000000000); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} var_dump($d->format('Y-m-d H:i:s U')); var_dump($d->getTimestamp()); @@ -24,8 +28,7 @@ var_dump($i->format('%s')); string(32) "5138-11-16 09:46:40 100000000000" bool(false) string(12) "100000000000" - -Warning: DateTime::setTimestamp() expects parameter 1 to be int, float given in %s on line %d +DateTime::setTimestamp(): Argument #1 ($timestamp) must be of type int, float given string(32) "5138-11-16 09:46:40 100000000000" bool(false) string(10) "1215752192" diff --git a/ext/date/tests/bug52808.phpt b/ext/date/tests/bug52808.phpt index 810874858f..10776923c0 100644 --- a/ext/date/tests/bug52808.phpt +++ b/ext/date/tests/bug52808.phpt @@ -4,22 +4,22 @@ Bug #52808 (Segfault when specifying interval as two dates) <?php date_default_timezone_set('Europe/Oslo'); $intervals = array( - "2008-05-11T15:30:00Z/2007-03-01T13:00:00Z", - "2007-05-11T15:30:00Z/2008-03-01T13:00:00Z", - "2007-05-11T15:30:00Z 2008-03-01T13:00:00Z", - "2007-05-11T15:30:00Z/", - "2007-05-11T15:30:00Z", - "2007-05-11T15:30:00Z/:00Z", + "2008-05-11T15:30:00Z/2007-03-01T13:00:00Z", + "2007-05-11T15:30:00Z/2008-03-01T13:00:00Z", + "2007-05-11T15:30:00Z 2008-03-01T13:00:00Z", + "2007-05-11T15:30:00Z/", + "2007-05-11T15:30:00Z", + "2007-05-11T15:30:00Z/:00Z", ); foreach($intervals as $iv) { try { - $di = new DateInterval($iv); - var_dump($di); + $di = new DateInterval($iv); + var_dump($di); } catch ( Exception $e ) { - echo $e->getMessage(), "\n"; + echo $e->getMessage(), "\n"; } } echo "==DONE==\n"; diff --git a/ext/date/tests/bug53437.phpt b/ext/date/tests/bug53437.phpt index cac93a2ef0..f19f073aa9 100644 --- a/ext/date/tests/bug53437.phpt +++ b/ext/date/tests/bug53437.phpt @@ -22,7 +22,6 @@ foreach($dpu as $dt) { echo $dt->format('Y-m-d H:i:s')."\r\n"; } ?> -==DONE== --EXPECTF-- Original: 2010-01-01 00:00:00 @@ -155,4 +154,3 @@ Unserialized: 2010-01-01 00:00:00 2010-01-02 00:00:00 2010-01-03 00:00:00 -==DONE== diff --git a/ext/date/tests/bug53437_var2.phpt b/ext/date/tests/bug53437_var2.phpt index 51cc28943b..7a87b38421 100644 --- a/ext/date/tests/bug53437_var2.phpt +++ b/ext/date/tests/bug53437_var2.phpt @@ -11,7 +11,6 @@ $di1 = unserialize($s); var_dump($di0, $di1); ?> -==DONE== --EXPECT-- object(DateInterval)#1 (16) { ["y"]=> @@ -81,4 +80,3 @@ object(DateInterval)#2 (16) { ["have_special_relative"]=> int(0) } -==DONE== diff --git a/ext/date/tests/bug53437_var3.phpt b/ext/date/tests/bug53437_var3.phpt index 6738f14be7..44e6a80c89 100644 --- a/ext/date/tests/bug53437_var3.phpt +++ b/ext/date/tests/bug53437_var3.phpt @@ -10,7 +10,6 @@ $di = unserialize($s); var_dump($di); ?> -==DONE== --EXPECTF-- object(DateInterval)#%d (16) { ["y"]=> @@ -46,4 +45,3 @@ object(DateInterval)#%d (16) { ["f"]=> float(-1) } -==DONE== diff --git a/ext/date/tests/bug53437_var4.phpt b/ext/date/tests/bug53437_var4.phpt index 189c15cb1b..b53483ab7f 100644 --- a/ext/date/tests/bug53437_var4.phpt +++ b/ext/date/tests/bug53437_var4.phpt @@ -9,18 +9,17 @@ $dt = new DateTime('2009-10-11'); $df = $dt->diff(new DateTime('2009-10-13')); var_dump($df, - $df->y, - $df->m, - $df->d, - $df->h, - $df->i, - $df->s, - $df->f, - $df->invert, - $df->days); + $df->y, + $df->m, + $df->d, + $df->h, + $df->i, + $df->s, + $df->f, + $df->invert, + $df->days); ?> -==DONE== --EXPECTF-- object(DateInterval)#%d (16) { ["y"]=> @@ -65,4 +64,3 @@ int(0) float(0) int(0) int(2) -==DONE== diff --git a/ext/date/tests/bug53437_var5.phpt b/ext/date/tests/bug53437_var5.phpt index 38783b1545..baffbb484a 100644 --- a/ext/date/tests/bug53437_var5.phpt +++ b/ext/date/tests/bug53437_var5.phpt @@ -10,7 +10,6 @@ $di = unserialize($s); var_dump($di); ?> -==DONE== --EXPECTF-- object(DateInterval)#%d (16) { ["y"]=> @@ -46,4 +45,3 @@ object(DateInterval)#%d (16) { ["f"]=> float(-1) } -==DONE== diff --git a/ext/date/tests/bug53437_var6.phpt b/ext/date/tests/bug53437_var6.phpt index 633fcb3f38..f5ff22c4a4 100644 --- a/ext/date/tests/bug53437_var6.phpt +++ b/ext/date/tests/bug53437_var6.phpt @@ -10,7 +10,6 @@ $di = unserialize($s); var_dump($di); ?> -==DONE== --EXPECTF-- object(DateInterval)#%d (16) { ["y"]=> @@ -46,4 +45,3 @@ object(DateInterval)#%d (16) { ["have_special_relative"]=> int(0) } -==DONE== diff --git a/ext/date/tests/bug54283.phpt b/ext/date/tests/bug54283.phpt index 9a8a07ce5a..65669b6b39 100644 --- a/ext/date/tests/bug54283.phpt +++ b/ext/date/tests/bug54283.phpt @@ -4,9 +4,9 @@ Bug #54283 (new DatePeriod(NULL) causes crash) <?php try { - var_dump(new DatePeriod(NULL)); + var_dump(new DatePeriod(NULL)); } catch (Exception $e) { - var_dump($e->getMessage()); + var_dump($e->getMessage()); } ?> diff --git a/ext/date/tests/bug61642.phpt b/ext/date/tests/bug61642.phpt index 872ceb4f3e..b8130f05aa 100644 --- a/ext/date/tests/bug61642.phpt +++ b/ext/date/tests/bug61642.phpt @@ -12,26 +12,26 @@ $dates = array('2012-03-29', '2012-03-30', '2012-03-31', '2012-04-01', '2012-04- $header = array(); foreach ($dates as $startdate) { - $date = new DateTime($startdate); + $date = new DateTime($startdate); - $header[] = $date->format('Y-m-d D'); + $header[] = $date->format('Y-m-d D'); } echo '### ', implode(' ', $header), "\n\n"; foreach ($weekdays as $days) { - $line = array(); + $line = array(); - printf('%+3d ', $days); + printf('%+3d ', $days); - foreach ($dates as $startdate) { - $date = new DateTime($startdate); - $date->modify("{$days} weekdays"); + foreach ($dates as $startdate) { + $date = new DateTime($startdate); + $date->modify("{$days} weekdays"); - $line[] = $date->format('Y-m-d D'); - } + $line[] = $date->format('Y-m-d D'); + } - echo implode(' ', $line), "\n"; + echo implode(' ', $line), "\n"; } ?> --EXPECT-- diff --git a/ext/date/tests/bug62500.phpt b/ext/date/tests/bug62500.phpt index 6952332014..3afa7a561b 100644 --- a/ext/date/tests/bug62500.phpt +++ b/ext/date/tests/bug62500.phpt @@ -23,6 +23,6 @@ try { NULL int(3) -Notice: Undefined property: Crasher::$2 in %sbug62500.php on line %d +Warning: Undefined property: Crasher::$2 in %s on line %d NULL string(%s) "DateInterval::__construct(): Unknown or bad format (blah)" diff --git a/ext/date/tests/bug63391.phpt b/ext/date/tests/bug63391.phpt index a29d25e730..58da985e08 100644 --- a/ext/date/tests/bug63391.phpt +++ b/ext/date/tests/bug63391.phpt @@ -8,7 +8,7 @@ print "Date PHP\n"; print "---------- ---\n"; $dates = array('1599-12-30', '1599-12-31', '1600-01-01', '1600-01-02'); foreach ($dates as $date) { - echo date_create($date)->format('Y-m-d D'), "\n"; + echo date_create($date)->format('Y-m-d D'), "\n"; } ?> --EXPECT-- diff --git a/ext/date/tests/bug63435.phpt b/ext/date/tests/bug63435.phpt index dcec6e46e7..9dbc2fda12 100644 --- a/ext/date/tests/bug63435.phpt +++ b/ext/date/tests/bug63435.phpt @@ -5,11 +5,11 @@ date.timezone=UTC --FILE-- <?php for ($i=1 ; $i<999 ; $i++) { - $datetime = Datetime::createFromFormat("u", sprintf("%06ld", $i)); - $res = $datetime->format("u"); - if ($res != $i) { - echo "$i != $res\n"; - } + $datetime = Datetime::createFromFormat("u", sprintf("%06ld", $i)); + $res = $datetime->format("u"); + if ($res != $i) { + echo "$i != $res\n"; + } } echo "Done"; --EXPECT-- diff --git a/ext/date/tests/bug63740.phpt b/ext/date/tests/bug63740.phpt index 18c5a57d77..d0056987cd 100644 --- a/ext/date/tests/bug63740.phpt +++ b/ext/date/tests/bug63740.phpt @@ -3,28 +3,28 @@ Bug #63740 (strtotime seems to use both sunday and monday as start of week) --FILE-- <?php $dates = [ - '2015-07-04', - '2015-07-05', - '2015-07-06', - '2015-07-07', - '2015-07-08', - '2015-07-09', - '2015-07-10', - '2015-07-11', - '2015-07-12', - '2015-07-13', - '2015-07-14', + '2015-07-04', + '2015-07-05', + '2015-07-06', + '2015-07-07', + '2015-07-08', + '2015-07-09', + '2015-07-10', + '2015-07-11', + '2015-07-12', + '2015-07-13', + '2015-07-14', ]; foreach ( $dates as $date ) { - $dt = new DateTimeImmutable( "$date 00:00 UTC" ); + $dt = new DateTimeImmutable( "$date 00:00 UTC" ); - echo $dt->format( "D Y-m-d H:i" ), " → "; + echo $dt->format( "D Y-m-d H:i" ), " → "; - $dtn = $dt->modify( "this week" ); + $dtn = $dt->modify( "this week" ); - echo $dtn->format( "D Y-m-d H:i" ), "\n"; + echo $dtn->format( "D Y-m-d H:i" ), "\n"; } ?> --EXPECT-- diff --git a/ext/date/tests/bug64887.phpt b/ext/date/tests/bug64887.phpt index dba1921eac..52c5e0fa8d 100644 --- a/ext/date/tests/bug64887.phpt +++ b/ext/date/tests/bug64887.phpt @@ -5,28 +5,28 @@ date.timezone=UTC --FILE-- <?php $tests = [ - '+1 ms', - '-2 msec', - '+3 msecs', - '-4 millisecond', - '+5 milliseconds', + '+1 ms', + '-2 msec', + '+3 msecs', + '-4 millisecond', + '+5 milliseconds', - '-6 usec', - '+7 usecs', - '-8 microsecond', - '+9 microseconds', - '-10 µs', - '+11 µsec', - '-12 µsecs', + '-6 usec', + '+7 usecs', + '-8 microsecond', + '+9 microseconds', + '-10 µs', + '+11 µsec', + '-12 µsecs', - '+8 msec -2 µsec', + '+8 msec -2 µsec', ]; $datetime = new DateTimeImmutable( "2016-10-07 13:25:50" ); foreach ( $tests as $test ) { - echo $datetime->modify( $test )->format( 'Y-m-d H:i:s.u' ), "\n"; + echo $datetime->modify( $test )->format( 'Y-m-d H:i:s.u' ), "\n"; } ?> diff --git a/ext/date/tests/bug65184.phpt b/ext/date/tests/bug65184.phpt index 9bb68558aa..30a24f2493 100644 --- a/ext/date/tests/bug65184.phpt +++ b/ext/date/tests/bug65184.phpt @@ -10,19 +10,17 @@ if (strtoupper(substr(PHP_OS, 0, 3)) != 'WIN') { date.timezone = UTC --FILE-- <?php - setlocale(LC_ALL, 'Japanese_Japan.932'); - /* timestamp has to be some wednesday */ - $s = strftime('%A', 1372884126); + setlocale(LC_ALL, 'Japanese_Japan.932'); + /* timestamp has to be some wednesday */ + $s = strftime('%A', 1372884126); - for ($i = 0; $i < strlen($s); $i++) { - printf("%x ", ord($s[$i])); - } - echo "\n"; + for ($i = 0; $i < strlen($s); $i++) { + printf("%x ", ord($s[$i])); + } + echo "\n"; - echo strlen(strftime('%A')), "\n"; + echo strlen(strftime('%A')), "\n"; ?> -===DONE=== --EXPECT-- 90 85 97 6a 93 fa 6 -===DONE=== diff --git a/ext/date/tests/bug66985.phpt b/ext/date/tests/bug66985.phpt index 37dcd3e80d..2bcf97cb37 100644 --- a/ext/date/tests/bug66985.phpt +++ b/ext/date/tests/bug66985.phpt @@ -3,18 +3,18 @@ Bug #66985 (Some timezones are no longer valid in PHP 5.5.10) --FILE-- <?php $zones = array( - "CST6CDT", "Cuba", "Egypt", "Eire", "EST5EDT", "Factory", "GB-Eire", - "GMT0", "Greenwich", "Hongkong", "Iceland", "Iran", "Israel", "Jamaica", - "Japan", "Kwajalein", "Libya", "MST7MDT", "Navajo", "NZ-CHAT", "Poland", - "Portugal", "PST8PDT", "Singapore", "Turkey", "Universal", "W-SU", + "CST6CDT", "Cuba", "Egypt", "Eire", "EST5EDT", "Factory", "GB-Eire", + "GMT0", "Greenwich", "Hongkong", "Iceland", "Iran", "Israel", "Jamaica", + "Japan", "Kwajalein", "Libya", "MST7MDT", "Navajo", "NZ-CHAT", "Poland", + "Portugal", "PST8PDT", "Singapore", "Turkey", "Universal", "W-SU", - "UTC", "GMT", "GMT+0100", "-0230", + "UTC", "GMT", "GMT+0100", "-0230", ); foreach ( $zones as $zone ) { - $d = new DateTimeZone( $zone ); - print_r($d); + $d = new DateTimeZone( $zone ); + print_r($d); } ?> --EXPECT-- diff --git a/ext/date/tests/bug67118.phpt b/ext/date/tests/bug67118.phpt index 332142856e..ee1d8efc0a 100644 --- a/ext/date/tests/bug67118.phpt +++ b/ext/date/tests/bug67118.phpt @@ -6,22 +6,26 @@ date.timezone=Europe/Berlin <?php class mydt extends datetime { - public function __construct($time = 'now', $tz = NULL, $format = NULL) - { - if (!empty($tz) && !is_object($tz)) { - $tz = new DateTimeZone($tz); - } - try { - @parent::__construct($time, $tz); - } catch (Exception $e) { - echo "Bad date" . $this->format("Y") . "\n"; - } - } + public function __construct($time = 'now', $tz = NULL, $format = NULL) + { + if (!empty($tz) && !is_object($tz)) { + $tz = new DateTimeZone($tz); + } + try { + @parent::__construct($time, $tz); + } catch (Exception $e) { + echo "Bad date" . $this->format("Y") . "\n"; + } + } }; new mydt("Funktionsansvarig rÃ¥dgivning och juridik", "UTC"); ?> --EXPECTF-- -Warning: DateTime::format(): The DateTime object has not been correctly initialized by its constructor in %s on line %d -Bad date +Fatal error: Uncaught Error: The DateTime object has not been correctly initialized by its constructor in %s:%d +Stack trace: +#0 %s(%d): DateTime->format('Y') +#1 %s(%d): mydt->__construct(%s) +#2 {main} + thrown in %s on line %d diff --git a/ext/date/tests/bug70245.phpt b/ext/date/tests/bug70245.phpt index f754bf65a1..b45e8be931 100644 --- a/ext/date/tests/bug70245.phpt +++ b/ext/date/tests/bug70245.phpt @@ -3,8 +3,11 @@ Bug #70245 (strtotime does not emit warning when 2nd parameter is object or stri --FILE-- <?php $d = new DateTime('2011-01-15 00:00:00'); -var_dump(strtotime('-1 month', $d)); +try { + var_dump(strtotime('-1 month', $d)); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} ?> ---EXPECTF-- -Warning: strtotime() expects parameter 2 to be int, object given in %sbug70245.php on line %d -bool(false) +--EXPECT-- +strtotime(): Argument #2 ($now) must be of type ?int, object given diff --git a/ext/date/tests/bug72096.phpt b/ext/date/tests/bug72096.phpt index 1a4a219287..4256102944 100644 --- a/ext/date/tests/bug72096.phpt +++ b/ext/date/tests/bug72096.phpt @@ -5,8 +5,8 @@ date.timezone=UTC --FILE-- <?php for ($unix = 1461283200; $unix <= 1461369600; $unix += 8000) { - echo "Time:", gmdate('Y-m-d H:i:s = B', $unix), PHP_EOL; - echo "Time:", gmdate('Y-m-d H:i:s = B', $unix - 82 * 365 * 24 * 3600), PHP_EOL; + echo "Time:", gmdate('Y-m-d H:i:s = B', $unix), PHP_EOL; + echo "Time:", gmdate('Y-m-d H:i:s = B', $unix - 82 * 365 * 24 * 3600), PHP_EOL; } ?> --EXPECT-- diff --git a/ext/date/tests/bug73294.phpt b/ext/date/tests/bug73294.phpt index 493ba92dd6..af13cdaf40 100644 --- a/ext/date/tests/bug73294.phpt +++ b/ext/date/tests/bug73294.phpt @@ -4,17 +4,17 @@ Bug #73294: DateTime wrong when date string is negative <?php for ( $i = -1050; $i <= -1000; $i++ ) { - $M = "06"; - $D = "22"; + $M = "06"; + $D = "22"; - $dt = new DateTime("{$i}-{$M}-{$D} 00:00:00"); - $expected = "{$i}-{$M}-{$D} 00:00:00"; - $result = $dt->format('Y-m-d H:i:s'); + $dt = new DateTime("{$i}-{$M}-{$D} 00:00:00"); + $expected = "{$i}-{$M}-{$D} 00:00:00"; + $result = $dt->format('Y-m-d H:i:s'); - if ( $expected != $result ) - { - echo "Wrong: Should have been {$expected}, was {$result}\n"; - } + if ( $expected != $result ) + { + echo "Wrong: Should have been {$expected}, was {$result}\n"; + } } ?> ==DONE== diff --git a/ext/date/tests/bug73837.phpt b/ext/date/tests/bug73837.phpt index b14feecd93..c11aa2c56b 100644 --- a/ext/date/tests/bug73837.phpt +++ b/ext/date/tests/bug73837.phpt @@ -6,9 +6,9 @@ $collect = []; for ( $i = 0; $i < 1000; $i++ ) { - $a = new DateTime(); - $key = "s" . $a->format( "u" ); - $collect[$key] = true; + $a = new DateTime(); + $key = "s" . $a->format( "u" ); + $collect[$key] = true; } var_dump($n = count( $collect )); diff --git a/ext/date/tests/bug73858.phpt b/ext/date/tests/bug73858.phpt index 300b366749..fb41390b0f 100644 --- a/ext/date/tests/bug73858.phpt +++ b/ext/date/tests/bug73858.phpt @@ -45,7 +45,7 @@ var_dump($d->days); // 30 ... and should be 30 /* [Workaround] -This final test seems to prove that the input string is important and that the "- 1 secord" has a negative knock-on +This final test seems to prove that the input string is important and that the "- 1 second" has a negative knock-on effect on the results of the diff. By modifying the datetime with ->modify everything works as expected ... it just means you have to be careful of how we work with DateTimes . */ diff --git a/ext/date/tests/bug74652.phpt b/ext/date/tests/bug74652.phpt index 029464be4c..3cff8beab0 100644 --- a/ext/date/tests/bug74652.phpt +++ b/ext/date/tests/bug74652.phpt @@ -5,19 +5,19 @@ date.timezone=UTC --FILE-- <?php $formats = [ - '2017-03-25 10:52:09', - '2017-03-25 10:52', - '2017-03-25 10am', - '2017-03-25', - '2017-03', - '2017.042', - '2017043', + '2017-03-25 10:52:09', + '2017-03-25 10:52', + '2017-03-25 10am', + '2017-03-25', + '2017-03', + '2017.042', + '2017043', ]; foreach ( $formats as $format ) { - $dt = new DateTimeImmutable( $format ); - echo $dt->format( 'Y-m-d H:i:s' ), "\n"; + $dt = new DateTimeImmutable( $format ); + echo $dt->format( 'Y-m-d H:i:s' ), "\n"; } ?> --EXPECT-- diff --git a/ext/date/tests/bug74852.phpt b/ext/date/tests/bug74852.phpt index e293bef8bf..d5fea0ad3f 100644 --- a/ext/date/tests/bug74852.phpt +++ b/ext/date/tests/bug74852.phpt @@ -13,5 +13,5 @@ var_dump($interval->abcde); bool(false) bool(false) -Notice: Undefined property: DateInterval::$abcde in %s on line %d +Warning: Undefined property: DateInterval::$abcde in %s on line %d NULL diff --git a/ext/date/tests/bug75002.phpt b/ext/date/tests/bug75002.phpt index b10e0ebe00..5c3085f316 100644 --- a/ext/date/tests/bug75002.phpt +++ b/ext/date/tests/bug75002.phpt @@ -4,13 +4,13 @@ Bug #75002 Null Pointer Dereference in timelib_time_clone <?php class aaa extends DatePeriod { - public function __construct() { } + public function __construct() { } } $start=new DateTime( '2012-08-01' ); foreach (new aaa($start) as $y) { - $a=$key; + $a=$key; } ?> diff --git a/ext/date/tests/bug75232.phpt b/ext/date/tests/bug75232.phpt index 9200f65e91..cf4f289465 100644 --- a/ext/date/tests/bug75232.phpt +++ b/ext/date/tests/bug75232.phpt @@ -14,7 +14,7 @@ echo $d2->date, "\n"; ?> --EXPECTF-- -Notice: Undefined property: DateTime::$date in %s on line %d +Warning: Undefined property: DateTime::$date in %s on line %d DateTime Object ( @@ -23,4 +23,4 @@ DateTime Object [timezone] => UTC ) -Notice: Undefined property: DateTime::$date in %s on line %d +Warning: Undefined property: DateTime::$date in %s on line %d diff --git a/ext/date/tests/checkdate_basic1.phpt b/ext/date/tests/checkdate_basic1.phpt index 9be78eb171..150215b7eb 100644 --- a/ext/date/tests/checkdate_basic1.phpt +++ b/ext/date/tests/checkdate_basic1.phpt @@ -32,7 +32,6 @@ var_dump( checkdate(7, 2, 32768) ); // >max year var_dump( checkdate(7, 2, 0) ); // <min year ?> -===DONE=== --EXPECT-- *** Testing checkdate() : basic functionality *** -- The following are all valid dates -- @@ -51,4 +50,3 @@ bool(false) bool(false) bool(false) bool(false) -===DONE=== diff --git a/ext/date/tests/date-time-modify-times.phpt b/ext/date/tests/date-time-modify-times.phpt index e355f18e06..4f26275c88 100644 --- a/ext/date/tests/date-time-modify-times.phpt +++ b/ext/date/tests/date-time-modify-times.phpt @@ -5,31 +5,31 @@ date.timezone=Europe/London --FILE-- <?php $tests = array( - '2010-12-15 19:42:45 UTC' => array( - 'october 23:00', // October 23rd, with a broken time - 'back of 4pm', - 'next week monday', - 'next week monday 10am', - 'tuesday noon', - 'first monday of January 2011', - 'first monday of January 2011 09:00', - ), - '2010-12-15 19:42:45' => array( - 'october 23:00', // October 23rd, with a broken time - 'march 28, 00:15', - 'march 28, 01:15', // doesn't exist bcause of DST - 'march 28, 02:15', - ), + '2010-12-15 19:42:45 UTC' => array( + 'october 23:00', // October 23rd, with a broken time + 'back of 4pm', + 'next week monday', + 'next week monday 10am', + 'tuesday noon', + 'first monday of January 2011', + 'first monday of January 2011 09:00', + ), + '2010-12-15 19:42:45' => array( + 'october 23:00', // October 23rd, with a broken time + 'march 28, 00:15', + 'march 28, 01:15', // doesn't exist because of DST + 'march 28, 02:15', + ), ); foreach ( $tests as $start => $data ) { - foreach ( $data as $test ) - { - echo date_create( $start ) - ->modify( $test ) - ->format( DateTime::RFC2822 ), "\n"; - } + foreach ( $data as $test ) + { + echo date_create( $start ) + ->modify( $test ) + ->format( DateTime::RFC2822 ), "\n"; + } } echo "\n"; ?> diff --git a/ext/date/tests/date.phpt b/ext/date/tests/date.phpt index 12bc9f0fce..6a371ee001 100644 --- a/ext/date/tests/date.phpt +++ b/ext/date/tests/date.phpt @@ -6,13 +6,13 @@ $tmp = "cr"; date_default_timezone_set('UTC'); for($a = 0;$a < strlen($tmp); $a++){ - echo $tmp[$a], ': ', date($tmp[$a], 1043324459)."\n"; + echo $tmp[$a], ': ', date($tmp[$a], 1043324459)."\n"; } date_default_timezone_set("MET"); for($a = 0;$a < strlen($tmp); $a++){ - echo $tmp[$a], ': ', date($tmp[$a], 1043324459)."\n"; + echo $tmp[$a], ': ', date($tmp[$a], 1043324459)."\n"; } ?> --EXPECT-- diff --git a/ext/date/tests/date_add_basic.phpt b/ext/date/tests/date_add_basic.phpt index edf84d61f8..fe5c7e9c19 100644 --- a/ext/date/tests/date_add_basic.phpt +++ b/ext/date/tests/date_add_basic.phpt @@ -17,22 +17,21 @@ echo "*** Testing date_add() : basic functionality ***\n"; $startDate = '2008-01-01 12:25'; $format = 'Y-m-d H:i:s'; $intervals = array( - 'P3Y6M4DT12H30M5S', - 'P0D', - 'P2DT1M', - 'P1Y2MT23H43M150S' + 'P3Y6M4DT12H30M5S', + 'P0D', + 'P2DT1M', + 'P1Y2MT23H43M150S' ); $d = new DateTime($startDate); var_dump( $d->format($format) ); foreach($intervals as $interval) { - date_add($d, new DateInterval($interval) ); - var_dump( $d->format($format) ); + date_add($d, new DateInterval($interval) ); + var_dump( $d->format($format) ); } ?> -===DONE=== --EXPECT-- *** Testing date_add() : basic functionality *** string(19) "2008-01-01 12:25:00" @@ -40,4 +39,3 @@ string(19) "2011-07-06 00:55:05" string(19) "2011-07-06 00:55:05" string(19) "2011-07-08 00:56:05" string(19) "2012-09-09 00:41:35" -===DONE=== diff --git a/ext/date/tests/date_basic1.phpt b/ext/date/tests/date_basic1.phpt index 088bdce6d5..c05208e31e 100644 --- a/ext/date/tests/date_basic1.phpt +++ b/ext/date/tests/date_basic1.phpt @@ -25,7 +25,6 @@ var_dump( date('H:m:s \m \i\s\ \m\o\n\t\h', $timestamp) ); var_dump( date("H:i:s", $timestamp) ); ?> -===DONE=== --EXPECT-- *** Testing date() : basic functionality *** string(27) "February 27, 2009, 10:44 am" @@ -37,4 +36,3 @@ string(19) "it is the 27th day." string(28) "Fri Feb 27 10:44:30 GMT 2009" string(19) "10:02:30 m is month" string(8) "10:44:30" -===DONE=== diff --git a/ext/date/tests/date_create-1.phpt b/ext/date/tests/date_create-1.phpt index 4b156de6e4..aad2f3f9e2 100644 --- a/ext/date/tests/date_create-1.phpt +++ b/ext/date/tests/date_create-1.phpt @@ -26,7 +26,7 @@ $d[] = date_create("2005-07-14 22:30:41 Europe/Oslo", $tz1); $d[] = date_create("2005-07-14 22:30:41 America/Los_Angeles", $tz2); foreach($d as $date) { - echo $date->format(DateTime::ISO8601), "\n"; + echo $date->format(DateTime::ISO8601), "\n"; } ?> --EXPECT-- diff --git a/ext/date/tests/date_create-relative.phpt b/ext/date/tests/date_create-relative.phpt index 5d2a4196e9..02861242ca 100644 --- a/ext/date/tests/date_create-relative.phpt +++ b/ext/date/tests/date_create-relative.phpt @@ -6,47 +6,47 @@ date_create() with large relative offsets date_default_timezone_set('UTC'); if (!defined('PHP_INT_MIN')) { - define('PHP_INT_MIN', intval(-PHP_INT_MAX - 1)); + define('PHP_INT_MIN', intval(-PHP_INT_MAX - 1)); } $base_time = '28 Feb 2008 12:00:00'; // Most offsets tested in strtotime-relative.phpt. These are tests for dates outside the 32-bit range. $offsets = array( - // around 10 leap year periods (4000 years) in days - '1460000 days', - '1460969 days', - '1460970 days', - '1460971 days', - '1462970 days', + // around 10 leap year periods (4000 years) in days + '1460000 days', + '1460969 days', + '1460970 days', + '1460971 days', + '1462970 days', - // around 1 leap year period in years - '398 years', - '399 years', - '400 years', - '401 years', + // around 1 leap year period in years + '398 years', + '399 years', + '400 years', + '401 years', - // around 40000 years - '39755 years', - '39999 years', - '40000 years', - '40001 years', - '41010 years', + // around 40000 years + '39755 years', + '39999 years', + '40000 years', + '40001 years', + '41010 years', - // bigger than int (32-bit) - '10000000000 seconds', - '10000000000 minutes', - '10000000000 hours', - '10000000000 days', - '10000000000 months', - '10000000000 years', + // bigger than int (32-bit) + '10000000000 seconds', + '10000000000 minutes', + '10000000000 hours', + '10000000000 days', + '10000000000 months', + '10000000000 years', ); foreach ($offsets AS $offset) { - foreach (array('+', '-') AS $direction) { - $dt = date_create("$base_time $direction$offset"); - echo "$direction$offset: " . date_format($dt, DATE_ISO8601) . "\n"; - } + foreach (array('+', '-') AS $direction) { + $dt = date_create("$base_time $direction$offset"); + echo "$direction$offset: " . date_format($dt, DATE_ISO8601) . "\n"; + } } ?> diff --git a/ext/date/tests/date_create_basic.phpt b/ext/date/tests/date_create_basic.phpt index b9d1c2fa97..5c12605023 100644 --- a/ext/date/tests/date_create_basic.phpt +++ b/ext/date/tests/date_create_basic.phpt @@ -20,7 +20,6 @@ var_dump( date_create("2005-07-14 22:30:41") ); var_dump( date_create("2005-07-14 22:30:41 GMT") ); ?> -===DONE=== --EXPECTF-- *** Testing date_create() : basic functionality *** object(DateTime)#%d (3) { @@ -55,4 +54,3 @@ object(DateTime)#%d (3) { ["timezone"]=> string(3) "GMT" } -===DONE=== diff --git a/ext/date/tests/date_date_set_basic1.phpt b/ext/date/tests/date_date_set_basic1.phpt index d24815f99c..d701a22543 100644 --- a/ext/date/tests/date_date_set_basic1.phpt +++ b/ext/date/tests/date_date_set_basic1.phpt @@ -22,9 +22,7 @@ date_date_set($datetime, 2008, 02, 01); echo date_format($datetime, DATE_RFC2822) . "\n"; ?> -===DONE=== --EXPECT-- *** Testing date_date_set() : basic functionality *** Fri, 30 Jan 2009 19:34:10 +0000 Fri, 01 Feb 2008 19:34:10 +0000 -===DONE=== diff --git a/ext/date/tests/date_default_timezone_get-1.phpt b/ext/date/tests/date_default_timezone_get-1.phpt index ba0607643b..32c066c1ca 100644 --- a/ext/date/tests/date_default_timezone_get-1.phpt +++ b/ext/date/tests/date_default_timezone_get-1.phpt @@ -8,9 +8,9 @@ date_default_timezone_get() function [1] date.timezone= --FILE-- <?php - putenv('TZ='); - echo date_default_timezone_get(), "\n"; - echo date('e'), "\n"; + putenv('TZ='); + echo date_default_timezone_get(), "\n"; + echo date('e'), "\n"; ?> --EXPECT-- UTC diff --git a/ext/date/tests/date_default_timezone_get-2.phpt b/ext/date/tests/date_default_timezone_get-2.phpt index 5c835c35f3..cf7478c90b 100644 --- a/ext/date/tests/date_default_timezone_get-2.phpt +++ b/ext/date/tests/date_default_timezone_get-2.phpt @@ -8,8 +8,8 @@ date_default_timezone_get() function [2] date.timezone= --FILE-- <?php - putenv('TZ='); - echo date_default_timezone_get(), "\n"; + putenv('TZ='); + echo date_default_timezone_get(), "\n"; ?> --EXPECT-- UTC diff --git a/ext/date/tests/date_default_timezone_get-3.phpt b/ext/date/tests/date_default_timezone_get-3.phpt index ffc882e6f6..6e9818724e 100644 --- a/ext/date/tests/date_default_timezone_get-3.phpt +++ b/ext/date/tests/date_default_timezone_get-3.phpt @@ -4,10 +4,10 @@ date_default_timezone_get() function [3] date.timezone=Europe/Rome --FILE-- <?php - echo date_default_timezone_get(), "\n"; + echo date_default_timezone_get(), "\n"; - date_default_timezone_set("America/Chicago"); - echo date_default_timezone_get(), "\n"; + date_default_timezone_set("America/Chicago"); + echo date_default_timezone_get(), "\n"; ?> --EXPECT-- Europe/Rome diff --git a/ext/date/tests/date_default_timezone_get-4.phpt b/ext/date/tests/date_default_timezone_get-4.phpt index 6d1982bc13..f2319856d8 100644 --- a/ext/date/tests/date_default_timezone_get-4.phpt +++ b/ext/date/tests/date_default_timezone_get-4.phpt @@ -4,7 +4,7 @@ date_default_timezone_get() function [4] date.timezone=Incorrect/Zone --FILE-- <?php - echo date_default_timezone_get(), "\n"; + echo date_default_timezone_get(), "\n"; ?> --EXPECTF-- Warning: date_default_timezone_get(): Invalid date.timezone value 'Incorrect/Zone', we selected the timezone 'UTC' for now. in %sdate_default_timezone_get-4.php on line %d diff --git a/ext/date/tests/date_default_timezone_set-1.phpt b/ext/date/tests/date_default_timezone_set-1.phpt index 7e7ba7972f..54f1fa73f3 100644 --- a/ext/date/tests/date_default_timezone_set-1.phpt +++ b/ext/date/tests/date_default_timezone_set-1.phpt @@ -8,18 +8,18 @@ if (substr(PHP_OS, 0, 3) == 'WIN') die('skip diff TZ detection on windows.'); date.timezone= --FILE-- <?php - putenv("TZ="); - $date1 = strtotime("2005-01-12 08:00:00"); - $date2 = strtotime("2005-07-12 08:00:00"); - date_default_timezone_set("America/Indiana/Knox"); - $date3 = strtotime("2005-01-12 08:00:00"); - $date4 = strtotime("2005-07-12 08:00:00"); + putenv("TZ="); + $date1 = strtotime("2005-01-12 08:00:00"); + $date2 = strtotime("2005-07-12 08:00:00"); + date_default_timezone_set("America/Indiana/Knox"); + $date3 = strtotime("2005-01-12 08:00:00"); + $date4 = strtotime("2005-07-12 08:00:00"); - echo date_default_timezone_get(), "\n"; - echo date(DATE_ISO8601, $date1), "\n"; - echo date(DATE_ISO8601, $date2), "\n"; - echo date(DATE_ISO8601, $date3), "\n"; - echo date(DATE_ISO8601, $date4), "\n"; + echo date_default_timezone_get(), "\n"; + echo date(DATE_ISO8601, $date1), "\n"; + echo date(DATE_ISO8601, $date2), "\n"; + echo date(DATE_ISO8601, $date3), "\n"; + echo date(DATE_ISO8601, $date4), "\n"; ?> --EXPECT-- America/Indiana/Knox diff --git a/ext/date/tests/date_default_timezone_set_error.phpt b/ext/date/tests/date_default_timezone_set_error.phpt index 15c6aa6fed..652c0e8d44 100644 --- a/ext/date/tests/date_default_timezone_set_error.phpt +++ b/ext/date/tests/date_default_timezone_set_error.phpt @@ -9,33 +9,14 @@ Test date_default_timezone_set() function : error variations echo "*** Testing date_default_timezone_set() : error variations ***\n"; -echo "\n-- Testing date_default_timezone_set() function with less than expected no. of arguments --\n"; -var_dump( date_default_timezone_set() ); - -echo "\n-- Testing date_default_timezone_set() function with more than expected no. of arguments --\n"; -$extra_arg = 10; -var_dump( date_default_timezone_set("GMT", $extra_arg) ); - echo "\n-- Testing date_default_timezone_set() function with invalid timezone identifier --\n"; var_dump( date_default_timezone_set("foo") ); ?> -===Done=== --EXPECTF-- *** Testing date_default_timezone_set() : error variations *** --- Testing date_default_timezone_set() function with less than expected no. of arguments -- - -Warning: date_default_timezone_set() expects exactly 1 parameter, 0 given in %s on line %d -bool(false) - --- Testing date_default_timezone_set() function with more than expected no. of arguments -- - -Warning: date_default_timezone_set() expects exactly 1 parameter, 2 given in %s on line %d -bool(false) - -- Testing date_default_timezone_set() function with invalid timezone identifier -- Notice: date_default_timezone_set(): Timezone ID 'foo' is invalid in %s on line %d bool(false) -===Done=== diff --git a/ext/date/tests/date_diff.phpt b/ext/date/tests/date_diff.phpt index e01a94e767..d5cc58271c 100644 --- a/ext/date/tests/date_diff.phpt +++ b/ext/date/tests/date_diff.phpt @@ -13,48 +13,48 @@ define( 'COUNT', 120 ); $d0 = new DateTime('2009-11-20'); for ( $i = 0; $i < COUNT * 12; $i++ ) { - $d = clone $d0; - $dates[$i] = $d->add( new DateInterval( "P{$i}D" ) ); + $d = clone $d0; + $dates[$i] = $d->add( new DateInterval( "P{$i}D" ) ); } for ( $i = 0; $i < COUNT; $i++) { // echo $dates[$i]->format( "Y-m-d\n" ); - for ( $j = 0; $j < COUNT * 12; $j++) - { - $diff = date_diff( $dates[$i], $dates[$j] ); - /* - printf( "\t%s %s %3d %s\n", - $dates[$i]->format( 'Y-m-d' ), - $dates[$j]->format( 'Y-m-d' ), - $diff->format( '%a' ), - $diff->format( '%y-%m-%d' ) - ); - */ + for ( $j = 0; $j < COUNT * 12; $j++) + { + $diff = date_diff( $dates[$i], $dates[$j] ); + /* + printf( "\t%s %s %3d %s\n", + $dates[$i]->format( 'Y-m-d' ), + $dates[$j]->format( 'Y-m-d' ), + $diff->format( '%a' ), + $diff->format( '%y-%m-%d' ) + ); + */ - $current = clone $dates[$i]; - $int = new DateInterval( $diff->format( 'P%yY%mM%dD' ) ); - if ( $current > $dates[$j] ) - { - $current->sub( $int ); - } - else - { - $current->add( $int ); - } - if ( $current != $dates[$j] ) - { - echo "FAIL: ", - $dates[$i]->format( 'Y-m-d' ), " + ", - $int->format( '%y-%m-%d' ), " = ", - $current->format( 'Y-m-d' ), " (", - $dates[$j]->format( 'Y-m-d' ), ")\n"; - } - else - { - $ok++; - } - } + $current = clone $dates[$i]; + $int = new DateInterval( $diff->format( 'P%yY%mM%dD' ) ); + if ( $current > $dates[$j] ) + { + $current->sub( $int ); + } + else + { + $current->add( $int ); + } + if ( $current != $dates[$j] ) + { + echo "FAIL: ", + $dates[$i]->format( 'Y-m-d' ), " + ", + $int->format( '%y-%m-%d' ), " = ", + $current->format( 'Y-m-d' ), " (", + $dates[$j]->format( 'Y-m-d' ), ")\n"; + } + else + { + $ok++; + } + } } echo $ok, "\n"; diff --git a/ext/date/tests/date_format_basic1.phpt b/ext/date/tests/date_format_basic1.phpt index 317386f311..42e8acd669 100644 --- a/ext/date/tests/date_format_basic1.phpt +++ b/ext/date/tests/date_format_basic1.phpt @@ -25,7 +25,6 @@ var_dump( date_format($date, 'H:m:s \m \i\s\ \m\o\n\t\h') ); var_dump( date_format($date, "H:i:s") ); ?> -===DONE=== --EXPECT-- *** Testing date_format() : basic functionality *** string(23) "July 14, 2005, 10:30 pm" @@ -37,4 +36,3 @@ string(19) "it is the 14th day." string(28) "Thu Jul 14 22:30:41 BST 2005" string(19) "22:07:41 m is month" string(8) "22:30:41" -===DONE=== diff --git a/ext/date/tests/date_interval_bad_format_leak.phpt b/ext/date/tests/date_interval_bad_format_leak.phpt new file mode 100644 index 0000000000..d15bf57b3f --- /dev/null +++ b/ext/date/tests/date_interval_bad_format_leak.phpt @@ -0,0 +1,21 @@ +--TEST-- +DateInterval with bad format should not leak period +--FILE-- +<?php + +try { + $interval = new DateInterval('P3"D'); +} catch (Exception $e) { + echo $e->getMessage(), "\n"; +} + +try { + $perid = new DatePeriod('P3"D'); +} catch (Exception $e) { + echo $e->getMessage(), "\n"; +} + +?> +--EXPECT-- +DateInterval::__construct(): Unknown or bad format (P3"D) +DatePeriod::__construct(): Unknown or bad format (P3"D) diff --git a/ext/date/tests/date_interval_prop_dim.phpt b/ext/date/tests/date_interval_prop_dim.phpt index 3f9af6f472..5d33badebe 100644 --- a/ext/date/tests/date_interval_prop_dim.phpt +++ b/ext/date/tests/date_interval_prop_dim.phpt @@ -7,8 +7,8 @@ $z = new Z('P2Y4DT6H8M'); $i = 0; $z->prop[1]=10; while ($i < 1026) { - $z->prop[$i] = $i; - $i++; + $z->prop[$i] = $i; + $i++; } ?> ==NOCRASH== diff --git a/ext/date/tests/date_isodate_set_basic1.phpt b/ext/date/tests/date_isodate_set_basic1.phpt index 80149f4325..f28c15b8b1 100644 --- a/ext/date/tests/date_isodate_set_basic1.phpt +++ b/ext/date/tests/date_isodate_set_basic1.phpt @@ -29,10 +29,8 @@ date_isodate_set($datetime, 2008, 30, 3); echo "..same day last year was \"" . date_format($datetime, "D M j") . "\"\n"; ?> -===DONE=== --EXPECT-- *** Testing date_isodate_set() : basic functionality *** Week 40 of 2009 is in "September" Week 30 day 3 of 2009 is "Wed Jul 22" ..same day last year was "Wed Jul 23" -===DONE=== diff --git a/ext/date/tests/date_modify_basic1.phpt b/ext/date/tests/date_modify_basic1.phpt index 2d9d828db0..c448d6f44f 100644 --- a/ext/date/tests/date_modify_basic1.phpt +++ b/ext/date/tests/date_modify_basic1.phpt @@ -29,11 +29,9 @@ date_modify($datetime, "last Sunday"); echo "After modification 4: " . date_format($datetime, "D, d M Y") . "\n"; ?> -===DONE=== --EXPECT-- *** Testing date_modify() : basic functionality *** After modification 1: Sun, 01 Feb 2009 After modification 2: Tue, 10 Feb 2009 18:28:43 After modification 3: Thu, 12 Feb 2009 After modification 4: Sun, 08 Feb 2009 -===DONE=== diff --git a/ext/date/tests/date_offset_get_basic1.phpt b/ext/date/tests/date_offset_get_basic1.phpt index 4a92eff376..6b775a9950 100644 --- a/ext/date/tests/date_offset_get_basic1.phpt +++ b/ext/date/tests/date_offset_get_basic1.phpt @@ -20,9 +20,7 @@ echo "Winter offset: " . date_offset_get($winter) / 3600 . " hours\n"; echo "Summer offset: " . date_offset_get($summer) / 3600 . " hours\n"; ?> -===DONE=== --EXPECT-- *** Testing date_offset_get() : basic functionality *** Winter offset: 0 hours Summer offset: 1 hours -===DONE=== diff --git a/ext/date/tests/date_parse_001.phpt b/ext/date/tests/date_parse_001.phpt index b5c5ac0f48..36f8d9bbdd 100644 --- a/ext/date/tests/date_parse_001.phpt +++ b/ext/date/tests/date_parse_001.phpt @@ -12,10 +12,9 @@ Test basic date_parse() var_dump(date_parse("03-03")); var_dump(date_parse("0-0")); var_dump(date_parse("")); - var_dump(date_parse(array())); echo "Done\n"; ?> ---EXPECTF-- +--EXPECT-- array(12) { ["year"]=> int(2006) @@ -298,7 +297,4 @@ array(12) { ["is_localtime"]=> bool(false) } - -Warning: date_parse() expects parameter 1 to be string, array given in %sdate_parse_001.php on line %d -bool(false) Done diff --git a/ext/date/tests/date_parse_basic1.phpt b/ext/date/tests/date_parse_basic1.phpt index a0801d7064..f8af03f6d9 100644 --- a/ext/date/tests/date_parse_basic1.phpt +++ b/ext/date/tests/date_parse_basic1.phpt @@ -17,7 +17,6 @@ var_dump( date_parse("10:00:00.5") ); var_dump( date_parse("2009-02-27") ); ?> -===DONE=== --EXPECT-- *** Testing date_parse() : basic functionality *** array(12) { @@ -104,4 +103,3 @@ array(12) { ["is_localtime"]=> bool(false) } -===DONE=== diff --git a/ext/date/tests/date_parse_error.phpt b/ext/date/tests/date_parse_error.phpt index 9f444bb435..6a5180fdfb 100644 --- a/ext/date/tests/date_parse_error.phpt +++ b/ext/date/tests/date_parse_error.phpt @@ -12,33 +12,14 @@ date_default_timezone_set("Europe/London"); echo "*** Testing date_parse() : error conditions ***\n"; -echo "\n-- Testing date_parse() function with zero arguments --\n"; -var_dump( date_parse() ); - -echo "\n-- Testing date_parse() function with more than expected no. of arguments --\n"; -$date = "2009-02-27 10:00:00.5"; -$extra_arg = 10; -var_dump( date_parse($date, $extra_arg) ); - echo "\n-- Testing date_parse() function with unexpected characters in \$date argument --\n"; $invalid_date = "2OO9-02--27 10:00?00.5"; var_dump( date_parse($invalid_date) ); ?> -===DONE=== ---EXPECTF-- +--EXPECT-- *** Testing date_parse() : error conditions *** --- Testing date_parse() function with zero arguments -- - -Warning: date_parse() expects exactly 1 parameter, 0 given in %s on line %d -bool(false) - --- Testing date_parse() function with more than expected no. of arguments -- - -Warning: date_parse() expects exactly 1 parameter, 2 given in %s on line %d -bool(false) - -- Testing date_parse() function with unexpected characters in $date argument -- array(13) { ["year"]=> @@ -86,4 +67,3 @@ array(13) { ["zone_type"]=> int(0) } -===DONE=== diff --git a/ext/date/tests/date_period-immutable.phpt b/ext/date/tests/date_period-immutable.phpt index 0ec4b4a130..accc1dc0a3 100644 --- a/ext/date/tests/date_period-immutable.phpt +++ b/ext/date/tests/date_period-immutable.phpt @@ -10,18 +10,18 @@ $di = DateInterval::createFromDateString( 'first day of next month' ); foreach ( new DatePeriod( $db1, $di, $de ) as $dt ) { - echo get_class( $dt ), "\n"; - echo $dt->format( "l Y-m-d\n" ); + echo get_class( $dt ), "\n"; + echo $dt->format( "l Y-m-d\n" ); echo $dt->modify( "3 tuesday" )->format( "l Y-m-d\n" ); - echo $dt->format( "l Y-m-d\n\n" ); + echo $dt->format( "l Y-m-d\n\n" ); } foreach ( new DatePeriod( $db2, $di, $de ) as $dt ) { - echo get_class( $dt ), "\n"; - echo $dt->format( "l Y-m-d\n" ); + echo get_class( $dt ), "\n"; + echo $dt->format( "l Y-m-d\n" ); echo $dt->modify( "3 tuesday" )->format( "l Y-m-d\n" ); - echo $dt->format( "l Y-m-d\n\n" ); + echo $dt->format( "l Y-m-d\n\n" ); } ?> --EXPECT-- diff --git a/ext/date/tests/date_sub_basic.phpt b/ext/date/tests/date_sub_basic.phpt index 7246ef6347..fc93919d52 100644 --- a/ext/date/tests/date_sub_basic.phpt +++ b/ext/date/tests/date_sub_basic.phpt @@ -17,22 +17,21 @@ echo "*** Testing date_sub() : basic functionality ***\n"; $startDate = '2008-01-01 12:25'; $format = 'Y-m-d H:i:s'; $intervals = array( - 'P3Y6M4DT12H30M5S', - 'P0D', - 'P2DT1M', - 'P1Y2MT23H43M150S' + 'P3Y6M4DT12H30M5S', + 'P0D', + 'P2DT1M', + 'P1Y2MT23H43M150S' ); $d = new DateTime($startDate); var_dump( $d->format($format) ); foreach($intervals as $interval) { - date_sub($d, new DateInterval($interval) ); - var_dump( $d->format($format) ); + date_sub($d, new DateInterval($interval) ); + var_dump( $d->format($format) ); } ?> -===DONE=== --EXPECT-- *** Testing date_sub() : basic functionality *** string(19) "2008-01-01 12:25:00" @@ -40,4 +39,3 @@ string(19) "2004-06-26 23:54:55" string(19) "2004-06-26 23:54:55" string(19) "2004-06-24 23:53:55" string(19) "2003-04-24 00:08:25" -===DONE=== diff --git a/ext/date/tests/date_sun_info_001.phpt b/ext/date/tests/date_sun_info_001.phpt index c9096af46d..708d2550cc 100644 --- a/ext/date/tests/date_sun_info_001.phpt +++ b/ext/date/tests/date_sun_info_001.phpt @@ -10,9 +10,9 @@ echo "Done\n"; --EXPECT-- array(9) { ["sunrise"]=> - int(1165897761) + int(1165897682) ["sunset"]=> - int(1165934160) + int(1165934239) ["transit"]=> int(1165915961) ["civil_twilight_begin"]=> diff --git a/ext/date/tests/date_sun_info_002.phpt b/ext/date/tests/date_sun_info_002.phpt index 73956cc46a..1ff58295e3 100644 --- a/ext/date/tests/date_sun_info_002.phpt +++ b/ext/date/tests/date_sun_info_002.phpt @@ -6,13 +6,13 @@ date_default_timezone_set('Europe/Oslo'); $sun_info = date_sun_info(strtotime("2007-04-13 08:31:15 UTC"), 59.21, 9.61); foreach ($sun_info as $key => $elem ) { - echo date( 'Y-m-d H:i:s T', $elem ), " ", $key, "\n"; + echo date( 'Y-m-d H:i:s T', $elem ), " ", $key, "\n"; } echo "Done\n"; ?> --EXPECT-- -2007-04-13 06:13:31 CEST sunrise -2007-04-13 20:30:51 CEST sunset +2007-04-13 06:11:26 CEST sunrise +2007-04-13 20:32:56 CEST sunset 2007-04-13 13:22:11 CEST transit 2007-04-13 05:29:22 CEST civil_twilight_begin 2007-04-13 21:15:00 CEST civil_twilight_end diff --git a/ext/date/tests/date_sunrise_and_sunset_basic.phpt b/ext/date/tests/date_sunrise_and_sunset_basic.phpt index f7eb30a3ab..b707c3ccb3 100644 --- a/ext/date/tests/date_sunrise_and_sunset_basic.phpt +++ b/ext/date/tests/date_sunrise_and_sunset_basic.phpt @@ -18,9 +18,7 @@ echo date("D M d Y") . ', sunrise time : ' . date_sunrise(time(), SUNFUNCS_RET_S echo date("D M d Y") . ', sunset time : ' . date_sunset(time(), SUNFUNCS_RET_STRING, 38.4, -9, 90, 1) . "\n"; ?> -===Done=== --EXPECTF-- Basic test for date_sunrise() and date_sunset() %s %s %d %d, sunrise time : %d:%d %s %s %d %d, sunset time : %d:%d -===Done=== diff --git a/ext/date/tests/date_sunrise_variation7.phpt b/ext/date/tests/date_sunrise_variation7.phpt index d31bf3aaba..9d92d1b58f 100644 --- a/ext/date/tests/date_sunrise_variation7.phpt +++ b/ext/date/tests/date_sunrise_variation7.phpt @@ -12,28 +12,27 @@ echo "*** Testing date_sunrise() : usage variation ***\n"; //Timezones with required data for date_sunrise $inputs = array ( - //Timezone with Latitude, Longitude and GMT offset - "Pacific/Samoa" => array ("Latitude" => -14.24, "Longitude" => -170.72, "GMT" => -11), - "US/Alaska" => array ("Latitude" => 61, "Longitude" => -150 , "GMT" => -9), - "America/Chicago" => array ("Latitude" => 41.85, "Longitude" => -87.65 , "GMT" => -5), - "America/Montevideo" => array ("Latitude" => -34.88, "Longitude" => -56.18 , "GMT" => -3), - "Africa/Casablanca" => array ("Latitude" => 33.65, "Longitude" => -7.58, "GMT" => 0), - "Europe/Moscow" => array ("Latitude" => 55.75, "Longitude" => 37.58, "GMT" => 4), - "Asia/Hong_Kong" => array ("Latitude" => 22.28, "Longitude" => 114.15 , "GMT" => 8), - "Australia/Brisbane" => array ("Latitude" => -27.46, "Longitude" => 153.2 , "GMT" => 10), - "Pacific/Wallis" => array ("Latitude" => -13.3, "Longitude" => -176.16, "GMT" => 12), + //Timezone with Latitude, Longitude and GMT offset + "Pacific/Samoa" => array ("Latitude" => -14.24, "Longitude" => -170.72, "GMT" => -11), + "US/Alaska" => array ("Latitude" => 61, "Longitude" => -150 , "GMT" => -9), + "America/Chicago" => array ("Latitude" => 41.85, "Longitude" => -87.65 , "GMT" => -5), + "America/Montevideo" => array ("Latitude" => -34.88, "Longitude" => -56.18 , "GMT" => -3), + "Africa/Casablanca" => array ("Latitude" => 33.65, "Longitude" => -7.58, "GMT" => 0), + "Europe/Moscow" => array ("Latitude" => 55.75, "Longitude" => 37.58, "GMT" => 4), + "Asia/Hong_Kong" => array ("Latitude" => 22.28, "Longitude" => 114.15 , "GMT" => 8), + "Australia/Brisbane" => array ("Latitude" => -27.46, "Longitude" => 153.2 , "GMT" => 10), + "Pacific/Wallis" => array ("Latitude" => -13.3, "Longitude" => -176.16, "GMT" => 12), ); foreach($inputs as $timezone => $value) { - date_default_timezone_set($timezone); - $time = mktime(8, 8, 8, 8, 11, 2008); - var_dump( date_sunrise($time, SUNFUNCS_RET_STRING, $value["Latitude"], $value["Longitude"], 90, $value["GMT"] )); - $time = mktime(8, 8, 8, 8, 12, 2008); - var_dump( date_sunrise($time, SUNFUNCS_RET_STRING, $value["Latitude"], $value["Longitude"], 90, $value["GMT"]) ); + date_default_timezone_set($timezone); + $time = mktime(8, 8, 8, 8, 11, 2008); + var_dump( date_sunrise($time, SUNFUNCS_RET_STRING, $value["Latitude"], $value["Longitude"], 90, $value["GMT"] )); + $time = mktime(8, 8, 8, 8, 12, 2008); + var_dump( date_sunrise($time, SUNFUNCS_RET_STRING, $value["Latitude"], $value["Longitude"], 90, $value["GMT"]) ); } ?> -===DONE=== --EXPECT-- *** Testing date_sunrise() : usage variation *** string(5) "06:42" @@ -54,4 +53,3 @@ string(5) "06:23" string(5) "06:22" string(5) "06:03" string(5) "06:02" -===DONE=== diff --git a/ext/date/tests/date_sunrise_variation8.phpt b/ext/date/tests/date_sunrise_variation8.phpt index 8ab10bf1c0..d866e3ed7b 100644 --- a/ext/date/tests/date_sunrise_variation8.phpt +++ b/ext/date/tests/date_sunrise_variation8.phpt @@ -14,28 +14,27 @@ echo "*** Testing date_sunrise() : usage variation ***\n"; date_default_timezone_set("Africa/Casablanca"); $time_date = array ( - //Date at which Sun is up all day at North Pole - "12 Aug 2008" => mktime(8, 8, 8, 8, 12, 2008), - "13 Aug 2008" => mktime(8, 8, 8, 8, 13, 2008), + //Date at which Sun is up all day at North Pole + "12 Aug 2008" => mktime(8, 8, 8, 8, 12, 2008), + "13 Aug 2008" => mktime(8, 8, 8, 8, 13, 2008), - //Date at which Sun is up all day at South Pole - "12 Nov 2008" => mktime(8, 8, 8, 11, 12, 2008), - "13 Nov 2008" => mktime(8, 8, 8, 11, 13, 2008), + //Date at which Sun is up all day at South Pole + "12 Nov 2008" => mktime(8, 8, 8, 11, 12, 2008), + "13 Nov 2008" => mktime(8, 8, 8, 11, 13, 2008), ); //Iterate over different date and time foreach( $time_date as $date => $time ){ - echo "\n--$date--\n"; - var_dump( date_sunrise($time, SUNFUNCS_RET_STRING, 90, 0 ) ); - var_dump( date_sunrise($time, SUNFUNCS_RET_DOUBLE, 90, 0 ) ); - var_dump( date_sunrise($time, SUNFUNCS_RET_TIMESTAMP, 90, 0 ) ); - var_dump( date_sunrise($time, SUNFUNCS_RET_STRING, -90, 0 ) ); - var_dump( date_sunrise($time, SUNFUNCS_RET_DOUBLE, -90, 0 ) ); - var_dump( date_sunrise($time, SUNFUNCS_RET_TIMESTAMP, -90, 0 ) ); + echo "\n--$date--\n"; + var_dump( date_sunrise($time, SUNFUNCS_RET_STRING, 90, 0 ) ); + var_dump( date_sunrise($time, SUNFUNCS_RET_DOUBLE, 90, 0 ) ); + var_dump( date_sunrise($time, SUNFUNCS_RET_TIMESTAMP, 90, 0 ) ); + var_dump( date_sunrise($time, SUNFUNCS_RET_STRING, -90, 0 ) ); + var_dump( date_sunrise($time, SUNFUNCS_RET_DOUBLE, -90, 0 ) ); + var_dump( date_sunrise($time, SUNFUNCS_RET_TIMESTAMP, -90, 0 ) ); } ?> -===DONE=== --EXPECT-- *** Testing date_sunrise() : usage variation *** @@ -70,4 +69,3 @@ bool(false) bool(false) bool(false) bool(false) -===DONE=== diff --git a/ext/date/tests/date_sunrise_variation9.phpt b/ext/date/tests/date_sunrise_variation9.phpt deleted file mode 100644 index 75794cc632..0000000000 --- a/ext/date/tests/date_sunrise_variation9.phpt +++ /dev/null @@ -1,61 +0,0 @@ ---TEST-- -Test date_sunrise() function : usage variation - Passing high positive and negative float values to time argument. ---SKIPIF-- -<?php if (PHP_INT_SIZE != 4) echo "skip this test is for 32-bit only"; ?> ---FILE-- -<?php -/* Prototype : mixed date_sunrise(mixed time [, int format [, float latitude [, float longitude [, float zenith [, float gmt_offset]]]]]) - * Description: Returns time of sunrise for a given day and location - * Source code: ext/date/php_date.c - * Alias to functions: - */ - -echo "*** Testing date_sunrise() : usage variation ***\n"; - -// GMT is zero for the timezone -date_default_timezone_set("Asia/Calcutta"); -//Initialise the variables -$latitude = 38.4; -$longitude = -9; -$zenith = 90; -$gmt_offset = 1; - -echo "\n-- Testing date_sunrise() function by passing float 12.3456789000e10 value to time --\n"; -$time = 12.3456789000e10; -var_dump( date_sunrise($time, SUNFUNCS_RET_STRING, $latitude, $longitude, $zenith, $gmt_offset) ); -var_dump( date_sunrise($time, SUNFUNCS_RET_DOUBLE, $latitude, $longitude, $zenith, $gmt_offset) ); -var_dump( date_sunrise($time, SUNFUNCS_RET_TIMESTAMP, $latitude, $longitude, $zenith, $gmt_offset) ); - -echo "\n-- Testing date_sunrise() function by passing float -12.3456789000e10 value to time --\n"; -$time = -12.3456789000e10; -var_dump( date_sunrise($time, SUNFUNCS_RET_STRING, $latitude, $longitude, $zenith, $gmt_offset) ); -var_dump( date_sunrise($time, SUNFUNCS_RET_DOUBLE, $latitude, $longitude, $zenith, $gmt_offset) ); -var_dump( date_sunrise($time, SUNFUNCS_RET_TIMESTAMP, $latitude, $longitude, $zenith, $gmt_offset) ); - -?> -===DONE=== ---EXPECTF-- -*** Testing date_sunrise() : usage variation *** - --- Testing date_sunrise() function by passing float 12.3456789000e10 value to time -- - -Warning: date_sunrise() expects parameter 1 to be int, float given in %s on line %d -bool(false) - -Warning: date_sunrise() expects parameter 1 to be int, float given in %s on line %d -bool(false) - -Warning: date_sunrise() expects parameter 1 to be int, float given in %s on line %d -bool(false) - --- Testing date_sunrise() function by passing float -12.3456789000e10 value to time -- - -Warning: date_sunrise() expects parameter 1 to be int, float given in %s on line %d -bool(false) - -Warning: date_sunrise() expects parameter 1 to be int, float given in %s on line %d -bool(false) - -Warning: date_sunrise() expects parameter 1 to be int, float given in %s on line %d -bool(false) -===DONE=== diff --git a/ext/date/tests/date_sunset_variation7.phpt b/ext/date/tests/date_sunset_variation7.phpt index cb2955702c..380e466c0d 100644 --- a/ext/date/tests/date_sunset_variation7.phpt +++ b/ext/date/tests/date_sunset_variation7.phpt @@ -12,28 +12,27 @@ echo "*** Testing date_sunset() : usage variation ***\n"; //Timezones with required data for date_sunrise $inputs = array ( - //Timezone with Latitude, Longitude and GMT offset - "Pacific/Samoa" => array ("Latitude" => -14.24, "Longitude" => -170.72, "GMT" => -11), - "US/Alaska" => array ("Latitude" => 61, "Longitude" => -150 , "GMT" => -9), - "America/Chicago" => array ("Latitude" => 41.85, "Longitude" => -87.65 , "GMT" => -5), - "America/Montevideo" => array ("Latitude" => -34.88, "Longitude" => -56.18 , "GMT" => -3), - "Africa/Casablanca" => array ("Latitude" => 33.65, "Longitude" => "-7.58", "GMT" => 0), - "Europe/Moscow" => array ("Latitude" => 55.75, "Longitude" => 37.58, "GMT" => 4), - "Asia/Hong_Kong" => array ("Latitude" => 22.28, "Longitude" => 114.15 , "GMT" => 8), - "Australia/Brisbane" => array ("Latitude" => -27.46, "Longitude" => 153.2 , "GMT" => 10), - "Pacific/Wallis" => array ("Latitude" => -13.3, "Longitude" => -176.16, "GMT" => 12), + //Timezone with Latitude, Longitude and GMT offset + "Pacific/Samoa" => array ("Latitude" => -14.24, "Longitude" => -170.72, "GMT" => -11), + "US/Alaska" => array ("Latitude" => 61, "Longitude" => -150 , "GMT" => -9), + "America/Chicago" => array ("Latitude" => 41.85, "Longitude" => -87.65 , "GMT" => -5), + "America/Montevideo" => array ("Latitude" => -34.88, "Longitude" => -56.18 , "GMT" => -3), + "Africa/Casablanca" => array ("Latitude" => 33.65, "Longitude" => "-7.58", "GMT" => 0), + "Europe/Moscow" => array ("Latitude" => 55.75, "Longitude" => 37.58, "GMT" => 4), + "Asia/Hong_Kong" => array ("Latitude" => 22.28, "Longitude" => 114.15 , "GMT" => 8), + "Australia/Brisbane" => array ("Latitude" => -27.46, "Longitude" => 153.2 , "GMT" => 10), + "Pacific/Wallis" => array ("Latitude" => -13.3, "Longitude" => -176.16, "GMT" => 12), ); foreach($inputs as $timezone => $value) { - echo "\n--$timezone--\n"; - date_default_timezone_set($timezone); - $time = mktime(8, 8, 8, 8, 11, 2008); - var_dump( date_sunset($time, SUNFUNCS_RET_STRING, $value["Latitude"], $value["Longitude"], 90, $value["GMT"] )); - $time = mktime(8, 8, 8, 8, 12, 2008); - var_dump( date_sunset($time, SUNFUNCS_RET_STRING, $value["Latitude"], $value["Longitude"], 90, $value["GMT"]) ); + echo "\n--$timezone--\n"; + date_default_timezone_set($timezone); + $time = mktime(8, 8, 8, 8, 11, 2008); + var_dump( date_sunset($time, SUNFUNCS_RET_STRING, $value["Latitude"], $value["Longitude"], 90, $value["GMT"] )); + $time = mktime(8, 8, 8, 8, 12, 2008); + var_dump( date_sunset($time, SUNFUNCS_RET_STRING, $value["Latitude"], $value["Longitude"], 90, $value["GMT"]) ); } ?> -===DONE=== --EXPECT-- *** Testing date_sunset() : usage variation *** @@ -72,4 +71,3 @@ string(5) "17:21" --Pacific/Wallis-- string(5) "17:36" string(5) "17:36" -===DONE=== diff --git a/ext/date/tests/date_sunset_variation8.phpt b/ext/date/tests/date_sunset_variation8.phpt index 518754bc36..a5f6794f62 100644 --- a/ext/date/tests/date_sunset_variation8.phpt +++ b/ext/date/tests/date_sunset_variation8.phpt @@ -14,28 +14,27 @@ echo "*** Testing date_sunset() : usage variation ***\n"; date_default_timezone_set("Africa/Casablanca"); $time_date = array ( - //Date at which Sun is up all day at North Pole - "12 Aug 2008" => mktime(8, 8, 8, 8, 12, 2008), - "13 Aug 2008" => mktime(8, 8, 8, 8, 13, 2008), + //Date at which Sun is up all day at North Pole + "12 Aug 2008" => mktime(8, 8, 8, 8, 12, 2008), + "13 Aug 2008" => mktime(8, 8, 8, 8, 13, 2008), - //Date at which Sun is up all day at South Pole - "12 Nov 2008" => mktime(8, 8, 8, 11, 12, 2008), - "13 Nov 2008" => mktime(8, 8, 8, 11, 13, 2008), + //Date at which Sun is up all day at South Pole + "12 Nov 2008" => mktime(8, 8, 8, 11, 12, 2008), + "13 Nov 2008" => mktime(8, 8, 8, 11, 13, 2008), ); //Iterate over different date and time foreach( $time_date as $date => $time ){ - echo "\n--$date--\n"; - var_dump( date_sunset($time, SUNFUNCS_RET_STRING, 90, 0 ) ); - var_dump( date_sunset($time, SUNFUNCS_RET_DOUBLE, 90, 0 ) ); - var_dump( date_sunset($time, SUNFUNCS_RET_TIMESTAMP, 90, 0 ) ); - var_dump( date_sunset($time, SUNFUNCS_RET_STRING, -90, 0 ) ); - var_dump( date_sunset($time, SUNFUNCS_RET_DOUBLE, -90, 0 ) ); - var_dump( date_sunset($time, SUNFUNCS_RET_TIMESTAMP, -90, 0 ) ); + echo "\n--$date--\n"; + var_dump( date_sunset($time, SUNFUNCS_RET_STRING, 90, 0 ) ); + var_dump( date_sunset($time, SUNFUNCS_RET_DOUBLE, 90, 0 ) ); + var_dump( date_sunset($time, SUNFUNCS_RET_TIMESTAMP, 90, 0 ) ); + var_dump( date_sunset($time, SUNFUNCS_RET_STRING, -90, 0 ) ); + var_dump( date_sunset($time, SUNFUNCS_RET_DOUBLE, -90, 0 ) ); + var_dump( date_sunset($time, SUNFUNCS_RET_TIMESTAMP, -90, 0 ) ); } ?> -===DONE=== --EXPECT-- *** Testing date_sunset() : usage variation *** @@ -70,4 +69,3 @@ bool(false) bool(false) bool(false) bool(false) -===DONE=== diff --git a/ext/date/tests/date_sunset_variation9.phpt b/ext/date/tests/date_sunset_variation9.phpt deleted file mode 100644 index 4f897e1df0..0000000000 --- a/ext/date/tests/date_sunset_variation9.phpt +++ /dev/null @@ -1,61 +0,0 @@ ---TEST-- -Test date_sunset() function : usage variation - Passing high positive and negative float values to time argument. ---SKIPIF-- -<?php if (PHP_INT_SIZE != 4) echo "skip this test is for 32-bit only"; ?> ---FILE-- -<?php -/* Prototype : mixed date_sunset(mixed time [, int format [, float latitude [, float longitude [, float zenith [, float gmt_offset]]]]]) - * Description: Returns time of sunset for a given day and location - * Source code: ext/date/php_date.c - * Alias to functions: - */ - -echo "*** Testing date_sunset() : usage variation ***\n"; - -// GMT is zero for the timezone -date_default_timezone_set("Asia/Calcutta"); -//Initialise the variables -$latitude = 38.4; -$longitude = -9; -$zenith = 90; -$gmt_offset = 1; - -echo "\n-- Testing date_sunset() function by passing float 12.3456789000e10 value to time --\n"; -$time = 12.3456789000e10; -var_dump( date_sunset($time, SUNFUNCS_RET_STRING, $latitude, $longitude, $zenith, $gmt_offset) ); -var_dump( date_sunset($time, SUNFUNCS_RET_DOUBLE, $latitude, $longitude, $zenith, $gmt_offset) ); -var_dump( date_sunset($time, SUNFUNCS_RET_TIMESTAMP, $latitude, $longitude, $zenith, $gmt_offset) ); - -echo "\n-- Testing date_sunset() function by passing float -12.3456789000e10 value to time --\n"; -$time = -12.3456789000e10; -var_dump( date_sunset($time, SUNFUNCS_RET_STRING, $latitude, $longitude, $zenith, $gmt_offset) ); -var_dump( date_sunset($time, SUNFUNCS_RET_DOUBLE, $latitude, $longitude, $zenith, $gmt_offset) ); -var_dump( date_sunset($time, SUNFUNCS_RET_TIMESTAMP, $latitude, $longitude, $zenith, $gmt_offset) ); - -?> -===DONE=== ---EXPECTF-- -*** Testing date_sunset() : usage variation *** - --- Testing date_sunset() function by passing float 12.3456789000e10 value to time -- - -Warning: date_sunset() expects parameter 1 to be int, float given in %s on line %d -bool(false) - -Warning: date_sunset() expects parameter 1 to be int, float given in %s on line %d -bool(false) - -Warning: date_sunset() expects parameter 1 to be int, float given in %s on line %d -bool(false) - --- Testing date_sunset() function by passing float -12.3456789000e10 value to time -- - -Warning: date_sunset() expects parameter 1 to be int, float given in %s on line %d -bool(false) - -Warning: date_sunset() expects parameter 1 to be int, float given in %s on line %d -bool(false) - -Warning: date_sunset() expects parameter 1 to be int, float given in %s on line %d -bool(false) -===DONE=== diff --git a/ext/date/tests/date_time_immutable.phpt b/ext/date/tests/date_time_immutable.phpt index b4a576570e..a7e0348288 100644 --- a/ext/date/tests/date_time_immutable.phpt +++ b/ext/date/tests/date_time_immutable.phpt @@ -9,9 +9,9 @@ $current = "2012-12-27 16:24:08"; function dump($a, $b, $c) { - echo 'orig: ', $a->format('Y-m-d H:i:s e'), "\n"; - echo 'copy: ', $b->format('Y-m-d H:i:s e'), "\n"; - echo 'changed: ', $c->format('Y-m-d H:i:s e'), "\n"; + echo 'orig: ', $a->format('Y-m-d H:i:s e'), "\n"; + echo 'copy: ', $b->format('Y-m-d H:i:s e'), "\n"; + echo 'changed: ', $c->format('Y-m-d H:i:s e'), "\n"; } echo "modify():\n"; diff --git a/ext/date/tests/date_time_set_basic1.phpt b/ext/date/tests/date_time_set_basic1.phpt index 7efdeb62af..d0b714f72f 100644 --- a/ext/date/tests/date_time_set_basic1.phpt +++ b/ext/date/tests/date_time_set_basic1.phpt @@ -34,7 +34,6 @@ date_time_set($datetime, 54, 25); echo "After modification5 " . date_format($datetime, DATE_RFC2822) . "\n"; ?> -===DONE=== --EXPECT-- *** Testing date_time_set() : basic functionality *** Initial date: Sat, 31 Jan 2009 15:14:10 +0000 @@ -43,4 +42,3 @@ After modification2 Sat, 31 Jan 2009 19:05:59 +0000 After modification3 Sun, 01 Feb 2009 00:10:00 +0000 After modification4 Mon, 02 Feb 2009 23:35:47 +0000 After modification5 Wed, 04 Feb 2009 06:25:00 +0000 -===DONE=== diff --git a/ext/date/tests/date_timezone_get_basic1.phpt b/ext/date/tests/date_timezone_get_basic1.phpt index 9e8e92cde8..5b2fda596f 100644 --- a/ext/date/tests/date_timezone_get_basic1.phpt +++ b/ext/date/tests/date_timezone_get_basic1.phpt @@ -26,10 +26,8 @@ $tz = date_timezone_get($object); var_dump( timezone_name_get($tz) ); ?> -===DONE=== --EXPECT-- *** Testing date_timezone_get() : basic functionality *** string(13) "Europe/London" string(16) "America/New_York" string(19) "America/Los_Angeles" -===DONE=== diff --git a/ext/date/tests/date_timezone_set_basic1.phpt b/ext/date/tests/date_timezone_set_basic1.phpt index bfab43eda6..ef66ff9d3b 100644 --- a/ext/date/tests/date_timezone_set_basic1.phpt +++ b/ext/date/tests/date_timezone_set_basic1.phpt @@ -25,9 +25,7 @@ $tz = date_timezone_get($datetime); echo "New timezone: " . timezone_name_get($tz) . "\n"; ?> -===DONE=== --EXPECT-- *** Testing date_timezone_set() : basic functionality *** Default timezone: Europe/London New timezone: America/Los_Angeles -===DONE=== diff --git a/ext/date/tests/default-timezone-1.phpt b/ext/date/tests/default-timezone-1.phpt index a53d370afb..6435f85c42 100644 --- a/ext/date/tests/default-timezone-1.phpt +++ b/ext/date/tests/default-timezone-1.phpt @@ -3,8 +3,8 @@ date.timezone setting [1] --FILE-- <?php date_default_timezone_set('GMT'); - putenv('TZ='); // clean TZ so that it doesn't bypass the ini option - echo strtotime("2005-06-18 22:15:44"); + putenv('TZ='); // clean TZ so that it doesn't bypass the ini option + echo strtotime("2005-06-18 22:15:44"); ?> --EXPECT-- 1119132944 diff --git a/ext/date/tests/default-timezone-2.phpt b/ext/date/tests/default-timezone-2.phpt index b414eb2af3..7223340388 100644 --- a/ext/date/tests/default-timezone-2.phpt +++ b/ext/date/tests/default-timezone-2.phpt @@ -3,8 +3,8 @@ date.timezone setting [2] --FILE-- <?php date_default_timezone_set('Europe/Oslo'); - putenv('TZ='); // clean TZ so that it doesn't bypass the ini option - echo strtotime("2005-06-18 22:15:44"); + putenv('TZ='); // clean TZ so that it doesn't bypass the ini option + echo strtotime("2005-06-18 22:15:44"); ?> --EXPECT-- 1119125744 diff --git a/ext/date/tests/examine_diff.inc b/ext/date/tests/examine_diff.inc index c3dcba9388..8c305f1d36 100644 --- a/ext/date/tests/examine_diff.inc +++ b/ext/date/tests/examine_diff.inc @@ -33,47 +33,47 @@ define('PHPT_DATETIME_SHOW_SUB', 4); * @return void */ function examine_diff($end_date, $start_date, $expect_spec, $expect_days, $absolute = false) { - if (is_string($start_date)) { - $start = new DateTime($start_date); - } else { - $start = $start_date; - } - $start_date = $start->format('Y-m-d H:i:s T'); + if (is_string($start_date)) { + $start = new DateTime($start_date); + } else { + $start = $start_date; + } + $start_date = $start->format('Y-m-d H:i:s T'); - if (is_string($end_date)) { - $end = new DateTime($end_date); - } else { - $end = $end_date; - } - $end_date = $end->format('Y-m-d H:i:s T'); + if (is_string($end_date)) { + $end = new DateTime($end_date); + } else { + $end = $end_date; + } + $end_date = $end->format('Y-m-d H:i:s T'); - $expect_interval = new DateInterval('P' . substr($expect_spec, 2)); - if (substr($expect_spec, 1, 1) == '-') { - $expect_interval->invert = true; - } + $expect_interval = new DateInterval('P' . substr($expect_spec, 2)); + if (substr($expect_spec, 1, 1) == '-') { + $expect_interval->invert = true; + } - if (PHPT_DATETIME_SHOW == PHPT_DATETIME_SHOW_DIFF) { - $result_interval = $start->diff($end, $absolute); - $result_spec = $result_interval->format('P%R%yY%mM%dDT%hH%iM%sS'); - echo "DIFF: $end_date - $start_date = **$result_spec**\n"; - // echo "DIFF: $end_date - $start_date = **$expect_spec**\n"; - } - if (PHPT_DATETIME_SHOW == PHPT_DATETIME_SHOW_DAYS) { - $result_interval = $start->diff($end, $absolute); - $result_days = $result_interval->format('%a'); - echo "DAYS: **$result_days**\n"; - // echo "DAYS: **$expect_days**\n"; - } - if (PHPT_DATETIME_SHOW == PHPT_DATETIME_SHOW_ADD) { - $start->add($expect_interval); - $result_end_date = $start->format('Y-m-d H:i:s T'); - echo "ADD: $start_date + $expect_spec = **$result_end_date**\n"; - // echo "ADD: $start_date + $expect_spec = **$end_date**\n"; - } - if (PHPT_DATETIME_SHOW == PHPT_DATETIME_SHOW_SUB) { - $end->sub($expect_interval); - $result_start_date = $end->format('Y-m-d H:i:s T'); - echo "SUB: $end_date - $expect_spec = **$result_start_date**\n"; - // echo "SUB: $end_date - $expect_spec = **$start_date**\n"; - } + if (PHPT_DATETIME_SHOW == PHPT_DATETIME_SHOW_DIFF) { + $result_interval = $start->diff($end, $absolute); + $result_spec = $result_interval->format('P%R%yY%mM%dDT%hH%iM%sS'); + echo "DIFF: $end_date - $start_date = **$result_spec**\n"; + // echo "DIFF: $end_date - $start_date = **$expect_spec**\n"; + } + if (PHPT_DATETIME_SHOW == PHPT_DATETIME_SHOW_DAYS) { + $result_interval = $start->diff($end, $absolute); + $result_days = $result_interval->format('%a'); + echo "DAYS: **$result_days**\n"; + // echo "DAYS: **$expect_days**\n"; + } + if (PHPT_DATETIME_SHOW == PHPT_DATETIME_SHOW_ADD) { + $start->add($expect_interval); + $result_end_date = $start->format('Y-m-d H:i:s T'); + echo "ADD: $start_date + $expect_spec = **$result_end_date**\n"; + // echo "ADD: $start_date + $expect_spec = **$end_date**\n"; + } + if (PHPT_DATETIME_SHOW == PHPT_DATETIME_SHOW_SUB) { + $end->sub($expect_interval); + $result_start_date = $end->format('Y-m-d H:i:s T'); + echo "SUB: $end_date - $expect_spec = **$result_start_date**\n"; + // echo "SUB: $end_date - $expect_spec = **$start_date**\n"; + } } diff --git a/ext/date/tests/format-negative-timestamp.phpt b/ext/date/tests/format-negative-timestamp.phpt index 5fd6a65897..d8268ddc68 100644 --- a/ext/date/tests/format-negative-timestamp.phpt +++ b/ext/date/tests/format-negative-timestamp.phpt @@ -9,13 +9,13 @@ $max = getrandmax(); $max_2 = $max / 2; while($i--) { - $new_tm = rand(1, $max); - if ($new_tm > $max_2) - $new_tm *= -1; + $new_tm = rand(1, $max); + if ($new_tm > $max_2) + $new_tm *= -1; - if (strtotime("@$new_tm") != $new_tm) { - echo "Error when parsing: @$new_tm\n"; - } + if (strtotime("@$new_tm") != $new_tm) { + echo "Error when parsing: @$new_tm\n"; + } } echo "done!"; diff --git a/ext/date/tests/getdate_basic.phpt b/ext/date/tests/getdate_basic.phpt index eed29c6e4b..730f409636 100644 --- a/ext/date/tests/getdate_basic.phpt +++ b/ext/date/tests/getdate_basic.phpt @@ -22,7 +22,6 @@ var_dump( getdate($timestamp) ); var_dump( getdate() ); ?> -===DONE=== --EXPECTF-- *** Testing getdate() : basic functionality *** array(11) { @@ -73,4 +72,3 @@ array(11) { [0]=> int(%d) } -===DONE=== diff --git a/ext/date/tests/getdate_variation2.phpt b/ext/date/tests/getdate_variation2.phpt index 1e0d771afe..2081e31762 100644 --- a/ext/date/tests/getdate_variation2.phpt +++ b/ext/date/tests/getdate_variation2.phpt @@ -16,10 +16,10 @@ date_default_timezone_set("Asia/Calcutta"); //array of values to iterate over $inputs = array( - //octal values - 'octal 05' => 05, - 'octal 010' => 010, - 'octal -010' => -010, + //octal values + 'octal 05' => 05, + 'octal 010' => 010, + 'octal -010' => -010, ); // loop through each element of the array for timestamp @@ -30,7 +30,6 @@ foreach($inputs as $key =>$value) { }; ?> -===DONE=== --EXPECT-- *** Testing getdate() : usage variation *** @@ -111,4 +110,3 @@ array(11) { [0]=> int(-8) } -===DONE=== diff --git a/ext/date/tests/getdate_variation3.phpt b/ext/date/tests/getdate_variation3.phpt index 27c49a71e2..ebcc3bf23f 100644 --- a/ext/date/tests/getdate_variation3.phpt +++ b/ext/date/tests/getdate_variation3.phpt @@ -16,10 +16,10 @@ date_default_timezone_set("Asia/Calcutta"); //array of values to iterate over $inputs = array( - //octal values - 'hexadcimal 0x5' => 0x5, - 'hexadcimal 0xCAFE' => 0xCAFE, - 'octal -0xCAFE' => -0xCAFE, + //octal values + 'hexadcimal 0x5' => 0x5, + 'hexadcimal 0xCAFE' => 0xCAFE, + 'octal -0xCAFE' => -0xCAFE, ); // loop through each element of the array for timestamp @@ -30,7 +30,6 @@ foreach($inputs as $key =>$value) { }; ?> -===DONE=== --EXPECT-- *** Testing getdate() : usage variation *** @@ -111,4 +110,3 @@ array(11) { [0]=> int(-51966) } -===DONE=== diff --git a/ext/date/tests/getdate_variation4.phpt b/ext/date/tests/getdate_variation4.phpt index 49e2311c2e..48bcc1fd8d 100644 --- a/ext/date/tests/getdate_variation4.phpt +++ b/ext/date/tests/getdate_variation4.phpt @@ -16,11 +16,11 @@ date_default_timezone_set("Asia/Calcutta"); //array of values to iterate over $inputs = array( - //Year wise time stamps - '01 Jan 1970' => 0, - '01 Jan 1971' => 31536000, - '01 Jan 1972' => 63072000, - '01 Jan 1973' => 94694400, + //Year wise time stamps + '01 Jan 1970' => 0, + '01 Jan 1971' => 31536000, + '01 Jan 1972' => 63072000, + '01 Jan 1973' => 94694400, ); // loop through each element of the array for timestamp @@ -31,7 +31,6 @@ foreach($inputs as $key =>$value) { }; ?> -===DONE=== --EXPECT-- *** Testing getdate() : usage variation *** @@ -138,4 +137,3 @@ array(11) { [0]=> int(94694400) } -===DONE=== diff --git a/ext/date/tests/getdate_variation5.phpt b/ext/date/tests/getdate_variation5.phpt index f9c525ab4b..8c61c5bb61 100644 --- a/ext/date/tests/getdate_variation5.phpt +++ b/ext/date/tests/getdate_variation5.phpt @@ -12,20 +12,20 @@ echo "*** Testing getdate() : usage variation ***\n"; //Timezones with required data for date_sunrise $inputs = array ( - //GMT-11 - "Pacific/Samoa", - //GMT-9 - "US/Alaska", - //GMT-0 - "Africa/Casablanca", - //GMT+4 - "Europe/Moscow", - //GMT+8 - "Asia/Hong_Kong", - //GMT+10 - "Australia/Brisbane", - //GMT+12 - "Pacific/Wallis", + //GMT-11 + "Pacific/Samoa", + //GMT-9 + "US/Alaska", + //GMT-0 + "Africa/Casablanca", + //GMT+4 + "Europe/Moscow", + //GMT+8 + "Asia/Hong_Kong", + //GMT+10 + "Australia/Brisbane", + //GMT+12 + "Pacific/Wallis", ); // loop through each element of the array for timestamp @@ -35,7 +35,6 @@ foreach($inputs as $timezone) { var_dump( getdate(0) ); }; ?> -===DONE=== --EXPECT-- *** Testing getdate() : usage variation *** @@ -220,4 +219,3 @@ array(11) { [0]=> int(0) } -===DONE=== diff --git a/ext/date/tests/getdate_variation6.phpt b/ext/date/tests/getdate_variation6.phpt index a859afae1b..e5a98ac1a6 100644 --- a/ext/date/tests/getdate_variation6.phpt +++ b/ext/date/tests/getdate_variation6.phpt @@ -14,9 +14,9 @@ date_default_timezone_set("Asia/Calcutta"); //Timezones with required data for date_sunrise $inputs = array ( - 'String 0' => '0', - 'String 10.5' => "10.5", - 'String -10.5' => '-10.5', + 'String 0' => '0', + 'String 10.5' => "10.5", + 'String -10.5' => '-10.5', ); // loop through each element of the array for timestamp @@ -25,7 +25,6 @@ foreach($inputs as $key => $value) { var_dump( getdate($value) ); }; ?> -===DONE=== --EXPECT-- *** Testing getdate() : usage variation *** @@ -106,4 +105,3 @@ array(11) { [0]=> int(-10) } -===DONE=== diff --git a/ext/date/tests/getdate_variation7.phpt b/ext/date/tests/getdate_variation7.phpt deleted file mode 100644 index e24f3e6d84..0000000000 --- a/ext/date/tests/getdate_variation7.phpt +++ /dev/null @@ -1,37 +0,0 @@ ---TEST-- -Test getdate() function : usage variation - Passing high positive and negative float values to timestamp. ---SKIPIF-- -<?php if (PHP_INT_SIZE != 4) echo "skip this test is for 32-bit only"; ?> ---FILE-- -<?php -/* Prototype : array getdate([int timestamp]) - * Description: Get date/time information - * Source code: ext/date/php_date.c - * Alias to functions: - */ - -echo "*** Testing getdate() : usage variation ***\n"; -date_default_timezone_set("Asia/Calcutta"); - -echo "\n-- Testing getdate() function by passing float 12.3456789000e10 value to timestamp --\n"; -$timestamp = 12.3456789000e10; -var_dump( getdate($timestamp) ); - -echo "\n-- Testing getdate() function by passing float -12.3456789000e10 value to timestamp --\n"; -$timestamp = -12.3456789000e10; -var_dump( getdate($timestamp) ); -?> -===DONE=== ---EXPECTF-- -*** Testing getdate() : usage variation *** - --- Testing getdate() function by passing float 12.3456789000e10 value to timestamp -- - -Warning: getdate() expects parameter 1 to be int, float given in %s on line %d -bool(false) - --- Testing getdate() function by passing float -12.3456789000e10 value to timestamp -- - -Warning: getdate() expects parameter 1 to be int, float given in %s on line %d -bool(false) -===DONE=== diff --git a/ext/date/tests/gettimeofday_basic.phpt b/ext/date/tests/gettimeofday_basic.phpt index f982130752..16314839b3 100644 --- a/ext/date/tests/gettimeofday_basic.phpt +++ b/ext/date/tests/gettimeofday_basic.phpt @@ -28,7 +28,6 @@ $get_as_float = false; var_dump( gettimeofday($get_as_float) ); ?> -===DONE=== --EXPECTF-- *** Testing gettimeofday() : basic functionality *** float(%f) @@ -52,4 +51,3 @@ array(4) { ["dsttime"]=> int(0) } -===DONE=== diff --git a/ext/date/tests/gmdate_basic.phpt b/ext/date/tests/gmdate_basic.phpt index 3ebde84d62..118d7f656f 100644 --- a/ext/date/tests/gmdate_basic.phpt +++ b/ext/date/tests/gmdate_basic.phpt @@ -22,9 +22,7 @@ var_dump( gmdate($format, $timestamp) ); var_dump( gmdate($format) ); ?> -===DONE=== --EXPECTF-- *** Testing gmdate() : basic functionality *** string(24) "2008-08-08T08:08:08+0000" string(%d) "%s" -===DONE=== diff --git a/ext/date/tests/gmdate_variation10.phpt b/ext/date/tests/gmdate_variation10.phpt index fd72d5bf75..1de17d2ab1 100644 --- a/ext/date/tests/gmdate_variation10.phpt +++ b/ext/date/tests/gmdate_variation10.phpt @@ -39,7 +39,6 @@ var_dump( gmdate('T') ); var_dump( gmdate('T', $timestamp) ); ?> -===DONE=== --EXPECTF-- *** Testing gmdate() : usage variation *** @@ -66,4 +65,3 @@ string(3) "GMT" -- Testing gmdate() function with timezone offset format -- string(3) "GMT" string(3) "GMT" -===DONE=== diff --git a/ext/date/tests/gmdate_variation11.phpt b/ext/date/tests/gmdate_variation11.phpt index 601864d829..cd3fda5c1d 100644 --- a/ext/date/tests/gmdate_variation11.phpt +++ b/ext/date/tests/gmdate_variation11.phpt @@ -27,7 +27,6 @@ var_dump( gmdate('U') ); var_dump( gmdate('U', $timestamp) ); ?> -===DONE=== --EXPECTF-- *** Testing gmdate() : usage variation *** @@ -42,4 +41,3 @@ string(31) "Fri, 08 Aug 2008 08:08:08 +0000" -- Testing gmdate() function with seconds since Unix Epoch format -- string(%d) "%d" string(10) "1218182888" -===DONE=== diff --git a/ext/date/tests/gmdate_variation12.phpt b/ext/date/tests/gmdate_variation12.phpt index 60bb69a32a..38af31db3c 100644 --- a/ext/date/tests/gmdate_variation12.phpt +++ b/ext/date/tests/gmdate_variation12.phpt @@ -30,7 +30,6 @@ $timestamp = mktime(03, 14, 10, 1, 19, 2038); var_dump( gmdate(DATE_ISO8601, $timestamp) ); ?> -===DONE=== --EXPECTREGEX-- \*\*\* Testing gmdate\(\) : usage variation \*\*\* @@ -45,4 +44,3 @@ string\(24\) "2038-01-19T03:14:07\+0000" -- Testing gmdate\(\) function with greater than the range of timestamp -- string\(24\) "(1970-01-01T00:00:00\+0000|2038-01-19T03:14:10\+0000)" -===DONE=== diff --git a/ext/date/tests/gmdate_variation13.phpt b/ext/date/tests/gmdate_variation13.phpt index 58103ec9f4..877671b926 100644 --- a/ext/date/tests/gmdate_variation13.phpt +++ b/ext/date/tests/gmdate_variation13.phpt @@ -17,26 +17,25 @@ $timestamp = mktime(8, 8, 8, 8, 8, 2008); $inputs = array( // Predefined Date constants 'DATE_ATOM Constant' => DATE_ATOM, - 'DATE_COOKIE Constant' => DATE_COOKIE, - 'DATE_RFC822 Constant' => DATE_RFC822, - 'DATE_RFC850 Constant' => DATE_RFC850, - 'DATE_RFC1036 Constant' => DATE_RFC1036, - 'DATE_RFC1123 Constant' => DATE_RFC1123, - 'DATE_RFC2822 Constant' => DATE_RFC2822, - 'DATE_RFC3339 Constant' => DATE_RFC3339, - 'DATE_RSS Constant' => DATE_RSS, - 'DATE_W3C Constant' => DATE_W3C, + 'DATE_COOKIE Constant' => DATE_COOKIE, + 'DATE_RFC822 Constant' => DATE_RFC822, + 'DATE_RFC850 Constant' => DATE_RFC850, + 'DATE_RFC1036 Constant' => DATE_RFC1036, + 'DATE_RFC1123 Constant' => DATE_RFC1123, + 'DATE_RFC2822 Constant' => DATE_RFC2822, + 'DATE_RFC3339 Constant' => DATE_RFC3339, + 'DATE_RSS Constant' => DATE_RSS, + 'DATE_W3C Constant' => DATE_W3C, ); // loop through each element of the array for format foreach($inputs as $key =>$value) { echo "\n--$key--\n"; - var_dump( gmdate($value, $timestamp) ); - var_dump( gmdate($value) ); + var_dump( gmdate($value, $timestamp) ); + var_dump( gmdate($value) ); }; ?> -===DONE=== --EXPECTF-- *** Testing gmdate() : usage variation *** @@ -79,4 +78,3 @@ string(%d) "%s" --DATE_W3C Constant-- string(25) "2008-08-08T08:08:08+00:00" string(%d) "%s" -===DONE=== diff --git a/ext/date/tests/gmdate_variation14.phpt b/ext/date/tests/gmdate_variation14.phpt deleted file mode 100644 index 5b6c48fca5..0000000000 --- a/ext/date/tests/gmdate_variation14.phpt +++ /dev/null @@ -1,40 +0,0 @@ ---TEST-- -Test gmdate() function : usage variation - Passing high positive and negetive float values to timestamp. ---SKIPIF-- -<?php if (PHP_INT_SIZE != 4) echo "skip this test is for 32-bit only"; ?> ---FILE-- -<?php -/* Prototype : string gmdate(string format [, long timestamp]) - * Description: Format a GMT date/time - * Source code: ext/date/php_date.c - */ - -echo "*** Testing gmdate() : usage variation ***\n"; - -// Initialise all required variables -date_default_timezone_set('UTC'); -$format = DATE_ISO8601; - -echo "\n-- Testing gmdate() function with float 12.3456789000e10 to timestamp --\n"; -$timestamp = 12.3456789000e10; -var_dump( gmdate($format, $timestamp) ); - -echo "\n-- Testing gmdate() function with float -12.3456789000e10 to timestamp --\n"; -$timestamp = -12.3456789000e10; -var_dump( gmdate($format, $timestamp) ); - -?> -===DONE=== ---EXPECTF-- -*** Testing gmdate() : usage variation *** - --- Testing gmdate() function with float 12.3456789000e10 to timestamp -- - -Warning: gmdate() expects parameter 2 to be int, float given in %s on line %d -bool(false) - --- Testing gmdate() function with float -12.3456789000e10 to timestamp -- - -Warning: gmdate() expects parameter 2 to be int, float given in %s on line %d -bool(false) -===DONE=== diff --git a/ext/date/tests/gmdate_variation3.phpt b/ext/date/tests/gmdate_variation3.phpt index 8e13182a64..c9ee765476 100644 --- a/ext/date/tests/gmdate_variation3.phpt +++ b/ext/date/tests/gmdate_variation3.phpt @@ -17,11 +17,11 @@ $timestamp = mktime(8, 8, 8, 8, 8, 2008); //array of values to iterate over $inputs = array( - 'Day with leading zeros' => 'd', - 'Day without leading zeros' => 'j', - 'ISO representation' => 'N', - 'Numeric representation of day' => 'w', - 'Day of the year' => 'z' + 'Day with leading zeros' => 'd', + 'Day without leading zeros' => 'j', + 'ISO representation' => 'N', + 'Numeric representation of day' => 'w', + 'Day of the year' => 'z' ); // loop through each element of the array for timestamp @@ -33,7 +33,6 @@ foreach($inputs as $key =>$value) { }; ?> -===DONE=== --EXPECTF-- *** Testing gmdate() : usage variation *** @@ -56,4 +55,3 @@ string(1) "5" --Day of the year-- string(%d) "%d" string(3) "220" -===DONE=== diff --git a/ext/date/tests/gmdate_variation4.phpt b/ext/date/tests/gmdate_variation4.phpt index a23877923a..0b4a25fff4 100644 --- a/ext/date/tests/gmdate_variation4.phpt +++ b/ext/date/tests/gmdate_variation4.phpt @@ -27,7 +27,6 @@ var_dump( gmdate('S') ); var_dump( gmdate('S', $timestamp) ); ?> -===DONE=== --EXPECTF-- *** Testing gmdate() : usage variation *** @@ -42,4 +41,3 @@ string(6) "Friday" -- Testing gmdate() function with English ordinal suffix -- string(%d) "%s" string(2) "th" -===DONE=== diff --git a/ext/date/tests/gmdate_variation5.phpt b/ext/date/tests/gmdate_variation5.phpt index 0127fc5876..cd8b0d581f 100644 --- a/ext/date/tests/gmdate_variation5.phpt +++ b/ext/date/tests/gmdate_variation5.phpt @@ -19,11 +19,9 @@ var_dump( gmdate('W') ); var_dump( gmdate('W', $timestamp) ); ?> -===DONE=== --EXPECTF-- *** Testing gmdate() : usage variation *** -- Testing gmdate() function with ISO-8601 week number of year format -- string(%d) "%d" string(2) "32" -===DONE=== diff --git a/ext/date/tests/gmdate_variation6.phpt b/ext/date/tests/gmdate_variation6.phpt index f5d8684ec7..456f85a2f2 100644 --- a/ext/date/tests/gmdate_variation6.phpt +++ b/ext/date/tests/gmdate_variation6.phpt @@ -35,7 +35,6 @@ var_dump( gmdate('t') ); var_dump( gmdate('t', $timestamp) ); ?> -===DONE=== --EXPECTF-- *** Testing gmdate() : usage variation *** @@ -58,4 +57,3 @@ string(1) "8" -- Testing gmdate() function with number of days in a month format -- string(%d) "%d" string(2) "31" -===DONE=== diff --git a/ext/date/tests/gmdate_variation7.phpt b/ext/date/tests/gmdate_variation7.phpt index 1b590ad75b..8f1698d960 100644 --- a/ext/date/tests/gmdate_variation7.phpt +++ b/ext/date/tests/gmdate_variation7.phpt @@ -35,7 +35,6 @@ var_dump( gmdate('y') ); var_dump( gmdate('y', $timestamp) ); ?> -===DONE=== --EXPECTF-- *** Testing gmdate() : usage variation *** @@ -57,4 +56,3 @@ string(4) "2008" -- Testing gmdate() function with 2 digit representation year format -- string(2) "%d" string(2) "08" -===DONE=== diff --git a/ext/date/tests/gmdate_variation9.phpt b/ext/date/tests/gmdate_variation9.phpt index 85c4e72042..cd43217d08 100644 --- a/ext/date/tests/gmdate_variation9.phpt +++ b/ext/date/tests/gmdate_variation9.phpt @@ -17,25 +17,24 @@ $timestamp = mktime(8, 8, 8, 8, 8, 2008); $time_formats = array( 'Lowercase Ante meridiem and post meridiem' => 'a', - 'Uppercase Ante meridiem and post meridiem' => 'a', - 'Swatch Internet time' => 'B', - '12-hour format without leading zeros' => 'g', - '24-hour format without leading zeros' => 'G', - '12-hour format with leading zeros' => 'h', - '24-hour format with leading zeros' => 'H', - 'Minutes with leading zeros' => 'i', - 'Seconds with leading zeros' => 's', - 'Milliseconds' => 'u', + 'Uppercase Ante meridiem and post meridiem' => 'a', + 'Swatch Internet time' => 'B', + '12-hour format without leading zeros' => 'g', + '24-hour format without leading zeros' => 'G', + '12-hour format with leading zeros' => 'h', + '24-hour format with leading zeros' => 'H', + 'Minutes with leading zeros' => 'i', + 'Seconds with leading zeros' => 's', + 'Milliseconds' => 'u', ); foreach($time_formats as $key =>$value) { echo "\n--$key--\n"; - var_dump( gmdate($value) ); - var_dump( gmdate($value, $timestamp) ); + var_dump( gmdate($value) ); + var_dump( gmdate($value, $timestamp) ); } ?> -===DONE=== --EXPECTF-- *** Testing gmdate() : usage variation *** @@ -78,4 +77,3 @@ string(2) "08" --Milliseconds-- string(%d) "%d" string(6) "000000" -===DONE=== diff --git a/ext/date/tests/gmmktime_basic.phpt b/ext/date/tests/gmmktime_basic.phpt index cdb44f0c62..f96b635c08 100644 --- a/ext/date/tests/gmmktime_basic.phpt +++ b/ext/date/tests/gmmktime_basic.phpt @@ -21,15 +21,7 @@ $year = 2008; // Calling gmmktime() with all possible arguments var_dump( gmmktime($hour, $min, $sec, $mon, $day, $year) ); -// Calling gmmktime() with mandatory arguments -var_dump( gmmktime() ); - ?> -===DONE=== ---EXPECTF-- +--EXPECT-- *** Testing gmmktime() : basic functionality *** int(1218182888) - -Deprecated: gmmktime(): You should be using the time() function instead in %s on line %d -int(%d) -===DONE=== diff --git a/ext/date/tests/gmmktime_variation7.phpt b/ext/date/tests/gmmktime_variation7.phpt index 223da1cc71..e943f7db15 100644 --- a/ext/date/tests/gmmktime_variation7.phpt +++ b/ext/date/tests/gmmktime_variation7.phpt @@ -33,7 +33,6 @@ echo "\n-- Testing gmmktime() function with five optional argument --\n"; var_dump( gmmktime($hour, $min, $sec, $mon, $day) ); ?> -===DONE=== --EXPECTF-- *** Testing gmmktime() : usage variation *** @@ -51,4 +50,3 @@ int(%d) -- Testing gmmktime() function with five optional argument -- int(%d) -===DONE=== diff --git a/ext/date/tests/gmmktime_variation8.phpt b/ext/date/tests/gmmktime_variation8.phpt index ab6e45e342..4bbbe6eb4e 100644 --- a/ext/date/tests/gmmktime_variation8.phpt +++ b/ext/date/tests/gmmktime_variation8.phpt @@ -32,7 +32,6 @@ $year = 0x7D8; echo "\n-- Testing gmmktime() function with supplying hexa decimal values to arguments --\n"; var_dump( gmmktime($hour, $min, $sec, $mon, $day, $year) ); ?> -===DONE=== --EXPECT-- *** Testing gmmktime() : usage variation *** @@ -41,4 +40,3 @@ int(1218182888) -- Testing gmmktime() function with supplying hexa decimal values to arguments -- int(1218182888) -===DONE=== diff --git a/ext/date/tests/gmmktime_variation9.phpt b/ext/date/tests/gmmktime_variation9.phpt index 1d1750b9b5..40c4d3a39d 100644 --- a/ext/date/tests/gmmktime_variation9.phpt +++ b/ext/date/tests/gmmktime_variation9.phpt @@ -20,7 +20,7 @@ $year = 2008; $inputs = array( - 'float 123456' => 123456, + 'float 123456' => 123456, 'float -123456' => -123456, 'float -10.5' => -10.5, ); @@ -28,14 +28,13 @@ $inputs = array( // loop through each element of the array for min foreach($inputs as $key =>$value) { echo "\n--$key--\n"; - var_dump( gmmktime($value, $min, $sec, $mon, $day, $year) ); - var_dump( gmmktime($hour, $value, $sec, $mon, $day, $year) ); - var_dump( gmmktime($hour, $min, $value, $mon, $day, $year) ); - var_dump( gmmktime($hour, $min, $sec, $value, $day, $year) ); - var_dump( gmmktime($hour, $min, $sec, $mon, $value, $value) ); + var_dump( gmmktime($value, $min, $sec, $mon, $day, $year) ); + var_dump( gmmktime($hour, $value, $sec, $mon, $day, $year) ); + var_dump( gmmktime($hour, $min, $value, $mon, $day, $year) ); + var_dump( gmmktime($hour, $min, $sec, $value, $day, $year) ); + var_dump( gmmktime($hour, $min, $sec, $mon, $value, $value) ); } ?> -===DONE=== --EXPECTREGEX-- \*\*\* Testing gmmktime\(\) : usage variation \*\*\* @@ -59,4 +58,3 @@ int\(1218181808\) int\(1218182870\) int\(1170922088\) (bool|int)\((false|-62465356312)\) -===DONE=== diff --git a/ext/date/tests/gmstrftime_basic.phpt b/ext/date/tests/gmstrftime_basic.phpt index 1accff5127..7c83b147a2 100644 --- a/ext/date/tests/gmstrftime_basic.phpt +++ b/ext/date/tests/gmstrftime_basic.phpt @@ -21,9 +21,7 @@ var_dump( gmstrftime($format, $timestamp) ); var_dump( gmstrftime($format) ); ?> -===DONE=== --EXPECTF-- *** Testing gmstrftime() : basic functionality *** string(20) "Aug 08 2008 08:08:08" string(%d) "%s %d %d %d:%d:%d" -===DONE=== diff --git a/ext/date/tests/gmstrftime_variation10.phpt b/ext/date/tests/gmstrftime_variation10.phpt index 70cca370ba..b20a3ecbe7 100644 --- a/ext/date/tests/gmstrftime_variation10.phpt +++ b/ext/date/tests/gmstrftime_variation10.phpt @@ -23,8 +23,8 @@ date_default_timezone_set("Asia/Calcutta"); //array of values to iterate over $inputs = array( - 'The ISO 8601:1988 week number' => "%V", - 'Weekday as decimal' => "%u", + 'The ISO 8601:1988 week number' => "%V", + 'Weekday as decimal' => "%u", ); // loop through each element of the array for timestamp @@ -36,7 +36,6 @@ foreach($inputs as $key =>$value) { }; ?> -===DONE=== --EXPECTF-- *** Testing gmstrftime() : usage variation *** @@ -47,4 +46,3 @@ string(2) "32" --Weekday as decimal-- string(%d) "%d" string(1) "5" -===DONE=== diff --git a/ext/date/tests/gmstrftime_variation11.phpt b/ext/date/tests/gmstrftime_variation11.phpt index f64c3ea1e2..7e7ac1c8fd 100644 --- a/ext/date/tests/gmstrftime_variation11.phpt +++ b/ext/date/tests/gmstrftime_variation11.phpt @@ -21,11 +21,9 @@ var_dump( gmstrftime($format) ); var_dump( gmstrftime($format, $timestamp) ); ?> -===DONE=== --EXPECTF-- *** Testing gmstrftime() : usage variation *** -- Testing gmstrftime() function with Abbreviated month name format %h -- string(%d) "%s" string(3) "Aug" -===DONE=== diff --git a/ext/date/tests/gmstrftime_variation12.phpt b/ext/date/tests/gmstrftime_variation12.phpt index 96d034b2d2..42f100a1f1 100644 --- a/ext/date/tests/gmstrftime_variation12.phpt +++ b/ext/date/tests/gmstrftime_variation12.phpt @@ -27,11 +27,9 @@ var_dump( gmstrftime($format) ); var_dump( gmstrftime($format, $timestamp) ); ?> -===DONE=== --EXPECTF-- *** Testing gmstrftime() : usage variation *** -- Testing gmstrftime() function with Abbreviated month name format %h -- string(%d) "%s" string(3) "Aug" -===DONE=== diff --git a/ext/date/tests/gmstrftime_variation13.phpt b/ext/date/tests/gmstrftime_variation13.phpt index 9a7a9b3c4b..a237e9dc8b 100644 --- a/ext/date/tests/gmstrftime_variation13.phpt +++ b/ext/date/tests/gmstrftime_variation13.phpt @@ -17,10 +17,10 @@ date_default_timezone_set("Asia/Calcutta"); //array of values to iterate over $inputs = array( - 'Century number' => "%C", - 'Month Date Year' => "%D", - 'Year with century' => "%G", - 'Year without century' => "%g", + 'Century number' => "%C", + 'Month Date Year' => "%D", + 'Year with century' => "%G", + 'Year without century' => "%g", ); // loop through each element of the array for timestamp @@ -32,7 +32,6 @@ foreach($inputs as $key =>$value) { }; ?> -===DONE=== --EXPECTF-- *** Testing gmstrftime() : usage variation *** @@ -51,4 +50,3 @@ string(4) "2008" --Year without century-- string(2) "%d" string(2) "08" -===DONE=== diff --git a/ext/date/tests/gmstrftime_variation14.phpt b/ext/date/tests/gmstrftime_variation14.phpt index fca6829231..c53f5ea2f0 100644 --- a/ext/date/tests/gmstrftime_variation14.phpt +++ b/ext/date/tests/gmstrftime_variation14.phpt @@ -23,10 +23,10 @@ date_default_timezone_set("Asia/Calcutta"); //array of values to iterate over $inputs = array( - 'Century number' => "%C", - 'Month Date Year' => "%D", - 'Year with century' => "%G", - 'Year without century' => "%g", + 'Century number' => "%C", + 'Month Date Year' => "%D", + 'Year with century' => "%G", + 'Year without century' => "%g", ); // loop through each element of the array for timestamp @@ -38,7 +38,6 @@ foreach($inputs as $key =>$value) { }; ?> -===DONE=== --EXPECTF-- *** Testing gmstrftime() : usage variation *** @@ -57,4 +56,3 @@ string(4) "2008" --Year without century-- string(%d) "%d" string(2) "08" -===DONE=== diff --git a/ext/date/tests/gmstrftime_variation15.phpt b/ext/date/tests/gmstrftime_variation15.phpt index ac91c66a9e..02907f846c 100644 --- a/ext/date/tests/gmstrftime_variation15.phpt +++ b/ext/date/tests/gmstrftime_variation15.phpt @@ -17,9 +17,9 @@ date_default_timezone_set("Asia/Calcutta"); //array of values to iterate over $inputs = array( - 'Time in a.m/p.m notation' => "%r", - 'Time in 24 hour notation' => "%R", - 'Current time %H:%M:%S format' => "%T", + 'Time in a.m/p.m notation' => "%r", + 'Time in 24 hour notation' => "%R", + 'Current time %H:%M:%S format' => "%T", ); // loop through each element of the array for timestamp @@ -31,7 +31,6 @@ foreach($inputs as $key =>$value) { }; ?> -===DONE=== --EXPECTF-- *** Testing gmstrftime() : usage variation *** @@ -46,4 +45,3 @@ string(5) "08:08" --Current time %H:%M:%S format-- string(%d) "%d:%d:%d" string(8) "08:08:08" -===DONE=== diff --git a/ext/date/tests/gmstrftime_variation16.phpt b/ext/date/tests/gmstrftime_variation16.phpt index 762c954163..74be81747a 100644 --- a/ext/date/tests/gmstrftime_variation16.phpt +++ b/ext/date/tests/gmstrftime_variation16.phpt @@ -23,9 +23,9 @@ date_default_timezone_set("Asia/Calcutta"); //array of values to iterate over $inputs = array( - 'Time in a.m/p.m notation' => "%r", - 'Time in 24 hour notation' => "%R", - 'Current time %H:%M:%S format' => "%T", + 'Time in a.m/p.m notation' => "%r", + 'Time in 24 hour notation' => "%R", + 'Current time %H:%M:%S format' => "%T", ); // loop through each element of the array for timestamp @@ -37,7 +37,6 @@ foreach($inputs as $key =>$value) { }; ?> -===DONE=== --EXPECTF-- *** Testing gmstrftime() : usage variation *** @@ -52,4 +51,3 @@ string(5) "14:08" --Current time %H:%M:%S format-- string(%d) "%d:%d:%d" string(8) "14:08:08" -===DONE=== diff --git a/ext/date/tests/gmstrftime_variation17.phpt b/ext/date/tests/gmstrftime_variation17.phpt index 9abdb76e0c..9ff60af277 100644 --- a/ext/date/tests/gmstrftime_variation17.phpt +++ b/ext/date/tests/gmstrftime_variation17.phpt @@ -21,11 +21,9 @@ var_dump( gmstrftime($format) ); var_dump( gmstrftime($format, $timestamp) ); ?> -===DONE=== --EXPECTF-- *** Testing gmstrftime() : usage variation *** -- Testing gmstrftime() function with Day of the month as decimal single digit format -- string(2) "%A%d" string(2) " 8" -===DONE=== diff --git a/ext/date/tests/gmstrftime_variation18.phpt b/ext/date/tests/gmstrftime_variation18.phpt index f74d82229b..74912dfa48 100644 --- a/ext/date/tests/gmstrftime_variation18.phpt +++ b/ext/date/tests/gmstrftime_variation18.phpt @@ -27,11 +27,9 @@ var_dump( gmstrftime($format) ); var_dump( gmstrftime($format, $timestamp) ); ?> -===DONE=== --EXPECTF-- *** Testing gmstrftime() : usage variation *** -- Testing gmstrftime() function with Day of the month as decimal single digit format -- string(%d) "%s" string(2) " 8" -===DONE=== diff --git a/ext/date/tests/gmstrftime_variation19.phpt b/ext/date/tests/gmstrftime_variation19.phpt index 983911fa48..8dc6923923 100644 --- a/ext/date/tests/gmstrftime_variation19.phpt +++ b/ext/date/tests/gmstrftime_variation19.phpt @@ -17,8 +17,8 @@ date_default_timezone_set("Asia/Calcutta"); //array of values to iterate over $inputs = array( - 'Newline character' => "%n", - 'Tab character' => "%t" + 'Newline character' => "%n", + 'Tab character' => "%t" ); // loop through each element of the array for timestamp @@ -30,7 +30,6 @@ foreach($inputs as $key =>$value) { }; ?> -===DONE=== --EXPECT-- *** Testing gmstrftime() : usage variation *** @@ -43,4 +42,3 @@ string(1) " --Tab character-- string(1) " " string(1) " " -===DONE=== diff --git a/ext/date/tests/gmstrftime_variation20.phpt b/ext/date/tests/gmstrftime_variation20.phpt index 135520e37c..2c6ab02364 100644 --- a/ext/date/tests/gmstrftime_variation20.phpt +++ b/ext/date/tests/gmstrftime_variation20.phpt @@ -23,8 +23,8 @@ date_default_timezone_set("Asia/Calcutta"); //array of values to iterate over $inputs = array( - 'Newline character' => "%n", - 'Tab character' => "%t" + 'Newline character' => "%n", + 'Tab character' => "%t" ); // loop through each element of the array for timestamp @@ -36,7 +36,6 @@ foreach($inputs as $key =>$value) { }; ?> -===DONE=== --EXPECTREGEX-- \*\*\* Testing gmstrftime\(\) : usage variation \*\*\* @@ -49,4 +48,3 @@ string\(1\) " --Tab character-- string\(1\) "\s" string\(1\) "\s" -===DONE=== diff --git a/ext/date/tests/gmstrftime_variation21.phpt b/ext/date/tests/gmstrftime_variation21.phpt index 8ff050fc9a..9ffbf82b24 100644 --- a/ext/date/tests/gmstrftime_variation21.phpt +++ b/ext/date/tests/gmstrftime_variation21.phpt @@ -18,8 +18,8 @@ date_default_timezone_set("Asia/Calcutta"); //array of values to iterate over $inputs = array( 'Preferred date and time representation' => "%c", - 'Preferred date representation' => "%x", - 'Preferred time representation' => "%X", + 'Preferred date representation' => "%x", + 'Preferred time representation' => "%X", ); // loop through each element of the array for timestamp @@ -31,7 +31,6 @@ foreach($inputs as $key =>$value) { }; ?> -===DONE=== --EXPECTF-- *** Testing gmstrftime() : usage variation *** @@ -46,4 +45,3 @@ string(8) "08/08/08" --Preferred time representation-- string(%d) "%d:%d:%d" string(8) "08:08:08" -===DONE=== diff --git a/ext/date/tests/gmstrftime_variation22.phpt b/ext/date/tests/gmstrftime_variation22.phpt index 1a69726f67..e907254227 100644 --- a/ext/date/tests/gmstrftime_variation22.phpt +++ b/ext/date/tests/gmstrftime_variation22.phpt @@ -28,8 +28,8 @@ date_default_timezone_set("Asia/Calcutta"); //array of values to iterate over $inputs = array( 'Preferred date and time representation' => "%c", - 'Preferred date representation' => "%x", - 'Preferred time representation' => "%X", + 'Preferred date representation' => "%x", + 'Preferred time representation' => "%X", ); // loop through each element of the array for timestamp @@ -41,7 +41,6 @@ foreach($inputs as $key =>$value) { }; ?> -===DONE=== --EXPECT-- *** Testing gmstrftime() : usage variation *** @@ -56,4 +55,3 @@ string(8) "08/08/08" --Preferred time representation-- string(2) "%X" string(8) "08:08:08" -===DONE=== diff --git a/ext/date/tests/gmstrftime_variation3.phpt b/ext/date/tests/gmstrftime_variation3.phpt index aebb938a77..b33e543e12 100644 --- a/ext/date/tests/gmstrftime_variation3.phpt +++ b/ext/date/tests/gmstrftime_variation3.phpt @@ -17,8 +17,8 @@ $timestamp = gmmktime(8, 8, 8, 8, 8, 2008); $inputs = array( 'Abbreviated weekday name' => "%a", 'Full weekday name' => "%A", - 'Week number of the year' => "%U", - 'Week number of the year in decimal number' => "%W", + 'Week number of the year' => "%U", + 'Week number of the year in decimal number' => "%W", ); // loop through each element of the array for timestamp @@ -30,7 +30,6 @@ foreach($inputs as $key =>$value) { }; ?> -===DONE=== --EXPECTF-- *** Testing gmstrftime() : usage variation *** @@ -49,4 +48,3 @@ string(2) "31" --Week number of the year in decimal number-- string(%d) "%d" string(2) "31" -===DONE=== diff --git a/ext/date/tests/gmstrftime_variation4.phpt b/ext/date/tests/gmstrftime_variation4.phpt index 3ec4e06e17..97ffb8f75f 100644 --- a/ext/date/tests/gmstrftime_variation4.phpt +++ b/ext/date/tests/gmstrftime_variation4.phpt @@ -17,7 +17,7 @@ $timestamp = gmmktime(8, 8, 8, 8, 8, 2008); $inputs = array( 'Abbreviated month name' => "%b", 'Full month name' => "%B", - 'Month as decimal' => "%m", + 'Month as decimal' => "%m", ); // loop through each element of the array for timestamp @@ -29,7 +29,6 @@ foreach($inputs as $key =>$value) { }; ?> -===DONE=== --EXPECTF-- *** Testing gmstrftime() : usage variation *** @@ -44,4 +43,3 @@ string(6) "August" --Month as decimal-- string(%d) "%d" string(2) "08" -===DONE=== diff --git a/ext/date/tests/gmstrftime_variation5.phpt b/ext/date/tests/gmstrftime_variation5.phpt index c43c1e3740..ca4c9e5e64 100644 --- a/ext/date/tests/gmstrftime_variation5.phpt +++ b/ext/date/tests/gmstrftime_variation5.phpt @@ -18,10 +18,10 @@ date_default_timezone_set("Asia/Calcutta"); //array of values to iterate over $inputs = array( - 'Year as decimal number without a century' => "%y", - 'Year as decimal number including the century' => "%Y", - 'Time zone offset' => "%Z", - 'Time zone offset' => "%z", + 'Year as decimal number without a century' => "%y", + 'Year as decimal number including the century' => "%Y", + 'Time zone offset' => "%Z", + 'Time zone offset' => "%z", ); // loop through each element of the array for timestamp @@ -33,7 +33,6 @@ foreach($inputs as $key =>$value) { }; ?> -===DONE=== --EXPECTF-- *** Testing gmstrftime() : usage variation *** @@ -48,4 +47,3 @@ string(4) "2008" --Time zone offset-- string(%s) "%s" string(%s) "%s" -===DONE=== diff --git a/ext/date/tests/gmstrftime_variation6.phpt b/ext/date/tests/gmstrftime_variation6.phpt index f09df7847b..a00d27af5c 100644 --- a/ext/date/tests/gmstrftime_variation6.phpt +++ b/ext/date/tests/gmstrftime_variation6.phpt @@ -17,11 +17,11 @@ date_default_timezone_set("Asia/Calcutta"); //array of values to iterate over $inputs = array( - 'Hour as decimal by 24-hour format' => "%H", - 'Hour as decimal by 12-hour format' => "%I", - 'Minute as decimal number' => "%M", - 'AM/PM format for a time' => "%p", - 'Second as decimal number' => "%S", + 'Hour as decimal by 24-hour format' => "%H", + 'Hour as decimal by 12-hour format' => "%I", + 'Minute as decimal number' => "%M", + 'AM/PM format for a time' => "%p", + 'Second as decimal number' => "%S", ); // loop through each element of the array for timestamp @@ -33,7 +33,6 @@ foreach($inputs as $key =>$value) { }; ?> -===DONE=== --EXPECTF-- *** Testing gmstrftime() : usage variation *** @@ -56,4 +55,3 @@ string(2) "AM" --Second as decimal number-- string(%d) "%d" string(2) "08" -===DONE=== diff --git a/ext/date/tests/gmstrftime_variation7.phpt b/ext/date/tests/gmstrftime_variation7.phpt index 4cb69e1d2f..4f2c5876f2 100644 --- a/ext/date/tests/gmstrftime_variation7.phpt +++ b/ext/date/tests/gmstrftime_variation7.phpt @@ -17,9 +17,9 @@ date_default_timezone_set("Asia/Calcutta"); //array of values to iterate over $inputs = array( - 'Day of the month as a decimal number' => "%d", - 'Day of the year as a decimal number' => "%j", - 'Day of the week as a decimal number' => "%w" + 'Day of the month as a decimal number' => "%d", + 'Day of the year as a decimal number' => "%j", + 'Day of the week as a decimal number' => "%w" ); // loop through each element of the array for timestamp @@ -31,7 +31,6 @@ foreach($inputs as $key =>$value) { }; ?> -===DONE=== --EXPECTF-- *** Testing gmstrftime() : usage variation *** @@ -46,4 +45,3 @@ string(3) "221" --Day of the week as a decimal number-- string(%d) "%d" string(1) "5" -===DONE=== diff --git a/ext/date/tests/gmstrftime_variation8.phpt b/ext/date/tests/gmstrftime_variation8.phpt index 311956586a..26ba201039 100644 --- a/ext/date/tests/gmstrftime_variation8.phpt +++ b/ext/date/tests/gmstrftime_variation8.phpt @@ -17,7 +17,7 @@ date_default_timezone_set("Asia/Calcutta"); //array of values to iterate over $inputs = array( - 'A literal % character' => "%%", + 'A literal % character' => "%%", ); // loop through each element of the array for timestamp @@ -29,11 +29,9 @@ foreach($inputs as $key =>$value) { }; ?> -===DONE=== --EXPECT-- *** Testing gmstrftime() : usage variation *** --A literal % character-- string(1) "%" string(1) "%" -===DONE=== diff --git a/ext/date/tests/gmstrftime_variation9.phpt b/ext/date/tests/gmstrftime_variation9.phpt index 560ea2db47..a6910675dc 100644 --- a/ext/date/tests/gmstrftime_variation9.phpt +++ b/ext/date/tests/gmstrftime_variation9.phpt @@ -17,8 +17,8 @@ date_default_timezone_set("Asia/Calcutta"); //array of values to iterate over $inputs = array( - 'The ISO 8601:1988 week number' => "%V", - 'Weekday as decimal' => "%u", + 'The ISO 8601:1988 week number' => "%V", + 'Weekday as decimal' => "%u", ); // loop through each element of the array for timestamp @@ -30,7 +30,6 @@ foreach($inputs as $key =>$value) { }; ?> -===DONE=== --EXPECTF-- *** Testing gmstrftime() : usage variation *** @@ -41,4 +40,3 @@ string(2) "32" --Weekday as decimal-- string(1) "%d" string(1) "5" -===DONE=== diff --git a/ext/date/tests/idate_basic.phpt b/ext/date/tests/idate_basic.phpt index 2306a5f64f..86aace6c4b 100644 --- a/ext/date/tests/idate_basic.phpt +++ b/ext/date/tests/idate_basic.phpt @@ -17,8 +17,6 @@ $format = 'Y'; date_default_timezone_set("Asia/Calcutta"); var_dump( idate($format) ); ?> -===DONE=== --EXPECTF-- *** Testing idate() : basic functionality *** int(%d) -===DONE=== diff --git a/ext/date/tests/idate_variation3.phpt b/ext/date/tests/idate_variation3.phpt deleted file mode 100644 index 9b6bc567e0..0000000000 --- a/ext/date/tests/idate_variation3.phpt +++ /dev/null @@ -1,41 +0,0 @@ ---TEST-- -Test idate() function : usage variation - Passing higher positive and negetive float values to timestamp. ---SKIPIF-- -<?php if (PHP_INT_SIZE != 4) echo "skip this test is for 32-bit only"; ?> ---FILE-- -<?php -/* Prototype : int idate(string format [, int timestamp]) - * Description: Format a local time/date as integer - * Source code: ext/date/php_date.c - * Alias to functions: - */ - -echo "*** Testing idate() : usage variation ***\n"; - -// Initialise function arguments not being substituted (if any) -$format = 'Y'; -date_default_timezone_set("Asia/Calcutta"); - -echo "\n-- Testing idate() function with float 12.3456789000e10 to timestamp --\n"; -$timestamp = 12.3456789000e10; -var_dump( idate($format, $timestamp) ); - -echo "\n-- Testing idate() function with float -12.3456789000e10 to timestamp --\n"; -$timestamp = -12.3456789000e10; -var_dump( idate($format, $timestamp) ); - -?> -===DONE=== ---EXPECTF-- -*** Testing idate() : usage variation *** - --- Testing idate() function with float 12.3456789000e10 to timestamp -- - -Warning: idate() expects parameter 2 to be int, float given in %s on line %d -bool(false) - --- Testing idate() function with float -12.3456789000e10 to timestamp -- - -Warning: idate() expects parameter 2 to be int, float given in %s on line %d -bool(false) -===DONE=== diff --git a/ext/date/tests/idate_variation4.phpt b/ext/date/tests/idate_variation4.phpt index 15be180790..8d928c9d56 100644 --- a/ext/date/tests/idate_variation4.phpt +++ b/ext/date/tests/idate_variation4.phpt @@ -16,15 +16,15 @@ date_default_timezone_set("Asia/Calcutta"); //array of values to iterate over $inputs = array( - 'Day of the month' => 'd', - 'Leap Year' =>'L', - 'Month number' => 'm', - 'Days in the month' => 't', - 'Day of the week' => 'w', - 'ISO-8601 week number' => 'W', - 'Year (1 or 2 digits)' => 'y', - 'Year 4 digits' => 'Y', - 'Day of the year' => 'z', + 'Day of the month' => 'd', + 'Leap Year' =>'L', + 'Month number' => 'm', + 'Days in the month' => 't', + 'Day of the week' => 'w', + 'ISO-8601 week number' => 'W', + 'Year (1 or 2 digits)' => 'y', + 'Year 4 digits' => 'Y', + 'Day of the year' => 'z', ); // loop through each element of the array for timestamp @@ -33,7 +33,6 @@ foreach($inputs as $key =>$value) { var_dump( idate($value) ); }; ?> -===DONE=== --EXPECTF-- *** Testing idate() : usage variation *** @@ -63,4 +62,3 @@ int(%d) --Day of the year-- int(%d) -===DONE=== diff --git a/ext/date/tests/idate_variation5.phpt b/ext/date/tests/idate_variation5.phpt index 6064a9e989..246e5f38a0 100644 --- a/ext/date/tests/idate_variation5.phpt +++ b/ext/date/tests/idate_variation5.phpt @@ -17,13 +17,13 @@ date_default_timezone_set("Asia/Calcutta"); $inputs = array( 'Internet Time' => 'B', - '12 hour format' => 'h', - '24 hour format' => 'H', - 'Minutes' => 'i', - 'DST Activated' => 'I', - 'Seconds' => 's', - 'Seconds since Unix Epoch' => 'U', - 'Time zone offset' => 'Z' + '12 hour format' => 'h', + '24 hour format' => 'H', + 'Minutes' => 'i', + 'DST Activated' => 'I', + 'Seconds' => 's', + 'Seconds since Unix Epoch' => 'U', + 'Time zone offset' => 'Z' ); // loop through each element of the array for timestamp @@ -32,7 +32,6 @@ foreach($inputs as $key =>$value) { var_dump( idate($value) ); }; ?> -===DONE=== --EXPECTF-- *** Testing idate() : usage variation *** @@ -59,4 +58,3 @@ int(%d) --Time zone offset-- int(%d) -===DONE=== diff --git a/ext/date/tests/idate_variation6.phpt b/ext/date/tests/idate_variation6.phpt index 28afc93c52..500befb4b7 100644 --- a/ext/date/tests/idate_variation6.phpt +++ b/ext/date/tests/idate_variation6.phpt @@ -22,7 +22,6 @@ echo "\n-- Testing idate() function for 2 digit year having zero as starting num $timestamp = mktime(8, 8, 8, 8, 8, 2001); var_dump( idate($format, $timestamp) ); ?> -===DONE=== --EXPECT-- *** Testing idate() : usage variation *** @@ -31,4 +30,3 @@ int(70) -- Testing idate() function for 2 digit year having zero as starting number -- int(1) -===DONE=== diff --git a/ext/date/tests/localtime_basic.phpt b/ext/date/tests/localtime_basic.phpt index e957e53fc7..709531e4e0 100644 --- a/ext/date/tests/localtime_basic.phpt +++ b/ext/date/tests/localtime_basic.phpt @@ -27,7 +27,6 @@ var_dump( localtime($timestamp) ); var_dump( localtime() ); ?> -===DONE=== --EXPECTF-- *** Testing localtime() : basic functionality *** array(9) { @@ -90,4 +89,3 @@ array(9) { [8]=> int(%d) } -===DONE=== diff --git a/ext/date/tests/localtime_variation3.phpt b/ext/date/tests/localtime_variation3.phpt deleted file mode 100644 index 42731dc6ce..0000000000 --- a/ext/date/tests/localtime_variation3.phpt +++ /dev/null @@ -1,50 +0,0 @@ ---TEST-- -Test localtime() function : usage variation - Passing higher positive and negetive float values to timestamp. ---SKIPIF-- -<?php if (PHP_INT_SIZE != 4) echo "skip this test is for 32-bit only"; ?> ---FILE-- -<?php -/* Prototype : array localtime([int timestamp [, bool associative_array]]) - * Description: Returns the results of the C system call localtime as an associative array - * if the associative_array argument is set to 1 other wise it is a regular array - * Source code: ext/date/php_date.c - * Alias to functions: - */ - -echo "*** Testing localtime() : usage variation ***\n"; - -date_default_timezone_set("UTC"); -// Initialise function arguments not being substituted (if any) -$is_associative = true; - -echo "\n-- Testing localtime() function with 'float 12.3456789000e10' to timestamp --\n"; -$timestamp = 12.3456789000e10; -var_dump( localtime($timestamp) ); -var_dump( localtime($timestamp, $is_associative) ); - -echo "\n-- Testing localtime() function with 'float -12.3456789000e10' to timestamp --\n"; -$timestamp = -12.3456789000e10; -var_dump( localtime($timestamp) ); -var_dump( localtime($timestamp, $is_associative) ); - -?> -===DONE=== ---EXPECTF-- -*** Testing localtime() : usage variation *** - --- Testing localtime() function with 'float 12.3456789000e10' to timestamp -- - -Warning: localtime() expects parameter 1 to be int, float given in %s on line %d -bool(false) - -Warning: localtime() expects parameter 1 to be int, float given in %s on line %d -bool(false) - --- Testing localtime() function with 'float -12.3456789000e10' to timestamp -- - -Warning: localtime() expects parameter 1 to be int, float given in %s on line %d -bool(false) - -Warning: localtime() expects parameter 1 to be int, float given in %s on line %d -bool(false) -===DONE=== diff --git a/ext/date/tests/localtime_variation4.phpt b/ext/date/tests/localtime_variation4.phpt index 99015a399e..0898547302 100644 --- a/ext/date/tests/localtime_variation4.phpt +++ b/ext/date/tests/localtime_variation4.phpt @@ -19,18 +19,17 @@ $is_associative = true; $inputs = array( 'Octal 0' => 00, - 'Octal 10' => 012, - 'Octal -10' => -012 + 'Octal 10' => 012, + 'Octal -10' => -012 ); foreach($inputs as $key =>$value) { echo "\n--$key--\n"; - var_dump( localtime($value) ); - var_dump( localtime($value, $is_associative) ); + var_dump( localtime($value) ); + var_dump( localtime($value, $is_associative) ); } ?> -===DONE=== --EXPECT-- *** Testing localtime() : usage variation *** @@ -159,4 +158,3 @@ array(9) { ["tm_isdst"]=> int(0) } -===DONE=== diff --git a/ext/date/tests/localtime_variation5.phpt b/ext/date/tests/localtime_variation5.phpt index 172d3d4942..b7d9e1ae63 100644 --- a/ext/date/tests/localtime_variation5.phpt +++ b/ext/date/tests/localtime_variation5.phpt @@ -19,18 +19,17 @@ $is_associative = true; $inputs = array( 'Hexa-decimal 0' => 0x0, - 'Hexa-decimal 10' => 0xA, - 'Hexa-decimal -10' => -0XA + 'Hexa-decimal 10' => 0xA, + 'Hexa-decimal -10' => -0XA ); foreach($inputs as $key =>$value) { echo "\n--$key--\n"; - var_dump( localtime($value) ); - var_dump( localtime($value, $is_associative) ); + var_dump( localtime($value) ); + var_dump( localtime($value, $is_associative) ); } ?> -===DONE=== --EXPECT-- *** Testing localtime() : usage variation *** @@ -159,4 +158,3 @@ array(9) { ["tm_isdst"]=> int(0) } -===DONE=== diff --git a/ext/date/tests/microtime_basic.phpt b/ext/date/tests/microtime_basic.phpt index a9045947cb..e70809b1fa 100644 --- a/ext/date/tests/microtime_basic.phpt +++ b/ext/date/tests/microtime_basic.phpt @@ -12,9 +12,7 @@ var_dump(microtime(true)); var_dump(microtime(false)); ?> -===DONE=== --EXPECTF-- string(%d) "%s %s" float(%s) string(%d) "%s %s" -===DONE=== diff --git a/ext/date/tests/microtime_error.phpt b/ext/date/tests/microtime_error.phpt index 699416d382..9ab11355e8 100644 --- a/ext/date/tests/microtime_error.phpt +++ b/ext/date/tests/microtime_error.phpt @@ -7,35 +7,26 @@ Test wrong number of arguments for microtime() * Function is implemented in ext/standard/microtime.c */ -$opt_arg_0 = true; -$extra_arg = 1; - -echo "\n-- Too many arguments --\n"; -var_dump(microtime($opt_arg_0, $extra_arg)); - - echo "\n-- Bad Arg types --\n"; $bad_args = array(null, - 1.5, - "hello", - array('k'=>'v', array(0)), - new stdClass, - 1); + 1.5, + "hello", + array('k'=>'v', array(0)), + new stdClass, + 1); foreach ($bad_args as $bad_arg) { - echo "\n--> bad arg: "; - var_dump($bad_arg); - var_dump(microtime($bad_arg)); + echo "\n--> bad arg: "; + var_dump($bad_arg); + try { + var_dump(microtime($bad_arg)); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + } } ?> -===DONE=== --EXPECTF-- --- Too many arguments -- - -Warning: microtime() expects at most 1 parameter, 2 given in %s on line 11 -NULL - -- Bad Arg types -- --> bad arg: NULL @@ -56,16 +47,11 @@ float(%s) int(0) } } - -Warning: microtime() expects parameter 1 to be bool, array given in %s on line 25 -NULL +microtime(): Argument #1 ($get_as_float) must be of type bool, array given --> bad arg: object(stdClass)#%d (0) { } - -Warning: microtime() expects parameter 1 to be bool, object given in %s on line 25 -NULL +microtime(): Argument #1 ($get_as_float) must be of type bool, object given --> bad arg: int(1) float(%s) -===DONE=== diff --git a/ext/date/tests/mktime-3-64bit.phpt b/ext/date/tests/mktime-3-64bit.phpt index f415cbf2d6..5d06f9393f 100644 --- a/ext/date/tests/mktime-3-64bit.phpt +++ b/ext/date/tests/mktime-3-64bit.phpt @@ -10,18 +10,18 @@ $tzs = array("America/Toronto", "Europe/Oslo"); $years = array(0, 69, 70, 71, 99, 100, 101, 105, 110, 1900, 1901, 1902, 1999, 2000, 2001); foreach ($tzs as $tz) { - echo $tz, "\n"; - date_default_timezone_set($tz); - foreach ($years as $year) { - printf("Y: %4d - ", $year); - $ret = mktime(1, 1, 1, 1, 1, $year); - if ($ret == FALSE) { - echo "out of range\n"; - } else { - echo date("F ".DATE_ISO8601, $ret), "\n"; - } - } - echo "\n"; + echo $tz, "\n"; + date_default_timezone_set($tz); + foreach ($years as $year) { + printf("Y: %4d - ", $year); + $ret = mktime(1, 1, 1, 1, 1, $year); + if ($ret == FALSE) { + echo "out of range\n"; + } else { + echo date("F ".DATE_ISO8601, $ret), "\n"; + } + } + echo "\n"; } ?> --EXPECTF-- diff --git a/ext/date/tests/mktime-3.phpt b/ext/date/tests/mktime-3.phpt index cc16083965..b054efd076 100644 --- a/ext/date/tests/mktime-3.phpt +++ b/ext/date/tests/mktime-3.phpt @@ -10,21 +10,20 @@ $tzs = array("America/Toronto", "Europe/Oslo"); $years = array(0, 69, 70, 71, 99, 100, 105, 1900, 1901, 1902, 1999, 2000, 2001); foreach ($tzs as $tz) { - echo $tz, "\n"; - date_default_timezone_set($tz); - foreach ($years as $year) { - printf("Y: %4d - ", $year); - $ret = mktime(1, 1, 1, 1, 1, $year); - if ($ret == FALSE) { - echo "out of range\n"; - } else { - echo date("F ".DATE_ISO8601, $ret), "\n"; - } - } - echo "\n"; + echo $tz, "\n"; + date_default_timezone_set($tz); + foreach ($years as $year) { + printf("Y: %4d - ", $year); + $ret = mktime(1, 1, 1, 1, 1, $year); + if ($ret == FALSE) { + echo "out of range\n"; + } else { + echo date("F ".DATE_ISO8601, $ret), "\n"; + } + } + echo "\n"; } ?> -===Done=== --EXPECT-- America/Toronto Y: 0 - January 2000-01-01T01:01:01-0500 @@ -56,4 +55,3 @@ Y: 1999 - January 1999-01-01T01:01:01+0100 Y: 2000 - January 2000-01-01T01:01:01+0100 Y: 2001 - January 2001-01-01T01:01:01+0100 -===Done=== diff --git a/ext/date/tests/mktime_basic1.phpt b/ext/date/tests/mktime_basic1.phpt index 955c05f55c..d0965f2f83 100644 --- a/ext/date/tests/mktime_basic1.phpt +++ b/ext/date/tests/mktime_basic1.phpt @@ -28,7 +28,6 @@ var_dump( mktime($hour, $minute, $sec, $month, $day) ); var_dump( mktime($hour, $minute, $sec, $month, $day, $year) ); ?> -===DONE=== --EXPECTF-- *** Testing DateTime::modify() : basic functionality *** int(%i) @@ -37,4 +36,3 @@ int(%i) int(%i) int(%i) int(%i) -===DONE=== diff --git a/ext/date/tests/mktime_error.phpt b/ext/date/tests/mktime_error.phpt index a24d189fb1..8bdb61df7b 100644 --- a/ext/date/tests/mktime_error.phpt +++ b/ext/date/tests/mktime_error.phpt @@ -14,7 +14,11 @@ date_default_timezone_set("Europe/London"); echo "*** Testing mktime() : error conditions ***\n"; echo "\n-- Testing mktime() function with Zero arguments --\n"; -var_dump( mktime() ); +try { + var_dump( mktime() ); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} echo "\n-- Testing mktime() function with more than expected no. of arguments --\n"; $hour = 10; @@ -24,20 +28,18 @@ $month = 7; $day = 2; $year = 1963; $extra_arg = 10; -var_dump( mktime($hour, $minute, $sec, $month, $day, $year, $extra_arg) ); +try { + var_dump( mktime($hour, $minute, $sec, $month, $day, $year, $extra_arg) ); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} ?> -===DONE=== ---EXPECTF-- +--EXPECT-- *** Testing mktime() : error conditions *** -- Testing mktime() function with Zero arguments -- - -Deprecated: mktime(): You should be using the time() function instead in %s on line %d -int(%d) +mktime() expects at least 1 parameter, 0 given -- Testing mktime() function with more than expected no. of arguments -- - -Warning: mktime() expects at most 6 parameters, 7 given in %s on line %d -bool(false) -===DONE=== +mktime() expects at most 6 parameters, 7 given diff --git a/ext/date/tests/oo_001.phpt b/ext/date/tests/oo_001.phpt index 7cbf847c52..1d8af7f933 100644 --- a/ext/date/tests/oo_001.phpt +++ b/ext/date/tests/oo_001.phpt @@ -4,49 +4,53 @@ date OO interface <?php date_default_timezone_set('UTC'); class _d extends DateTime { - function __construct() { - } + function __construct() { + } } class _t extends DateTimeZone { - function __construct() { - } + function __construct() { + } } $d = new DateTime; var_dump($d->format("Y-m-d H:i:s")); -$d = new _d; -var_dump($d->format("Y-m-d H:i:s")); +try { + $d = new _d; + var_dump($d->format("Y-m-d H:i:s")); +} catch (Error $e) { + echo $e->getMessage(),"\n"; +} try { - new DateTime("1am todax"); + new DateTime("1am todax"); } catch (Exception $e) { - echo $e->getMessage(),"\n"; + echo $e->getMessage(),"\n"; } $t = new DateTimeZone("UTC"); var_dump($t->getName()); -$t = new _t; -var_dump($t->getName()); +try { + $t = new _t; + var_dump($t->getName()); +} catch (Error $e) { + echo $e->getMessage(),"\n"; +} try { - new DateTimeZone("GottaFindThisOne"); + new DateTimeZone("GottaFindThisOne"); } catch (Exception $e) { - echo $e->getMessage(),"\n"; + echo $e->getMessage(),"\n"; } echo "DONE\n"; ?> --EXPECTF-- string(19) "%d-%d-%d %d:%d:%d" - -Warning: DateTime::format(): The DateTime object has not been correctly initialized by its constructor in %soo_001.php on line %d -bool(false) +The DateTime object has not been correctly initialized by its constructor DateTime::__construct(): Failed to parse time string (1am todax) at position 4 (t): The timezone could not be found in the database string(3) "UTC" - -Warning: DateTimeZone::getName(): The DateTimeZone object has not been correctly initialized by its constructor in %soo_001.php on line %d -bool(false) +The DateTimeZone object has not been correctly initialized by its constructor DateTimeZone::__construct(): Unknown or bad timezone (GottaFindThisOne) DONE diff --git a/ext/date/tests/rfc-datetime_and_daylight_saving_time-type1.phpt b/ext/date/tests/rfc-datetime_and_daylight_saving_time-type1.phpt index c297608913..4c92f4618d 100644 --- a/ext/date/tests/rfc-datetime_and_daylight_saving_time-type1.phpt +++ b/ext/date/tests/rfc-datetime_and_daylight_saving_time-type1.phpt @@ -16,37 +16,37 @@ $interval_format = 'P%dDT%hH'; $end = new DateTime('2010-03-14 03:00:00 -0400'); $start = new DateTime('2010-03-14 01:59:59 -0500'); echo 'fd1 ' . $end->format($date_format) . ' - ' . $start->format($date_format) - . ' = ' . $start->diff($end)->format('PT%hH%iM%sS') . "\n"; + . ' = ' . $start->diff($end)->format('PT%hH%iM%sS') . "\n"; $end = new DateTime('2010-03-14 04:30:00 -0400'); $start = new DateTime('2010-03-13 04:30:00 -0500'); echo 'fd2 ' . $end->format($date_format) . ' - ' . $start->format($date_format) - . ' = ' . $start->diff($end)->format($interval_format) . "\n"; + . ' = ' . $start->diff($end)->format($interval_format) . "\n"; $end = new DateTime('2010-03-14 03:30:00 -0400'); $start = new DateTime('2010-03-13 04:30:00 -0500'); echo 'fd3 ' . $end->format($date_format) . ' - ' . $start->format($date_format) - . ' = ' . $start->diff($end)->format($interval_format) . "\n"; + . ' = ' . $start->diff($end)->format($interval_format) . "\n"; $end = new DateTime('2010-03-14 01:30:00 -0500'); $start = new DateTime('2010-03-13 04:30:00 -0500'); echo 'fd4 ' . $end->format($date_format) . ' - ' . $start->format($date_format) - . ' = ' . $start->diff($end)->format($interval_format) . "\n"; + . ' = ' . $start->diff($end)->format($interval_format) . "\n"; $end = new DateTime('2010-03-14 01:30:00 -0500'); $start = new DateTime('2010-03-13 01:30:00 -0500'); echo 'fd5 ' . $end->format($date_format) . ' - ' . $start->format($date_format) - . ' = ' . $start->diff($end)->format($interval_format) . "\n"; + . ' = ' . $start->diff($end)->format($interval_format) . "\n"; $end = new DateTime('2010-03-14 03:30:00 -0400'); $start = new DateTime('2010-03-13 03:30:00 -0500'); echo 'fd6 ' . $end->format($date_format) . ' - ' . $start->format($date_format) - . ' = ' . $start->diff($end)->format($interval_format) . "\n"; + . ' = ' . $start->diff($end)->format($interval_format) . "\n"; $end = new DateTime('2010-03-14 03:30:00 -0400'); $start = new DateTime('2010-03-13 02:30:00 -0500'); echo 'fd7 ' . $end->format($date_format) . ' - ' . $start->format($date_format) - . ' = ' . $start->diff($end)->format($interval_format) . "\n"; + . ' = ' . $start->diff($end)->format($interval_format) . "\n"; echo "\n"; @@ -58,37 +58,37 @@ $start = new DateTime('2010-03-14 01:59:59 -0500'); $interval_spec = 'PT1S'; $interval = new DateInterval($interval_spec); echo 'fa1 ' . $start->format($date_format) . " + $interval_spec = " - . $start->add($interval)->format($date_format) . "\n"; + . $start->add($interval)->format($date_format) . "\n"; $start = new DateTime('2010-03-13 04:30:00 -0500'); $interval_spec = 'P1D'; $interval = new DateInterval($interval_spec); echo 'fa2 ' . $start->format($date_format) . " + $interval_spec = " - . $start->add($interval)->format($date_format) . "\n"; + . $start->add($interval)->format($date_format) . "\n"; $start = new DateTime('2010-03-13 04:30:00 -0500'); $interval_spec = 'PT22H'; $interval = new DateInterval($interval_spec); echo 'fa3 ' . $start->format($date_format) . " + $interval_spec = " - . $start->add($interval)->format($date_format) . "\n"; + . $start->add($interval)->format($date_format) . "\n"; $start = new DateTime('2010-03-13 04:30:00 -0500'); $interval_spec = 'PT21H'; $interval = new DateInterval($interval_spec); echo 'fa4 ' . $start->format($date_format) . " + $interval_spec = " - . $start->add($interval)->format($date_format) . "\n"; + . $start->add($interval)->format($date_format) . "\n"; $start = new DateTime('2010-03-13 01:30:00 -0500'); $interval_spec = 'P1D'; $interval = new DateInterval($interval_spec); echo 'fa5 ' . $start->format($date_format) . " + $interval_spec = " - . $start->add($interval)->format($date_format) . "\n"; + . $start->add($interval)->format($date_format) . "\n"; $start = new DateTime('2010-03-13 02:30:00 -0500'); $interval_spec = 'P1D'; $interval = new DateInterval($interval_spec); echo 'fa6 ' . $start->format($date_format) . " + $interval_spec = " - . $start->add($interval)->format($date_format) . "\n"; + . $start->add($interval)->format($date_format) . "\n"; echo "\n"; @@ -100,43 +100,43 @@ $end = new DateTime('2010-03-14 03:00:00 -0400'); $interval_spec = 'PT1S'; $interval = new DateInterval($interval_spec); echo 'fs1 ' . $end->format($date_format) . " - $interval_spec = " - . $end->sub($interval)->format($date_format) . "\n"; + . $end->sub($interval)->format($date_format) . "\n"; $end = new DateTime('2010-03-14 04:30:00 -0400'); $interval_spec = 'P1D'; $interval = new DateInterval($interval_spec); echo 'fs2 ' . $end->format($date_format) . " - $interval_spec = " - . $end->sub($interval)->format($date_format) . "\n"; + . $end->sub($interval)->format($date_format) . "\n"; $end = new DateTime('2010-03-14 03:30:00 -0400'); $interval_spec = 'PT22H'; $interval = new DateInterval($interval_spec); echo 'fs3 ' . $end->format($date_format) . " - $interval_spec = " - . $end->sub($interval)->format($date_format) . "\n"; + . $end->sub($interval)->format($date_format) . "\n"; $end = new DateTime('2010-03-14 01:30:00 -0500'); $interval_spec = 'PT21H'; $interval = new DateInterval($interval_spec); echo 'fs4 ' . $end->format($date_format) . " - $interval_spec = " - . $end->sub($interval)->format($date_format) . "\n"; + . $end->sub($interval)->format($date_format) . "\n"; $end = new DateTime('2010-03-14 01:30:00 -0500'); $interval_spec = 'P1D'; $interval = new DateInterval($interval_spec); echo 'fs5 ' . $end->format($date_format) . " - $interval_spec = " - . $end->sub($interval)->format($date_format) . "\n"; + . $end->sub($interval)->format($date_format) . "\n"; $end = new DateTime('2010-03-15 03:30:00 -0400'); $interval_spec = 'P1D'; $interval = new DateInterval($interval_spec); echo 'fs6 ' . $end->format($date_format) . " - $interval_spec = " - . $end->sub($interval)->format($date_format) . "\n"; + . $end->sub($interval)->format($date_format) . "\n"; $end = new DateTime('2010-03-15 02:30:00 -0400'); $interval_spec = 'P1D'; $interval = new DateInterval($interval_spec); echo 'fs7 ' . $end->format($date_format) . " - $interval_spec = " - . $end->sub($interval)->format($date_format) . "\n"; + . $end->sub($interval)->format($date_format) . "\n"; echo "\n"; @@ -147,42 +147,42 @@ echo "\n"; $end = new DateTime('2010-11-07 01:00:00 -0500'); $start = new DateTime('2010-11-07 01:59:59 -0400'); echo 'bd1 ' . $end->format($date_format) . ' - ' . $start->format($date_format) - . ' = ' . $start->diff($end)->format('PT%hH%iM%sS') . "\n"; + . ' = ' . $start->diff($end)->format('PT%hH%iM%sS') . "\n"; $end = new DateTime('2010-11-07 04:30:00 -0500'); $start = new DateTime('2010-11-06 04:30:00 -0400'); echo 'bd2 ' . $end->format($date_format) . ' - ' . $start->format($date_format) - . ' = ' . $start->diff($end)->format($interval_format) . "\n"; + . ' = ' . $start->diff($end)->format($interval_format) . "\n"; $end = new DateTime('2010-11-07 03:30:00 -0500'); $start = new DateTime('2010-11-06 04:30:00 -0400'); echo 'bd3 ' . $end->format($date_format) . ' - ' . $start->format($date_format) - . ' = ' . $start->diff($end)->format($interval_format) . "\n"; + . ' = ' . $start->diff($end)->format($interval_format) . "\n"; $end = new DateTime('2010-11-07 02:30:00 -0500'); $start = new DateTime('2010-11-06 04:30:00 -0400'); echo 'bd4 ' . $end->format($date_format) . ' - ' . $start->format($date_format) - . ' = ' . $start->diff($end)->format($interval_format) . "\n"; + . ' = ' . $start->diff($end)->format($interval_format) . "\n"; $end = new DateTime('2010-11-07 01:30:00 -0500'); $start = new DateTime('2010-11-06 04:30:00 -0400'); echo 'bd5 ' . $end->format($date_format) . ' - ' . $start->format($date_format) - . ' = ' . $start->diff($end)->format($interval_format) . "\n"; + . ' = ' . $start->diff($end)->format($interval_format) . "\n"; $end = new DateTime('2010-11-07 01:30:00 -0400'); $start = new DateTime('2010-11-06 04:30:00 -0400'); echo 'bd6 ' . $end->format($date_format) . ' - ' . $start->format($date_format) - . ' = ' . $start->diff($end)->format($interval_format) . "\n"; + . ' = ' . $start->diff($end)->format($interval_format) . "\n"; $end = new DateTime('2010-11-07 01:30:00 -0400'); $start = new DateTime('2010-11-06 01:30:00 -0400'); echo 'bd7 ' . $end->format($date_format) . ' - ' . $start->format($date_format) - . ' = ' . $start->diff($end)->format($interval_format) . "\n"; + . ' = ' . $start->diff($end)->format($interval_format) . "\n"; $end = new DateTime('2010-11-07 01:30:00 -0500'); $start = new DateTime('2010-11-06 01:30:00 -0400'); echo 'bd8 ' . $end->format($date_format) . ' - ' . $start->format($date_format) - . ' = ' . $start->diff($end)->format($interval_format) . "\n"; + . ' = ' . $start->diff($end)->format($interval_format) . "\n"; echo "\n"; @@ -194,67 +194,67 @@ $start = new DateTime('2010-11-07 01:59:59 -0400'); $interval_spec = 'PT1S'; $interval = new DateInterval($interval_spec); echo 'ba1 ' . $start->format($date_format) . " + $interval_spec = " - . $start->add($interval)->format($date_format) . "\n"; + . $start->add($interval)->format($date_format) . "\n"; $start = new DateTime('2010-11-06 04:30:00 -0400'); $interval_spec = 'P1D'; $interval = new DateInterval($interval_spec); echo 'ba2 ' . $start->format($date_format) . " + $interval_spec = " - . $start->add($interval)->format($date_format) . "\n"; + . $start->add($interval)->format($date_format) . "\n"; $start = new DateTime('2010-11-06 04:30:00 -0400'); $interval_spec = 'PT24H'; $interval = new DateInterval($interval_spec); echo 'ba3 ' . $start->format($date_format) . " + $interval_spec = " - . $start->add($interval)->format($date_format) . "\n"; + . $start->add($interval)->format($date_format) . "\n"; $start = new DateTime('2010-11-06 04:30:00 -0400'); $interval_spec = 'PT23H'; $interval = new DateInterval($interval_spec); echo 'ba4 ' . $start->format($date_format) . " + $interval_spec = " - . $start->add($interval)->format($date_format) . "\n"; + . $start->add($interval)->format($date_format) . "\n"; $start = new DateTime('2010-11-06 04:30:00 -0400'); $interval_spec = 'PT22H'; $interval = new DateInterval($interval_spec); echo 'ba5 ' . $start->format($date_format) . " + $interval_spec = " - . $start->add($interval)->format($date_format) . "\n"; + . $start->add($interval)->format($date_format) . "\n"; $start = new DateTime('2010-11-06 04:30:00 -0400'); $interval_spec = 'PT21H'; $interval = new DateInterval($interval_spec); echo 'ba6 ' . $start->format($date_format) . " + $interval_spec = " - . $start->add($interval)->format($date_format) . "\n"; + . $start->add($interval)->format($date_format) . "\n"; $start = new DateTime('2010-11-06 01:30:00 -0400'); $interval_spec = 'P1D'; $interval = new DateInterval($interval_spec); echo 'ba7 ' . $start->format($date_format) . " + $interval_spec = " - . $start->add($interval)->format($date_format) . "\n"; + . $start->add($interval)->format($date_format) . "\n"; $start = new DateTime('2010-11-06 01:30:00 -0400'); $interval_spec = 'P1DT1H'; $interval = new DateInterval($interval_spec); echo 'ba8 ' . $start->format($date_format) . " + $interval_spec = " - . $start->add($interval)->format($date_format) . "\n"; + . $start->add($interval)->format($date_format) . "\n"; $start = new DateTime('2010-11-06 04:30:00 -0400'); $interval_spec = 'PT25H'; $interval = new DateInterval($interval_spec); echo 'ba9 ' . $start->format($date_format) . " + $interval_spec = " - . $start->add($interval)->format($date_format) . "\n"; + . $start->add($interval)->format($date_format) . "\n"; $start = new DateTime('2010-11-06 03:30:00 -0400'); $interval_spec = 'P1D'; $interval = new DateInterval($interval_spec); echo 'ba10 ' . $start->format($date_format) . " + $interval_spec = " - . $start->add($interval)->format($date_format) . "\n"; + . $start->add($interval)->format($date_format) . "\n"; $start = new DateTime('2010-11-06 02:30:00 -0400'); $interval_spec = 'P1D'; $interval = new DateInterval($interval_spec); echo 'ba11 ' . $start->format($date_format) . " + $interval_spec = " - . $start->add($interval)->format($date_format) . "\n"; + . $start->add($interval)->format($date_format) . "\n"; echo "\n"; @@ -266,61 +266,61 @@ $end = new DateTime('2010-11-07 01:00:00 -0500'); $interval_spec = 'PT1S'; $interval = new DateInterval($interval_spec); echo 'bs1 ' . $end->format($date_format) . " - $interval_spec = " - . $end->sub($interval)->format($date_format) . "\n"; + . $end->sub($interval)->format($date_format) . "\n"; $end = new DateTime('2010-11-07 04:30:00 -0500'); $interval_spec = 'P1D'; $interval = new DateInterval($interval_spec); echo 'bs2 ' . $end->format($date_format) . " - $interval_spec = " - . $end->sub($interval)->format($date_format) . "\n"; + . $end->sub($interval)->format($date_format) . "\n"; $end = new DateTime('2010-11-07 03:30:00 -0500'); $interval_spec = 'PT24H'; $interval = new DateInterval($interval_spec); echo 'bs3 ' . $end->format($date_format) . " - $interval_spec = " - . $end->sub($interval)->format($date_format) . "\n"; + . $end->sub($interval)->format($date_format) . "\n"; $end = new DateTime('2010-11-07 02:30:00 -0500'); $interval_spec = 'PT23H'; $interval = new DateInterval($interval_spec); echo 'bs4 ' . $end->format($date_format) . " - $interval_spec = " - . $end->sub($interval)->format($date_format) . "\n"; + . $end->sub($interval)->format($date_format) . "\n"; $end = new DateTime('2010-11-07 01:30:00 -0500'); $interval_spec = 'PT22H'; $interval = new DateInterval($interval_spec); echo 'bs5 ' . $end->format($date_format) . " - $interval_spec = " - . $end->sub($interval)->format($date_format) . "\n"; + . $end->sub($interval)->format($date_format) . "\n"; $end = new DateTime('2010-11-07 01:30:00 -0400'); $interval_spec = 'PT21H'; $interval = new DateInterval($interval_spec); echo 'bs6 ' . $end->format($date_format) . " - $interval_spec = " - . $end->sub($interval)->format($date_format) . "\n"; + . $end->sub($interval)->format($date_format) . "\n"; $end = new DateTime('2010-11-07 01:30:00 -0400'); $interval_spec = 'P1D'; $interval = new DateInterval($interval_spec); echo 'bs7 ' . $end->format($date_format) . " - $interval_spec = " - . $end->sub($interval)->format($date_format) . "\n"; + . $end->sub($interval)->format($date_format) . "\n"; $end = new DateTime('2010-11-07 01:30:00 -0500'); $interval_spec = 'P1DT1H'; $interval = new DateInterval($interval_spec); echo 'bs8 ' . $end->format($date_format) . " - $interval_spec = " - . $end->sub($interval)->format($date_format) . "\n"; + . $end->sub($interval)->format($date_format) . "\n"; $end = new DateTime('2010-11-07 03:30:00 -0500'); $interval_spec = 'P1D'; $interval = new DateInterval($interval_spec); echo 'bs9 ' . $end->format($date_format) . " - $interval_spec = " - . $end->sub($interval)->format($date_format) . "\n"; + . $end->sub($interval)->format($date_format) . "\n"; $end = new DateTime('2010-11-07 02:30:00 -0500'); $interval_spec = 'P1D'; $interval = new DateInterval($interval_spec); echo 'bs10 ' . $end->format($date_format) . " - $interval_spec = " - . $end->sub($interval)->format($date_format) . "\n"; + . $end->sub($interval)->format($date_format) . "\n"; ?> --EXPECT-- diff --git a/ext/date/tests/rfc-datetime_and_daylight_saving_time-type2.phpt b/ext/date/tests/rfc-datetime_and_daylight_saving_time-type2.phpt index 72585125ea..d969f72a00 100644 --- a/ext/date/tests/rfc-datetime_and_daylight_saving_time-type2.phpt +++ b/ext/date/tests/rfc-datetime_and_daylight_saving_time-type2.phpt @@ -16,37 +16,37 @@ $interval_format = 'P%dDT%hH'; $end = new DateTime('2010-03-14 03:00:00 EDT'); $start = new DateTime('2010-03-14 01:59:59 EST'); echo 'fd1 ' . $end->format($date_format) . ' - ' . $start->format($date_format) - . ' = ' . $start->diff($end)->format('PT%hH%iM%sS') . "\n"; + . ' = ' . $start->diff($end)->format('PT%hH%iM%sS') . "\n"; $end = new DateTime('2010-03-14 04:30:00 EDT'); $start = new DateTime('2010-03-13 04:30:00 EST'); echo 'fd2 ' . $end->format($date_format) . ' - ' . $start->format($date_format) - . ' = ' . $start->diff($end)->format($interval_format) . "\n"; + . ' = ' . $start->diff($end)->format($interval_format) . "\n"; $end = new DateTime('2010-03-14 03:30:00 EDT'); $start = new DateTime('2010-03-13 04:30:00 EST'); echo 'fd3 ' . $end->format($date_format) . ' - ' . $start->format($date_format) - . ' = ' . $start->diff($end)->format($interval_format) . "\n"; + . ' = ' . $start->diff($end)->format($interval_format) . "\n"; $end = new DateTime('2010-03-14 01:30:00 EST'); $start = new DateTime('2010-03-13 04:30:00 EST'); echo 'fd4 ' . $end->format($date_format) . ' - ' . $start->format($date_format) - . ' = ' . $start->diff($end)->format($interval_format) . "\n"; + . ' = ' . $start->diff($end)->format($interval_format) . "\n"; $end = new DateTime('2010-03-14 01:30:00 EST'); $start = new DateTime('2010-03-13 01:30:00 EST'); echo 'fd5 ' . $end->format($date_format) . ' - ' . $start->format($date_format) - . ' = ' . $start->diff($end)->format($interval_format) . "\n"; + . ' = ' . $start->diff($end)->format($interval_format) . "\n"; $end = new DateTime('2010-03-14 03:30:00 EDT'); $start = new DateTime('2010-03-13 03:30:00 EST'); echo 'fd6 ' . $end->format($date_format) . ' - ' . $start->format($date_format) - . ' = ' . $start->diff($end)->format($interval_format) . "\n"; + . ' = ' . $start->diff($end)->format($interval_format) . "\n"; $end = new DateTime('2010-03-14 03:30:00 EDT'); $start = new DateTime('2010-03-13 02:30:00 EST'); echo 'fd7 ' . $end->format($date_format) . ' - ' . $start->format($date_format) - . ' = ' . $start->diff($end)->format($interval_format) . "\n"; + . ' = ' . $start->diff($end)->format($interval_format) . "\n"; echo "\n"; @@ -58,37 +58,37 @@ $start = new DateTime('2010-03-14 01:59:59 EST'); $interval_spec = 'PT1S'; $interval = new DateInterval($interval_spec); echo 'fa1 ' . $start->format($date_format) . " + $interval_spec = " - . $start->add($interval)->format($date_format) . "\n"; + . $start->add($interval)->format($date_format) . "\n"; $start = new DateTime('2010-03-13 04:30:00 EST'); $interval_spec = 'P1D'; $interval = new DateInterval($interval_spec); echo 'fa2 ' . $start->format($date_format) . " + $interval_spec = " - . $start->add($interval)->format($date_format) . "\n"; + . $start->add($interval)->format($date_format) . "\n"; $start = new DateTime('2010-03-13 04:30:00 EST'); $interval_spec = 'PT22H'; $interval = new DateInterval($interval_spec); echo 'fa3 ' . $start->format($date_format) . " + $interval_spec = " - . $start->add($interval)->format($date_format) . "\n"; + . $start->add($interval)->format($date_format) . "\n"; $start = new DateTime('2010-03-13 04:30:00 EST'); $interval_spec = 'PT21H'; $interval = new DateInterval($interval_spec); echo 'fa4 ' . $start->format($date_format) . " + $interval_spec = " - . $start->add($interval)->format($date_format) . "\n"; + . $start->add($interval)->format($date_format) . "\n"; $start = new DateTime('2010-03-13 01:30:00 EST'); $interval_spec = 'P1D'; $interval = new DateInterval($interval_spec); echo 'fa5 ' . $start->format($date_format) . " + $interval_spec = " - . $start->add($interval)->format($date_format) . "\n"; + . $start->add($interval)->format($date_format) . "\n"; $start = new DateTime('2010-03-13 02:30:00 EST'); $interval_spec = 'P1D'; $interval = new DateInterval($interval_spec); echo 'fa6 ' . $start->format($date_format) . " + $interval_spec = " - . $start->add($interval)->format($date_format) . "\n"; + . $start->add($interval)->format($date_format) . "\n"; echo "\n"; @@ -100,43 +100,43 @@ $end = new DateTime('2010-03-14 03:00:00 EDT'); $interval_spec = 'PT1S'; $interval = new DateInterval($interval_spec); echo 'fs1 ' . $end->format($date_format) . " - $interval_spec = " - . $end->sub($interval)->format($date_format) . "\n"; + . $end->sub($interval)->format($date_format) . "\n"; $end = new DateTime('2010-03-14 04:30:00 EDT'); $interval_spec = 'P1D'; $interval = new DateInterval($interval_spec); echo 'fs2 ' . $end->format($date_format) . " - $interval_spec = " - . $end->sub($interval)->format($date_format) . "\n"; + . $end->sub($interval)->format($date_format) . "\n"; $end = new DateTime('2010-03-14 03:30:00 EDT'); $interval_spec = 'PT22H'; $interval = new DateInterval($interval_spec); echo 'fs3 ' . $end->format($date_format) . " - $interval_spec = " - . $end->sub($interval)->format($date_format) . "\n"; + . $end->sub($interval)->format($date_format) . "\n"; $end = new DateTime('2010-03-14 01:30:00 EST'); $interval_spec = 'PT21H'; $interval = new DateInterval($interval_spec); echo 'fs4 ' . $end->format($date_format) . " - $interval_spec = " - . $end->sub($interval)->format($date_format) . "\n"; + . $end->sub($interval)->format($date_format) . "\n"; $end = new DateTime('2010-03-14 01:30:00 EST'); $interval_spec = 'P1D'; $interval = new DateInterval($interval_spec); echo 'fs5 ' . $end->format($date_format) . " - $interval_spec = " - . $end->sub($interval)->format($date_format) . "\n"; + . $end->sub($interval)->format($date_format) . "\n"; $end = new DateTime('2010-03-15 03:30:00 EDT'); $interval_spec = 'P1D'; $interval = new DateInterval($interval_spec); echo 'fs6 ' . $end->format($date_format) . " - $interval_spec = " - . $end->sub($interval)->format($date_format) . "\n"; + . $end->sub($interval)->format($date_format) . "\n"; $end = new DateTime('2010-03-15 02:30:00 EDT'); $interval_spec = 'P1D'; $interval = new DateInterval($interval_spec); echo 'fs7 ' . $end->format($date_format) . " - $interval_spec = " - . $end->sub($interval)->format($date_format) . "\n"; + . $end->sub($interval)->format($date_format) . "\n"; echo "\n"; @@ -147,42 +147,42 @@ echo "\n"; $end = new DateTime('2010-11-07 01:00:00 EST'); $start = new DateTime('2010-11-07 01:59:59 EDT'); echo 'bd1 ' . $end->format($date_format) . ' - ' . $start->format($date_format) - . ' = ' . $start->diff($end)->format('PT%hH%iM%sS') . "\n"; + . ' = ' . $start->diff($end)->format('PT%hH%iM%sS') . "\n"; $end = new DateTime('2010-11-07 04:30:00 EST'); $start = new DateTime('2010-11-06 04:30:00 EDT'); echo 'bd2 ' . $end->format($date_format) . ' - ' . $start->format($date_format) - . ' = ' . $start->diff($end)->format($interval_format) . "\n"; + . ' = ' . $start->diff($end)->format($interval_format) . "\n"; $end = new DateTime('2010-11-07 03:30:00 EST'); $start = new DateTime('2010-11-06 04:30:00 EDT'); echo 'bd3 ' . $end->format($date_format) . ' - ' . $start->format($date_format) - . ' = ' . $start->diff($end)->format($interval_format) . "\n"; + . ' = ' . $start->diff($end)->format($interval_format) . "\n"; $end = new DateTime('2010-11-07 02:30:00 EST'); $start = new DateTime('2010-11-06 04:30:00 EDT'); echo 'bd4 ' . $end->format($date_format) . ' - ' . $start->format($date_format) - . ' = ' . $start->diff($end)->format($interval_format) . "\n"; + . ' = ' . $start->diff($end)->format($interval_format) . "\n"; $end = new DateTime('2010-11-07 01:30:00 EST'); $start = new DateTime('2010-11-06 04:30:00 EDT'); echo 'bd5 ' . $end->format($date_format) . ' - ' . $start->format($date_format) - . ' = ' . $start->diff($end)->format($interval_format) . "\n"; + . ' = ' . $start->diff($end)->format($interval_format) . "\n"; $end = new DateTime('2010-11-07 01:30:00 EDT'); $start = new DateTime('2010-11-06 04:30:00 EDT'); echo 'bd6 ' . $end->format($date_format) . ' - ' . $start->format($date_format) - . ' = ' . $start->diff($end)->format($interval_format) . "\n"; + . ' = ' . $start->diff($end)->format($interval_format) . "\n"; $end = new DateTime('2010-11-07 01:30:00 EDT'); $start = new DateTime('2010-11-06 01:30:00 EDT'); echo 'bd7 ' . $end->format($date_format) . ' - ' . $start->format($date_format) - . ' = ' . $start->diff($end)->format($interval_format) . "\n"; + . ' = ' . $start->diff($end)->format($interval_format) . "\n"; $end = new DateTime('2010-11-07 01:30:00 EST'); $start = new DateTime('2010-11-06 01:30:00 EDT'); echo 'bd8 ' . $end->format($date_format) . ' - ' . $start->format($date_format) - . ' = ' . $start->diff($end)->format($interval_format) . "\n"; + . ' = ' . $start->diff($end)->format($interval_format) . "\n"; echo "\n"; @@ -194,67 +194,67 @@ $start = new DateTime('2010-11-07 01:59:59 EDT'); $interval_spec = 'PT1S'; $interval = new DateInterval($interval_spec); echo 'ba1 ' . $start->format($date_format) . " + $interval_spec = " - . $start->add($interval)->format($date_format) . "\n"; + . $start->add($interval)->format($date_format) . "\n"; $start = new DateTime('2010-11-06 04:30:00 EDT'); $interval_spec = 'P1D'; $interval = new DateInterval($interval_spec); echo 'ba2 ' . $start->format($date_format) . " + $interval_spec = " - . $start->add($interval)->format($date_format) . "\n"; + . $start->add($interval)->format($date_format) . "\n"; $start = new DateTime('2010-11-06 04:30:00 EDT'); $interval_spec = 'PT24H'; $interval = new DateInterval($interval_spec); echo 'ba3 ' . $start->format($date_format) . " + $interval_spec = " - . $start->add($interval)->format($date_format) . "\n"; + . $start->add($interval)->format($date_format) . "\n"; $start = new DateTime('2010-11-06 04:30:00 EDT'); $interval_spec = 'PT23H'; $interval = new DateInterval($interval_spec); echo 'ba4 ' . $start->format($date_format) . " + $interval_spec = " - . $start->add($interval)->format($date_format) . "\n"; + . $start->add($interval)->format($date_format) . "\n"; $start = new DateTime('2010-11-06 04:30:00 EDT'); $interval_spec = 'PT22H'; $interval = new DateInterval($interval_spec); echo 'ba5 ' . $start->format($date_format) . " + $interval_spec = " - . $start->add($interval)->format($date_format) . "\n"; + . $start->add($interval)->format($date_format) . "\n"; $start = new DateTime('2010-11-06 04:30:00 EDT'); $interval_spec = 'PT21H'; $interval = new DateInterval($interval_spec); echo 'ba6 ' . $start->format($date_format) . " + $interval_spec = " - . $start->add($interval)->format($date_format) . "\n"; + . $start->add($interval)->format($date_format) . "\n"; $start = new DateTime('2010-11-06 01:30:00 EDT'); $interval_spec = 'P1D'; $interval = new DateInterval($interval_spec); echo 'ba7 ' . $start->format($date_format) . " + $interval_spec = " - . $start->add($interval)->format($date_format) . "\n"; + . $start->add($interval)->format($date_format) . "\n"; $start = new DateTime('2010-11-06 01:30:00 EDT'); $interval_spec = 'P1DT1H'; $interval = new DateInterval($interval_spec); echo 'ba8 ' . $start->format($date_format) . " + $interval_spec = " - . $start->add($interval)->format($date_format) . "\n"; + . $start->add($interval)->format($date_format) . "\n"; $start = new DateTime('2010-11-06 04:30:00 EDT'); $interval_spec = 'PT25H'; $interval = new DateInterval($interval_spec); echo 'ba9 ' . $start->format($date_format) . " + $interval_spec = " - . $start->add($interval)->format($date_format) . "\n"; + . $start->add($interval)->format($date_format) . "\n"; $start = new DateTime('2010-11-06 03:30:00 EDT'); $interval_spec = 'P1D'; $interval = new DateInterval($interval_spec); echo 'ba10 ' . $start->format($date_format) . " + $interval_spec = " - . $start->add($interval)->format($date_format) . "\n"; + . $start->add($interval)->format($date_format) . "\n"; $start = new DateTime('2010-11-06 02:30:00 EDT'); $interval_spec = 'P1D'; $interval = new DateInterval($interval_spec); echo 'ba11 ' . $start->format($date_format) . " + $interval_spec = " - . $start->add($interval)->format($date_format) . "\n"; + . $start->add($interval)->format($date_format) . "\n"; echo "\n"; @@ -266,61 +266,61 @@ $end = new DateTime('2010-11-07 01:00:00 EST'); $interval_spec = 'PT1S'; $interval = new DateInterval($interval_spec); echo 'bs1 ' . $end->format($date_format) . " - $interval_spec = " - . $end->sub($interval)->format($date_format) . "\n"; + . $end->sub($interval)->format($date_format) . "\n"; $end = new DateTime('2010-11-07 04:30:00 EST'); $interval_spec = 'P1D'; $interval = new DateInterval($interval_spec); echo 'bs2 ' . $end->format($date_format) . " - $interval_spec = " - . $end->sub($interval)->format($date_format) . "\n"; + . $end->sub($interval)->format($date_format) . "\n"; $end = new DateTime('2010-11-07 03:30:00 EST'); $interval_spec = 'PT24H'; $interval = new DateInterval($interval_spec); echo 'bs3 ' . $end->format($date_format) . " - $interval_spec = " - . $end->sub($interval)->format($date_format) . "\n"; + . $end->sub($interval)->format($date_format) . "\n"; $end = new DateTime('2010-11-07 02:30:00 EST'); $interval_spec = 'PT23H'; $interval = new DateInterval($interval_spec); echo 'bs4 ' . $end->format($date_format) . " - $interval_spec = " - . $end->sub($interval)->format($date_format) . "\n"; + . $end->sub($interval)->format($date_format) . "\n"; $end = new DateTime('2010-11-07 01:30:00 EST'); $interval_spec = 'PT22H'; $interval = new DateInterval($interval_spec); echo 'bs5 ' . $end->format($date_format) . " - $interval_spec = " - . $end->sub($interval)->format($date_format) . "\n"; + . $end->sub($interval)->format($date_format) . "\n"; $end = new DateTime('2010-11-07 01:30:00 EDT'); $interval_spec = 'PT21H'; $interval = new DateInterval($interval_spec); echo 'bs6 ' . $end->format($date_format) . " - $interval_spec = " - . $end->sub($interval)->format($date_format) . "\n"; + . $end->sub($interval)->format($date_format) . "\n"; $end = new DateTime('2010-11-07 01:30:00 EDT'); $interval_spec = 'P1D'; $interval = new DateInterval($interval_spec); echo 'bs7 ' . $end->format($date_format) . " - $interval_spec = " - . $end->sub($interval)->format($date_format) . "\n"; + . $end->sub($interval)->format($date_format) . "\n"; $end = new DateTime('2010-11-07 01:30:00 EST'); $interval_spec = 'P1DT1H'; $interval = new DateInterval($interval_spec); echo 'bs8 ' . $end->format($date_format) . " - $interval_spec = " - . $end->sub($interval)->format($date_format) . "\n"; + . $end->sub($interval)->format($date_format) . "\n"; $end = new DateTime('2010-11-07 03:30:00 EST'); $interval_spec = 'P1D'; $interval = new DateInterval($interval_spec); echo 'bs9 ' . $end->format($date_format) . " - $interval_spec = " - . $end->sub($interval)->format($date_format) . "\n"; + . $end->sub($interval)->format($date_format) . "\n"; $end = new DateTime('2010-11-07 02:30:00 EST'); $interval_spec = 'P1D'; $interval = new DateInterval($interval_spec); echo 'bs10 ' . $end->format($date_format) . " - $interval_spec = " - . $end->sub($interval)->format($date_format) . "\n"; + . $end->sub($interval)->format($date_format) . "\n"; ?> --EXPECT-- diff --git a/ext/date/tests/rfc-datetime_and_daylight_saving_time-type3-ba.phpt b/ext/date/tests/rfc-datetime_and_daylight_saving_time-type3-ba.phpt index fdbe96d7d0..0326b43824 100644 --- a/ext/date/tests/rfc-datetime_and_daylight_saving_time-type3-ba.phpt +++ b/ext/date/tests/rfc-datetime_and_daylight_saving_time-type3-ba.phpt @@ -17,67 +17,67 @@ $start = new DateTime('2010-11-07 01:59:59'); $interval_spec = 'PT1S'; $interval = new DateInterval($interval_spec); echo 'ba1 ' . $start->format($date_format) . " + $interval_spec = " - . $start->add($interval)->format($date_format) . "\n"; + . $start->add($interval)->format($date_format) . "\n"; $start = new DateTime('2010-11-06 04:30:00'); $interval_spec = 'P1D'; $interval = new DateInterval($interval_spec); echo 'ba2 ' . $start->format($date_format) . " + $interval_spec = " - . $start->add($interval)->format($date_format) . "\n"; + . $start->add($interval)->format($date_format) . "\n"; $start = new DateTime('2010-11-06 04:30:00'); $interval_spec = 'PT24H'; $interval = new DateInterval($interval_spec); echo 'ba3 ' . $start->format($date_format) . " + $interval_spec = " - . $start->add($interval)->format($date_format) . "\n"; + . $start->add($interval)->format($date_format) . "\n"; $start = new DateTime('2010-11-06 04:30:00'); $interval_spec = 'PT23H'; $interval = new DateInterval($interval_spec); echo 'ba4 ' . $start->format($date_format) . " + $interval_spec = " - . $start->add($interval)->format($date_format) . "\n"; + . $start->add($interval)->format($date_format) . "\n"; $start = new DateTime('2010-11-06 04:30:00'); $interval_spec = 'PT22H'; $interval = new DateInterval($interval_spec); echo 'ba5 ' . $start->format($date_format) . " + $interval_spec = " - . $start->add($interval)->format($date_format) . "\n"; + . $start->add($interval)->format($date_format) . "\n"; $start = new DateTime('2010-11-06 04:30:00'); $interval_spec = 'PT21H'; $interval = new DateInterval($interval_spec); echo 'ba6 ' . $start->format($date_format) . " + $interval_spec = " - . $start->add($interval)->format($date_format) . "\n"; + . $start->add($interval)->format($date_format) . "\n"; $start = new DateTime('2010-11-06 01:30:00'); $interval_spec = 'P1D'; $interval = new DateInterval($interval_spec); echo 'ba7 ' . $start->format($date_format) . " + $interval_spec = " - . $start->add($interval)->format($date_format) . "\n"; + . $start->add($interval)->format($date_format) . "\n"; $start = new DateTime('2010-11-06 01:30:00'); $interval_spec = 'P1DT1H'; $interval = new DateInterval($interval_spec); echo 'ba8 ' . $start->format($date_format) . " + $interval_spec = " - . $start->add($interval)->format($date_format) . "\n"; + . $start->add($interval)->format($date_format) . "\n"; $start = new DateTime('2010-11-06 04:30:00'); $interval_spec = 'PT25H'; $interval = new DateInterval($interval_spec); echo 'ba9 ' . $start->format($date_format) . " + $interval_spec = " - . $start->add($interval)->format($date_format) . "\n"; + . $start->add($interval)->format($date_format) . "\n"; $start = new DateTime('2010-11-06 03:30:00'); $interval_spec = 'P1D'; $interval = new DateInterval($interval_spec); echo 'ba10 ' . $start->format($date_format) . " + $interval_spec = " - . $start->add($interval)->format($date_format) . "\n"; + . $start->add($interval)->format($date_format) . "\n"; $start = new DateTime('2010-11-06 02:30:00'); $interval_spec = 'P1D'; $interval = new DateInterval($interval_spec); echo 'ba11 ' . $start->format($date_format) . " + $interval_spec = " - . $start->add($interval)->format($date_format) . "\n"; + . $start->add($interval)->format($date_format) . "\n"; echo "\n"; diff --git a/ext/date/tests/rfc-datetime_and_daylight_saving_time-type3-bd1.phpt b/ext/date/tests/rfc-datetime_and_daylight_saving_time-type3-bd1.phpt index 8249599931..8222e75f15 100644 --- a/ext/date/tests/rfc-datetime_and_daylight_saving_time-type3-bd1.phpt +++ b/ext/date/tests/rfc-datetime_and_daylight_saving_time-type3-bd1.phpt @@ -16,27 +16,27 @@ $interval_format = 'P%dDT%hH'; $end = new DateTime('2010-11-07 05:30:00'); $start = new DateTime('2010-11-06 04:30:00'); echo 'bd1 ' . $end->format($date_format) . ' - ' . $start->format($date_format) - . ' = ' . $start->diff($end)->format($interval_format) . "\n"; + . ' = ' . $start->diff($end)->format($interval_format) . "\n"; $end = new DateTime('2010-11-07 04:30:00'); $start = new DateTime('2010-11-06 04:30:00'); echo 'bd2 ' . $end->format($date_format) . ' - ' . $start->format($date_format) - . ' = ' . $start->diff($end)->format($interval_format) . "\n"; + . ' = ' . $start->diff($end)->format($interval_format) . "\n"; $end = new DateTime('2010-11-07 03:30:00'); $start = new DateTime('2010-11-06 04:30:00'); echo 'bd3 ' . $end->format($date_format) . ' - ' . $start->format($date_format) - . ' = ' . $start->diff($end)->format($interval_format) . "\n"; + . ' = ' . $start->diff($end)->format($interval_format) . "\n"; $end = new DateTime('2010-11-07 02:30:00'); $start = new DateTime('2010-11-06 04:30:00'); echo 'bd4 ' . $end->format($date_format) . ' - ' . $start->format($date_format) - . ' = ' . $start->diff($end)->format($interval_format) . "\n"; + . ' = ' . $start->diff($end)->format($interval_format) . "\n"; $end = new DateTime('2010-11-07 01:30:00'); $start = new DateTime('2010-11-06 01:30:00'); echo 'bd7 ' . $end->format($date_format) . ' - ' . $start->format($date_format) - . ' = ' . $start->diff($end)->format($interval_format) . "\n"; + . ' = ' . $start->diff($end)->format($interval_format) . "\n"; echo "\n"; ?> diff --git a/ext/date/tests/rfc-datetime_and_daylight_saving_time-type3-bd2.phpt b/ext/date/tests/rfc-datetime_and_daylight_saving_time-type3-bd2.phpt index fe2e79b3b9..80e3321ed6 100644 --- a/ext/date/tests/rfc-datetime_and_daylight_saving_time-type3-bd2.phpt +++ b/ext/date/tests/rfc-datetime_and_daylight_saving_time-type3-bd2.phpt @@ -27,25 +27,25 @@ $end = new DateTime('2010-11-07 05:30:00'); $end->setTimeZone($tz); $start = new DateTime('2010-11-06 04:30:59'); echo 'bd0 ' . $end->format($date_format) . ' - ' . $start->format($date_format) - . ' = ' . $start->diff($end)->format('P%dDT%hH%iM%sS') . "\n"; + . ' = ' . $start->diff($end)->format('P%dDT%hH%iM%sS') . "\n"; $end = new DateTime('2010-11-07 01:30:00 EST'); $end->setTimeZone($tz); $start = new DateTime('2010-11-06 04:30:00'); echo 'bd5 ' . $end->format($date_format) . ' - ' . $start->format($date_format) - . ' = ' . $start->diff($end)->format($interval_format) . "\n"; + . ' = ' . $start->diff($end)->format($interval_format) . "\n"; $end = new DateTime('2010-11-07 01:30:00 EDT'); $end->setTimeZone($tz); $start = new DateTime('2010-11-06 04:30:00'); echo 'bd6 ' . $end->format($date_format) . ' - ' . $start->format($date_format) - . ' = ' . $start->diff($end)->format($interval_format) . "\n"; + . ' = ' . $start->diff($end)->format($interval_format) . "\n"; $end = new DateTime('2010-11-07 01:30:00 EST'); $end->setTimeZone($tz); $start = new DateTime('2010-11-06 01:30:00'); echo 'bd8 ' . $end->format($date_format) . ' - ' . $start->format($date_format) - . ' = ' . $start->diff($end)->format($interval_format) . "\n"; + . ' = ' . $start->diff($end)->format($interval_format) . "\n"; echo "\n"; ?> diff --git a/ext/date/tests/rfc-datetime_and_daylight_saving_time-type3-bs.phpt b/ext/date/tests/rfc-datetime_and_daylight_saving_time-type3-bs.phpt index 138c68f3a9..d195cb2f75 100644 --- a/ext/date/tests/rfc-datetime_and_daylight_saving_time-type3-bs.phpt +++ b/ext/date/tests/rfc-datetime_and_daylight_saving_time-type3-bs.phpt @@ -19,64 +19,64 @@ $end->setTimeZone($tz); $interval_spec = 'PT1S'; $interval = new DateInterval($interval_spec); echo 'bs1 ' . $end->format($date_format) . " - $interval_spec = " - . $end->sub($interval)->format($date_format) . "\n"; + . $end->sub($interval)->format($date_format) . "\n"; $end = new DateTime('2010-11-07 04:30:00'); $interval_spec = 'P1D'; $interval = new DateInterval($interval_spec); echo 'bs2 ' . $end->format($date_format) . " - $interval_spec = " - . $end->sub($interval)->format($date_format) . "\n"; + . $end->sub($interval)->format($date_format) . "\n"; $end = new DateTime('2010-11-07 03:30:00'); $interval_spec = 'PT24H'; $interval = new DateInterval($interval_spec); echo 'bs3 ' . $end->format($date_format) . " - $interval_spec = " - . $end->sub($interval)->format($date_format) . "\n"; + . $end->sub($interval)->format($date_format) . "\n"; $end = new DateTime('2010-11-07 02:30:00'); $interval_spec = 'PT23H'; $interval = new DateInterval($interval_spec); echo 'bs4 ' . $end->format($date_format) . " - $interval_spec = " - . $end->sub($interval)->format($date_format) . "\n"; + . $end->sub($interval)->format($date_format) . "\n"; $end = new DateTime('2010-11-07 01:30:00 EST'); $end->setTimeZone($tz); $interval_spec = 'PT22H'; $interval = new DateInterval($interval_spec); echo 'bs5 ' . $end->format($date_format) . " - $interval_spec = " - . $end->sub($interval)->format($date_format) . "\n"; + . $end->sub($interval)->format($date_format) . "\n"; $end = new DateTime('2010-11-07 01:30:00 EDT'); $end->setTimeZone($tz); $interval_spec = 'PT21H'; $interval = new DateInterval($interval_spec); echo 'bs6 ' . $end->format($date_format) . " - $interval_spec = " - . $end->sub($interval)->format($date_format) . "\n"; + . $end->sub($interval)->format($date_format) . "\n"; $end = new DateTime('2010-11-07 01:30:00'); $interval_spec = 'P1D'; $interval = new DateInterval($interval_spec); echo 'bs7 ' . $end->format($date_format) . " - $interval_spec = " - . $end->sub($interval)->format($date_format) . "\n"; + . $end->sub($interval)->format($date_format) . "\n"; $end = new DateTime('2010-11-07 01:30:00 EST'); $end->setTimeZone($tz); $interval_spec = 'P1DT1H'; $interval = new DateInterval($interval_spec); echo 'bs8 ' . $end->format($date_format) . " - $interval_spec = " - . $end->sub($interval)->format($date_format) . "\n"; + . $end->sub($interval)->format($date_format) . "\n"; $end = new DateTime('2010-11-07 03:30:00'); $interval_spec = 'P1D'; $interval = new DateInterval($interval_spec); echo 'bs9 ' . $end->format($date_format) . " - $interval_spec = " - . $end->sub($interval)->format($date_format) . "\n"; + . $end->sub($interval)->format($date_format) . "\n"; $end = new DateTime('2010-11-07 02:30:00'); $interval_spec = 'P1D'; $interval = new DateInterval($interval_spec); echo 'bs10 ' . $end->format($date_format) . " - $interval_spec = " - . $end->sub($interval)->format($date_format) . "\n"; + . $end->sub($interval)->format($date_format) . "\n"; ?> --EXPECT-- diff --git a/ext/date/tests/rfc-datetime_and_daylight_saving_time-type3-fa.phpt b/ext/date/tests/rfc-datetime_and_daylight_saving_time-type3-fa.phpt index 9fa493f578..df67b5a89d 100644 --- a/ext/date/tests/rfc-datetime_and_daylight_saving_time-type3-fa.phpt +++ b/ext/date/tests/rfc-datetime_and_daylight_saving_time-type3-fa.phpt @@ -17,37 +17,37 @@ $start = new DateTime('2010-03-14 01:59:59'); $interval_spec = 'PT1S'; $interval = new DateInterval($interval_spec); echo 'fa1 ' . $start->format($date_format) . " + $interval_spec = " - . $start->add($interval)->format($date_format) . "\n"; + . $start->add($interval)->format($date_format) . "\n"; $start = new DateTime('2010-03-13 04:30:00'); $interval_spec = 'P1D'; $interval = new DateInterval($interval_spec); echo 'fa2 ' . $start->format($date_format) . " + $interval_spec = " - . $start->add($interval)->format($date_format) . "\n"; + . $start->add($interval)->format($date_format) . "\n"; $start = new DateTime('2010-03-13 04:30:00'); $interval_spec = 'PT22H'; $interval = new DateInterval($interval_spec); echo 'fa3 ' . $start->format($date_format) . " + $interval_spec = " - . $start->add($interval)->format($date_format) . "\n"; + . $start->add($interval)->format($date_format) . "\n"; $start = new DateTime('2010-03-13 04:30:00'); $interval_spec = 'PT21H'; $interval = new DateInterval($interval_spec); echo 'fa4 ' . $start->format($date_format) . " + $interval_spec = " - . $start->add($interval)->format($date_format) . "\n"; + . $start->add($interval)->format($date_format) . "\n"; $start = new DateTime('2010-03-13 01:30:00'); $interval_spec = 'P1D'; $interval = new DateInterval($interval_spec); echo 'fa5 ' . $start->format($date_format) . " + $interval_spec = " - . $start->add($interval)->format($date_format) . "\n"; + . $start->add($interval)->format($date_format) . "\n"; $start = new DateTime('2010-03-13 02:30:00'); $interval_spec = 'P1D'; $interval = new DateInterval($interval_spec); echo 'fa6 ' . $start->format($date_format) . " + $interval_spec = " - . $start->add($interval)->format($date_format) . "\n"; + . $start->add($interval)->format($date_format) . "\n"; ?> --EXPECT-- fa1 2010-03-14 01:59:59 EST America/New_York + PT1S = 2010-03-14 03:00:00 EDT America/New_York diff --git a/ext/date/tests/rfc-datetime_and_daylight_saving_time-type3-fd.phpt b/ext/date/tests/rfc-datetime_and_daylight_saving_time-type3-fd.phpt index ae7060be0b..1a60f7b57b 100644 --- a/ext/date/tests/rfc-datetime_and_daylight_saving_time-type3-fd.phpt +++ b/ext/date/tests/rfc-datetime_and_daylight_saving_time-type3-fd.phpt @@ -16,37 +16,37 @@ $interval_format = 'P%dDT%hH'; $end = new DateTime('2010-03-14 03:00:00'); $start = new DateTime('2010-03-14 01:59:59'); echo 'fd1 ' . $end->format($date_format) . ' - ' . $start->format($date_format) - . ' = ' . $start->diff($end)->format('PT%hH%iM%sS') . "\n"; + . ' = ' . $start->diff($end)->format('PT%hH%iM%sS') . "\n"; $end = new DateTime('2010-03-14 04:30:00'); $start = new DateTime('2010-03-13 04:30:00'); echo 'fd2 ' . $end->format($date_format) . ' - ' . $start->format($date_format) - . ' = ' . $start->diff($end)->format($interval_format) . "\n"; + . ' = ' . $start->diff($end)->format($interval_format) . "\n"; $end = new DateTime('2010-03-14 03:30:00'); $start = new DateTime('2010-03-13 04:30:00'); echo 'fd3 ' . $end->format($date_format) . ' - ' . $start->format($date_format) - . ' = ' . $start->diff($end)->format($interval_format) . "\n"; + . ' = ' . $start->diff($end)->format($interval_format) . "\n"; $end = new DateTime('2010-03-14 01:30:00'); $start = new DateTime('2010-03-13 04:30:00'); echo 'fd4 ' . $end->format($date_format) . ' - ' . $start->format($date_format) - . ' = ' . $start->diff($end)->format($interval_format) . "\n"; + . ' = ' . $start->diff($end)->format($interval_format) . "\n"; $end = new DateTime('2010-03-14 01:30:00'); $start = new DateTime('2010-03-13 01:30:00'); echo 'fd5 ' . $end->format($date_format) . ' - ' . $start->format($date_format) - . ' = ' . $start->diff($end)->format($interval_format) . "\n"; + . ' = ' . $start->diff($end)->format($interval_format) . "\n"; $end = new DateTime('2010-03-14 03:30:00'); $start = new DateTime('2010-03-13 03:30:00'); echo 'fd6 ' . $end->format($date_format) . ' - ' . $start->format($date_format) - . ' = ' . $start->diff($end)->format($interval_format) . "\n"; + . ' = ' . $start->diff($end)->format($interval_format) . "\n"; $end = new DateTime('2010-03-14 03:30:00'); $start = new DateTime('2010-03-13 02:30:00'); echo 'fd7 ' . $end->format($date_format) . ' - ' . $start->format($date_format) - . ' = ' . $start->diff($end)->format($interval_format) . "\n"; + . ' = ' . $start->diff($end)->format($interval_format) . "\n"; ?> --EXPECT-- fd1 2010-03-14 03:00:00 EDT America/New_York - 2010-03-14 01:59:59 EST America/New_York = PT0H0M1S diff --git a/ext/date/tests/rfc-datetime_and_daylight_saving_time-type3-fs.phpt b/ext/date/tests/rfc-datetime_and_daylight_saving_time-type3-fs.phpt index 72351d37e1..aa1c268704 100644 --- a/ext/date/tests/rfc-datetime_and_daylight_saving_time-type3-fs.phpt +++ b/ext/date/tests/rfc-datetime_and_daylight_saving_time-type3-fs.phpt @@ -19,43 +19,43 @@ $end = new DateTime('2010-03-14 03:00:00'); $interval_spec = 'PT1S'; $interval = new DateInterval($interval_spec); echo 'fs1 ' . $end->format($date_format) . " - $interval_spec = " - . $end->sub($interval)->format($date_format) . "\n"; + . $end->sub($interval)->format($date_format) . "\n"; $end = new DateTime('2010-03-14 04:30:00'); $interval_spec = 'P1D'; $interval = new DateInterval($interval_spec); echo 'fs2 ' . $end->format($date_format) . " - $interval_spec = " - . $end->sub($interval)->format($date_format) . "\n"; + . $end->sub($interval)->format($date_format) . "\n"; $end = new DateTime('2010-03-14 03:30:00'); $interval_spec = 'PT22H'; $interval = new DateInterval($interval_spec); echo 'fs3 ' . $end->format($date_format) . " - $interval_spec = " - . $end->sub($interval)->format($date_format) . "\n"; + . $end->sub($interval)->format($date_format) . "\n"; $end = new DateTime('2010-03-14 01:30:00'); $interval_spec = 'PT21H'; $interval = new DateInterval($interval_spec); echo 'fs4 ' . $end->format($date_format) . " - $interval_spec = " - . $end->sub($interval)->format($date_format) . "\n"; + . $end->sub($interval)->format($date_format) . "\n"; $end = new DateTime('2010-03-14 01:30:00'); $interval_spec = 'P1D'; $interval = new DateInterval($interval_spec); echo 'fs5 ' . $end->format($date_format) . " - $interval_spec = " - . $end->sub($interval)->format($date_format) . "\n"; + . $end->sub($interval)->format($date_format) . "\n"; $end = new DateTime('2010-03-15 03:30:00'); $interval_spec = 'P1D'; $interval = new DateInterval($interval_spec); echo 'fs6 ' . $end->format($date_format) . " - $interval_spec = " - . $end->sub($interval)->format($date_format) . "\n"; + . $end->sub($interval)->format($date_format) . "\n"; $end = new DateTime('2010-03-15 02:30:00'); $interval_spec = 'P1D'; $interval = new DateInterval($interval_spec); echo 'fs7 ' . $end->format($date_format) . " - $interval_spec = " - . $end->sub($interval)->format($date_format) . "\n"; + . $end->sub($interval)->format($date_format) . "\n"; ?> --EXPECT-- fs1 2010-03-14 03:00:00 EDT America/New_York - PT1S = 2010-03-14 01:59:59 EST America/New_York diff --git a/ext/date/tests/strftime_basic.phpt b/ext/date/tests/strftime_basic.phpt index 340ac99e22..aa05eb6115 100644 --- a/ext/date/tests/strftime_basic.phpt +++ b/ext/date/tests/strftime_basic.phpt @@ -22,9 +22,7 @@ var_dump( strftime($format, $timestamp) ); var_dump( strftime($format) ); ?> -===DONE=== --EXPECTF-- *** Testing strftime() : basic functionality *** string(20) "Aug 08 2008 08:08:08" string(%d) "%s %d %d %d:%d:%d" -===DONE=== diff --git a/ext/date/tests/strftime_variation10.phpt b/ext/date/tests/strftime_variation10.phpt index 0a4059ee20..108dcffc54 100644 --- a/ext/date/tests/strftime_variation10.phpt +++ b/ext/date/tests/strftime_variation10.phpt @@ -23,20 +23,19 @@ $timestamp = mktime(8, 8, 8, 8, 8, 2008); //array of values to iterate over $inputs = array( - 'The ISO 8601:1988 week number' => "%V", - 'Weekday as decimal' => "%u", + 'The ISO 8601:1988 week number' => "%V", + 'Weekday as decimal' => "%u", ); // loop through each element of the array for timestamp foreach($inputs as $key =>$value) { - echo "\n--$key--\n"; - var_dump( strftime($value) ); - var_dump( strftime($value, $timestamp) ); + echo "\n--$key--\n"; + var_dump( strftime($value) ); + var_dump( strftime($value, $timestamp) ); } ?> -===DONE=== --EXPECTF-- *** Testing strftime() : usage variation *** @@ -47,4 +46,3 @@ string(2) "32" --Weekday as decimal-- string(%d) "%d" string(1) "5" -===DONE=== diff --git a/ext/date/tests/strftime_variation11.phpt b/ext/date/tests/strftime_variation11.phpt index 737f7c96de..a169dd966e 100644 --- a/ext/date/tests/strftime_variation11.phpt +++ b/ext/date/tests/strftime_variation11.phpt @@ -21,11 +21,9 @@ var_dump( strftime($format) ); var_dump( strftime($format, $timestamp) ); ?> -===DONE=== --EXPECTF-- *** Testing strftime() : usage variation *** -- Testing strftime() function with Abbreviated month name format %h -- string(%d) "%s" string(3) "Aug" -===DONE=== diff --git a/ext/date/tests/strftime_variation12.phpt b/ext/date/tests/strftime_variation12.phpt index 07b1b3ec1c..b8f85ff842 100644 --- a/ext/date/tests/strftime_variation12.phpt +++ b/ext/date/tests/strftime_variation12.phpt @@ -27,11 +27,9 @@ var_dump( strftime($format) ); var_dump( strftime($format, $timestamp) ); ?> -===DONE=== --EXPECTF-- *** Testing strftime() : usage variation *** -- Testing strftime() function with Abbreviated month name format %h -- string(%d) "%s" string(3) "Aug" -===DONE=== diff --git a/ext/date/tests/strftime_variation13.phpt b/ext/date/tests/strftime_variation13.phpt index cce13fbc3b..0ebfa5502d 100644 --- a/ext/date/tests/strftime_variation13.phpt +++ b/ext/date/tests/strftime_variation13.phpt @@ -17,22 +17,21 @@ $timestamp = mktime(8, 8, 8, 8, 8, 2008); //array of values to iterate over $inputs = array( - 'Century number' => "%C", - 'Month Date Year' => "%D", - 'Year with century' => "%G", - 'Year without century' => "%g", + 'Century number' => "%C", + 'Month Date Year' => "%D", + 'Year with century' => "%G", + 'Year without century' => "%g", ); // loop through each element of the array for timestamp foreach($inputs as $key =>$value) { echo "\n--$key--\n"; - var_dump( strftime($value) ); - var_dump( strftime($value, $timestamp) ); + var_dump( strftime($value) ); + var_dump( strftime($value, $timestamp) ); } ?> -===DONE=== --EXPECTF-- *** Testing strftime() : usage variation *** @@ -51,4 +50,3 @@ string(4) "2008" --Year without century-- string(2) "%d" string(2) "08" -===DONE=== diff --git a/ext/date/tests/strftime_variation14.phpt b/ext/date/tests/strftime_variation14.phpt index 80074acff8..b209d91adf 100644 --- a/ext/date/tests/strftime_variation14.phpt +++ b/ext/date/tests/strftime_variation14.phpt @@ -23,22 +23,21 @@ $timestamp = mktime(8, 8, 8, 8, 8, 2008); //array of values to iterate over $inputs = array( - 'Century number' => "%C", - 'Month Date Year' => "%D", - 'Year with century' => "%G", - 'Year without century' => "%g", + 'Century number' => "%C", + 'Month Date Year' => "%D", + 'Year with century' => "%G", + 'Year without century' => "%g", ); // loop through each element of the array for timestamp foreach($inputs as $key =>$value) { echo "\n--$key--\n"; - var_dump( strftime($value) ); - var_dump( strftime($value, $timestamp) ); + var_dump( strftime($value) ); + var_dump( strftime($value, $timestamp) ); } ?> -===DONE=== --EXPECTF-- *** Testing strftime() : usage variation *** @@ -57,4 +56,3 @@ string(4) "2008" --Year without century-- string(%d) "%d" string(2) "08" -===DONE=== diff --git a/ext/date/tests/strftime_variation15.phpt b/ext/date/tests/strftime_variation15.phpt index f6e8fedf0b..38826b6528 100644 --- a/ext/date/tests/strftime_variation15.phpt +++ b/ext/date/tests/strftime_variation15.phpt @@ -17,21 +17,20 @@ $timestamp = mktime(8, 8, 8, 8, 8, 2008); //array of values to iterate over $inputs = array( - 'Time in a.m/p.m notation' => "%r", - 'Time in 24 hour notation' => "%R", - 'Current time %H:%M:%S format' => "%T", + 'Time in a.m/p.m notation' => "%r", + 'Time in 24 hour notation' => "%R", + 'Current time %H:%M:%S format' => "%T", ); // loop through each element of the array for timestamp foreach($inputs as $key =>$value) { echo "\n--$key--\n"; - var_dump( strftime($value) ); - var_dump( strftime($value, $timestamp) ); + var_dump( strftime($value) ); + var_dump( strftime($value, $timestamp) ); } ?> -===DONE=== --EXPECTF-- *** Testing strftime() : usage variation *** @@ -46,4 +45,3 @@ string(5) "08:08" --Current time %H:%M:%S format-- string(%d) "%d:%d:%d" string(8) "08:08:08" -===DONE=== diff --git a/ext/date/tests/strftime_variation16.phpt b/ext/date/tests/strftime_variation16.phpt index b74a6fe96f..5791c12838 100644 --- a/ext/date/tests/strftime_variation16.phpt +++ b/ext/date/tests/strftime_variation16.phpt @@ -23,21 +23,20 @@ $timestamp = mktime(8, 8, 8, 8, 8, 2008); //array of values to iterate over $inputs = array( - 'Time in a.m/p.m notation' => "%r", - 'Time in 24 hour notation' => "%R", - 'Current time %H:%M:%S format' => "%T", + 'Time in a.m/p.m notation' => "%r", + 'Time in 24 hour notation' => "%R", + 'Current time %H:%M:%S format' => "%T", ); // loop through each element of the array for timestamp foreach($inputs as $key =>$value) { echo "\n--$key--\n"; - var_dump( strftime($value) ); - var_dump( strftime($value, $timestamp) ); + var_dump( strftime($value) ); + var_dump( strftime($value, $timestamp) ); } ?> -===DONE=== --EXPECTF-- *** Testing strftime() : usage variation *** @@ -52,4 +51,3 @@ string(5) "08:08" --Current time %H:%M:%S format-- string(%d) "%d:%d:%d" string(8) "08:08:08" -===DONE=== diff --git a/ext/date/tests/strftime_variation17.phpt b/ext/date/tests/strftime_variation17.phpt index 04e1cadab0..6a698d230c 100644 --- a/ext/date/tests/strftime_variation17.phpt +++ b/ext/date/tests/strftime_variation17.phpt @@ -20,11 +20,9 @@ $format = "%e"; var_dump( strftime($format) ); var_dump( strftime($format, $timestamp) ); ?> -===DONE=== --EXPECTF-- *** Testing strftime() : usage variation *** -- Testing strftime() function with Day of the month as decimal single digit format -- string(%d) "%A%d" string(2) " 8" -===DONE=== diff --git a/ext/date/tests/strftime_variation18.phpt b/ext/date/tests/strftime_variation18.phpt index b0f21ff010..310b7729fa 100644 --- a/ext/date/tests/strftime_variation18.phpt +++ b/ext/date/tests/strftime_variation18.phpt @@ -26,11 +26,9 @@ $format = "%e"; var_dump( strftime($format) ); var_dump( strftime($format, $timestamp) ); ?> -===DONE=== --EXPECTF-- *** Testing strftime() : usage variation *** -- Testing strftime() function with Day of the month as decimal single digit format -- string(%d) "%s" string(2) " 8" -===DONE=== diff --git a/ext/date/tests/strftime_variation19.phpt b/ext/date/tests/strftime_variation19.phpt index 125a47c789..852b95fbe9 100644 --- a/ext/date/tests/strftime_variation19.phpt +++ b/ext/date/tests/strftime_variation19.phpt @@ -17,20 +17,19 @@ $timestamp = mktime(8, 8, 8, 8, 8, 2008); //array of values to iterate over $inputs = array( - 'Newline character' => "%n", - 'Tab character' => "%t" + 'Newline character' => "%n", + 'Tab character' => "%t" ); // loop through each element of the array for timestamp foreach($inputs as $key =>$value) { echo "\n--$key--\n"; - var_dump( strftime($value) ); - var_dump( strftime($value, $timestamp) ); + var_dump( strftime($value) ); + var_dump( strftime($value, $timestamp) ); } ?> -===DONE=== --EXPECT-- *** Testing strftime() : usage variation *** @@ -43,4 +42,3 @@ string(1) " --Tab character-- string(1) " " string(1) " " -===DONE=== diff --git a/ext/date/tests/strftime_variation20.phpt b/ext/date/tests/strftime_variation20.phpt index 0fb11914d4..19875760d5 100644 --- a/ext/date/tests/strftime_variation20.phpt +++ b/ext/date/tests/strftime_variation20.phpt @@ -23,20 +23,19 @@ $timestamp = mktime(8, 8, 8, 8, 8, 2008); //array of values to iterate over $inputs = array( - 'Newline character' => "%n", - 'Tab character' => "%t" + 'Newline character' => "%n", + 'Tab character' => "%t" ); // loop through each element of the array for timestamp foreach($inputs as $key =>$value) { echo "\n--$key--\n"; - var_dump( strftime($value) ); - var_dump( strftime($value, $timestamp) ); + var_dump( strftime($value) ); + var_dump( strftime($value, $timestamp) ); } ?> -===DONE=== --EXPECTREGEX-- \*\*\* Testing strftime\(\) : usage variation \*\*\* @@ -49,4 +48,3 @@ string\(1\) " --Tab character-- string\(1\) "\s" string\(1\) "\s" -===DONE=== diff --git a/ext/date/tests/strftime_variation21.phpt b/ext/date/tests/strftime_variation21.phpt index 730716c392..164e5e304b 100644 --- a/ext/date/tests/strftime_variation21.phpt +++ b/ext/date/tests/strftime_variation21.phpt @@ -18,20 +18,19 @@ $timestamp = mktime(8, 8, 8, 8, 8, 2008); //array of values to iterate over $inputs = array( 'Preferred date and time representation' => "%c", - 'Preferred date representation' => "%x", - 'Preferred time representation' => "%X", + 'Preferred date representation' => "%x", + 'Preferred time representation' => "%X", ); // loop through each element of the array for timestamp foreach($inputs as $key =>$value) { echo "\n--$key--\n"; - var_dump( strftime($value) ); - var_dump( strftime($value, $timestamp) ); + var_dump( strftime($value) ); + var_dump( strftime($value, $timestamp) ); } ?> -===DONE=== --EXPECTF-- *** Testing strftime() : usage variation *** @@ -46,4 +45,3 @@ string(8) "08/08/08" --Preferred time representation-- string(%d) "%d:%d:%d" string(8) "08:08:08" -===DONE=== diff --git a/ext/date/tests/strftime_variation22.phpt b/ext/date/tests/strftime_variation22.phpt index 11dcf75694..900cde2fca 100644 --- a/ext/date/tests/strftime_variation22.phpt +++ b/ext/date/tests/strftime_variation22.phpt @@ -28,20 +28,19 @@ $timestamp = mktime(8, 8, 8, 8, 8, 2008); //array of values to iterate over $inputs = array( 'Preferred date and time representation' => "%c", - 'Preferred date representation' => "%x", - 'Preferred time representation' => "%X", + 'Preferred date representation' => "%x", + 'Preferred time representation' => "%X", ); // loop through each element of the array for timestamp foreach($inputs as $key =>$value) { echo "\n--$key--\n"; - var_dump( $value ); - var_dump( strftime($value, $timestamp) ); + var_dump( $value ); + var_dump( strftime($value, $timestamp) ); } ?> -===DONE=== --EXPECT-- *** Testing strftime() : usage variation *** @@ -56,4 +55,3 @@ string(8) "08/08/08" --Preferred time representation-- string(2) "%X" string(8) "08:08:08" -===DONE=== diff --git a/ext/date/tests/strftime_variation23.phpt b/ext/date/tests/strftime_variation23.phpt deleted file mode 100644 index 22f079702a..0000000000 --- a/ext/date/tests/strftime_variation23.phpt +++ /dev/null @@ -1,42 +0,0 @@ ---TEST-- -Test strftime() function : usage variation - Checking large positive and negative float values to timestamp. ---SKIPIF-- -<?php if (PHP_INT_SIZE != 4) echo "skip this test is for 32-bit only"; ?> ---FILE-- -<?php -/* Prototype : string strftime(string format [, int timestamp]) - * Description: Format a local time/date according to locale settings - * Source code: ext/date/php_date.c - * Alias to functions: - */ - -echo "*** Testing strftime() : usage variation ***\n"; - -// Initialise function arguments not being substituted (if any) -setlocale(LC_ALL, "en_US"); -date_default_timezone_set("UTC"); -$format = '%b %d %Y %H:%M:%S'; - -echo "\n-- Testing strftime() function with float 12.3456789000e10 to timestamp --\n"; -$timestamp = 12.3456789000e10; -var_dump( strftime($format, $timestamp) ); - -echo "\n-- Testing strftime() function with float -12.3456789000e10 to timestamp --\n"; -$timestamp = -12.3456789000e10; -var_dump( strftime($format, $timestamp) ); - -?> -===DONE=== ---EXPECTF-- -*** Testing strftime() : usage variation *** - --- Testing strftime() function with float 12.3456789000e10 to timestamp -- - -Warning: strftime() expects parameter 2 to be int, float given in %s on line %d -bool(false) - --- Testing strftime() function with float -12.3456789000e10 to timestamp -- - -Warning: strftime() expects parameter 2 to be int, float given in %s on line %d -bool(false) -===DONE=== diff --git a/ext/date/tests/strftime_variation3.phpt b/ext/date/tests/strftime_variation3.phpt index 69f747ca34..90771973a9 100644 --- a/ext/date/tests/strftime_variation3.phpt +++ b/ext/date/tests/strftime_variation3.phpt @@ -18,8 +18,8 @@ $timestamp = mktime(8, 8, 8, 8, 8, 2008); $inputs = array( 'Abbreviated weekday name' => "%a", 'Full weekday name' => "%A", - 'Week number of the year' => "%U", - 'Week number of the year in decimal number' => "%W", + 'Week number of the year' => "%U", + 'Week number of the year in decimal number' => "%W", ); // loop through each element of the array for timestamp @@ -30,7 +30,6 @@ foreach($inputs as $key =>$value) { }; ?> -===DONE=== --EXPECTF-- *** Testing strftime() : usage variation *** @@ -49,4 +48,3 @@ string(2) "31" --Week number of the year in decimal number-- string(%d) "%d" string(2) "31" -===DONE=== diff --git a/ext/date/tests/strftime_variation4.phpt b/ext/date/tests/strftime_variation4.phpt index 54df26a1c6..461da2669d 100644 --- a/ext/date/tests/strftime_variation4.phpt +++ b/ext/date/tests/strftime_variation4.phpt @@ -18,7 +18,7 @@ $timestamp = mktime(8, 8, 8, 8, 8, 2008); $inputs = array( 'Abbreviated month name' => "%b", 'Full month name' => "%B", - 'Month as decimal' => "%m", + 'Month as decimal' => "%m", ); // loop through each element of the array for timestamp @@ -30,7 +30,6 @@ foreach($inputs as $key =>$value) { }; ?> -===DONE=== --EXPECTF-- *** Testing strftime() : usage variation *** @@ -45,4 +44,3 @@ string(6) "August" --Month as decimal-- string(%d) "%d" string(2) "08" -===DONE=== diff --git a/ext/date/tests/strftime_variation5.phpt b/ext/date/tests/strftime_variation5.phpt index 15ad8b08ea..31cc970564 100644 --- a/ext/date/tests/strftime_variation5.phpt +++ b/ext/date/tests/strftime_variation5.phpt @@ -17,10 +17,10 @@ $timestamp = mktime(8, 8, 8, 8, 8, 2008); //array of values to iterate over $inputs = array( - 'Year as decimal number without a century' => "%y", - 'Year as decimal number including the century' => "%Y", - 'Time zone offset' => "%Z", - 'Time zone offset' => "%z", + 'Year as decimal number without a century' => "%y", + 'Year as decimal number including the century' => "%Y", + 'Time zone offset' => "%Z", + 'Time zone offset' => "%z", ); // loop through each element of the array for timestamp @@ -32,7 +32,6 @@ foreach($inputs as $key =>$value) { }; ?> -===DONE=== --EXPECTF-- *** Testing strftime() : usage variation *** @@ -47,4 +46,3 @@ string(4) "2008" --Time zone offset-- string(%d) "%s" string(%d) "%s" -===DONE=== diff --git a/ext/date/tests/strftime_variation6.phpt b/ext/date/tests/strftime_variation6.phpt index f4413c6c79..1460f70b30 100644 --- a/ext/date/tests/strftime_variation6.phpt +++ b/ext/date/tests/strftime_variation6.phpt @@ -18,11 +18,11 @@ $timestamp = mktime(18, 8, 8, 8, 8, 2008); //array of values to iterate over $inputs = array( - 'Hour as decimal by 24-hour format' => "%H", - 'Hour as decimal by 12-hour format' => "%I", - 'Minute as decimal number' => "%M", - 'AM/PM format for a time' => "%p", - 'Second as decimal number' => "%S", + 'Hour as decimal by 24-hour format' => "%H", + 'Hour as decimal by 12-hour format' => "%I", + 'Minute as decimal number' => "%M", + 'AM/PM format for a time' => "%p", + 'Second as decimal number' => "%S", ); // loop through each element of the array for timestamp @@ -34,7 +34,6 @@ foreach($inputs as $key =>$value) { }; ?> -===DONE=== --EXPECTF-- *** Testing strftime() : usage variation *** @@ -57,4 +56,3 @@ string(2) "PM" --Second as decimal number-- string(%d) "%d" string(2) "08" -===DONE=== diff --git a/ext/date/tests/strftime_variation7.phpt b/ext/date/tests/strftime_variation7.phpt index 29a9406381..b8cc2de847 100644 --- a/ext/date/tests/strftime_variation7.phpt +++ b/ext/date/tests/strftime_variation7.phpt @@ -18,9 +18,9 @@ $timestamp = mktime(18, 8, 8, 8, 8, 2008); //array of values to iterate over $inputs = array( - 'Day of the month as a decimal number' => "%d", - 'Day of the year as a decimal number' => "%j", - 'Day of the week as a decimal number' => "%w" + 'Day of the month as a decimal number' => "%d", + 'Day of the year as a decimal number' => "%j", + 'Day of the week as a decimal number' => "%w" ); // loop through each element of the array for timestamp @@ -32,7 +32,6 @@ foreach($inputs as $key =>$value) { }; ?> -===DONE=== --EXPECTF-- *** Testing strftime() : usage variation *** @@ -47,4 +46,3 @@ string(3) "221" --Day of the week as a decimal number-- string(%d) "%d" string(1) "5" -===DONE=== diff --git a/ext/date/tests/strftime_variation8.phpt b/ext/date/tests/strftime_variation8.phpt index 75b41c186a..44b37a9bb8 100644 --- a/ext/date/tests/strftime_variation8.phpt +++ b/ext/date/tests/strftime_variation8.phpt @@ -21,11 +21,9 @@ var_dump( strftime($format) ); var_dump( strftime($format, $timestamp) ); ?> -===DONE=== --EXPECT-- *** Testing strftime() : usage variation *** -- Testing strftime() function with a literal % character to format -- string(1) "%" string(1) "%" -===DONE=== diff --git a/ext/date/tests/strftime_variation9.phpt b/ext/date/tests/strftime_variation9.phpt index 49363ec27b..82a060b66d 100644 --- a/ext/date/tests/strftime_variation9.phpt +++ b/ext/date/tests/strftime_variation9.phpt @@ -17,20 +17,19 @@ $timestamp = mktime(8, 8, 8, 8, 8, 2008); //array of values to iterate over $inputs = array( - 'The ISO 8601:1988 week number' => "%V", - 'Weekday as decimal' => "%u", + 'The ISO 8601:1988 week number' => "%V", + 'Weekday as decimal' => "%u", ); // loop through each element of the array for timestamp foreach($inputs as $key =>$value) { - echo "\n--$key--\n"; - var_dump( strftime($value) ); - var_dump( strftime($value, $timestamp) ); + echo "\n--$key--\n"; + var_dump( strftime($value) ); + var_dump( strftime($value, $timestamp) ); } ?> -===DONE=== --EXPECTF-- *** Testing strftime() : usage variation *** @@ -41,4 +40,3 @@ string(2) "32" --Weekday as decimal-- string(1) "%d" string(1) "5" -===DONE=== diff --git a/ext/date/tests/strtotime-mysql-64bit.phpt b/ext/date/tests/strtotime-mysql-64bit.phpt index 356e485949..ddf1dfff3f 100644 --- a/ext/date/tests/strtotime-mysql-64bit.phpt +++ b/ext/date/tests/strtotime-mysql-64bit.phpt @@ -12,13 +12,13 @@ $d[] = '20001231185859'; $d[] = '20800410101010'; // overflow.. foreach($d as $date) { - $time = strtotime($date); + $time = strtotime($date); - if (is_integer($time)) { - var_dump(date('r', $time)); - } else { - var_dump($time); - } + if (is_integer($time)) { + var_dump(date('r', $time)); + } else { + var_dump($time); + } } ?> --EXPECT-- diff --git a/ext/date/tests/strtotime-mysql.phpt b/ext/date/tests/strtotime-mysql.phpt index 5b0192880b..c9502e1d3e 100644 --- a/ext/date/tests/strtotime-mysql.phpt +++ b/ext/date/tests/strtotime-mysql.phpt @@ -12,13 +12,13 @@ $d[] = '20001231185859'; $d[] = '20800410101010'; // overflow.. foreach($d as $date) { - $time = strtotime($date); + $time = strtotime($date); - if (is_integer($time)) { - var_dump(date('r', $time)); - } else { - var_dump($time); - } + if (is_integer($time)) { + var_dump(date('r', $time)); + } else { + var_dump($time); + } } ?> --EXPECT-- diff --git a/ext/date/tests/strtotime-relative.phpt b/ext/date/tests/strtotime-relative.phpt index 293223bb2d..f5cd014a6d 100644 --- a/ext/date/tests/strtotime-relative.phpt +++ b/ext/date/tests/strtotime-relative.phpt @@ -8,44 +8,44 @@ date_default_timezone_set('UTC'); $base_time = 1204200000; // 28 Feb 2008 12:00:00 $offsets = array( - // offset around a day - '80412 seconds', - '86399 seconds', - '86400 seconds', - '86401 seconds', - '112913 seconds', + // offset around a day + '80412 seconds', + '86399 seconds', + '86400 seconds', + '86401 seconds', + '112913 seconds', - // offset around 7 days - '134 hours', - '167 hours', - '168 hours', - '169 hours', - '183 hours', + // offset around 7 days + '134 hours', + '167 hours', + '168 hours', + '169 hours', + '183 hours', - // offset around 6 months - '178 days', - '179 days', - '180 days', - '183 days', - '184 days', + // offset around 6 months + '178 days', + '179 days', + '180 days', + '183 days', + '184 days', - // offset around 10 years - '115 months', - '119 months', - '120 months', - '121 months', - '128 months', + // offset around 10 years + '115 months', + '119 months', + '120 months', + '121 months', + '128 months', - // offset around 25 years (can't do much more reliably with strtotime) - '24 years', - '25 years', - '26 years' + // offset around 25 years (can't do much more reliably with strtotime) + '24 years', + '25 years', + '26 years' ); foreach ($offsets AS $offset) { - foreach (array('+', '-') AS $direction) { - echo "$direction$offset: " . date(DATE_ISO8601, strtotime("$direction$offset", $base_time)) . "\n"; - } + foreach (array('+', '-') AS $direction) { + echo "$direction$offset: " . date(DATE_ISO8601, strtotime("$direction$offset", $base_time)) . "\n"; + } } ?> diff --git a/ext/date/tests/strtotime.phpt b/ext/date/tests/strtotime.phpt index aef7d68dcd..f55765fa80 100644 --- a/ext/date/tests/strtotime.phpt +++ b/ext/date/tests/strtotime.phpt @@ -10,7 +10,7 @@ $d[] = strtotime("@1121373041"); $d[] = strtotime("@1121373041 CEST"); foreach($d as $date) { - echo date(DATE_ISO8601, $date), "\n"; + echo date(DATE_ISO8601, $date), "\n"; } ?> --EXPECT-- diff --git a/ext/date/tests/strtotime2.phpt b/ext/date/tests/strtotime2.phpt index b8b605923d..c9b83838d1 100644 --- a/ext/date/tests/strtotime2.phpt +++ b/ext/date/tests/strtotime2.phpt @@ -7,23 +7,23 @@ date_default_timezone_set("Europe/Oslo"); $time = time(); $constants = array( - 'DATE_ATOM', - 'DATE_COOKIE', - 'DATE_ISO8601', - 'DATE_RFC822', - 'DATE_RFC850', - 'DATE_RFC1036', - 'DATE_RFC1123', - 'DATE_RFC2822', - 'DATE_RFC3339', - 'DATE_RSS', - 'DATE_W3C' + 'DATE_ATOM', + 'DATE_COOKIE', + 'DATE_ISO8601', + 'DATE_RFC822', + 'DATE_RFC850', + 'DATE_RFC1036', + 'DATE_RFC1123', + 'DATE_RFC2822', + 'DATE_RFC3339', + 'DATE_RSS', + 'DATE_W3C' ); foreach ($constants as $const) { - echo "$const:\t"; - echo ((strtotime(date(constant($const), $time)) === $time) ? "OK" : "FAIL") . "\n"; + echo "$const:\t"; + echo ((strtotime(date(constant($const), $time)) === $time) ? "OK" : "FAIL") . "\n"; } ?> --EXPECT-- diff --git a/ext/date/tests/strtotime3-64bit.phpt b/ext/date/tests/strtotime3-64bit.phpt index 52c4edd63b..c4f87c3b1a 100644 --- a/ext/date/tests/strtotime3-64bit.phpt +++ b/ext/date/tests/strtotime3-64bit.phpt @@ -8,39 +8,39 @@ date_default_timezone_set('Europe/Lisbon'); $time = 1150494719; // 16/June/2006 $strs = array( - '', - " \t\r\n000", - 'yesterday', - '22:49:12', - '22:49:12 bogusTZ', - '22.49.12.42GMT', - '22.49.12.42bogusTZ', - 't0222', - 't0222 t0222', - '022233', - '022233 bogusTZ', - '2-3-2004', - '2.3.2004', - '20060212T23:12:23UTC', - '20060212T23:12:23 bogusTZ', - '2006167', //pgydotd - 'Jan-15-2006', //pgtextshort - '2006-Jan-15', //pgtextreverse - '10/Oct/2000:13:55:36 +0100', //clf - '10/Oct/2000:13:55:36 +00100', //clf - '2006', - '1986', // year - 'JAN', - 'January', + '', + " \t\r\n000", + 'yesterday', + '22:49:12', + '22:49:12 bogusTZ', + '22.49.12.42GMT', + '22.49.12.42bogusTZ', + 't0222', + 't0222 t0222', + '022233', + '022233 bogusTZ', + '2-3-2004', + '2.3.2004', + '20060212T23:12:23UTC', + '20060212T23:12:23 bogusTZ', + '2006167', //pgydotd + 'Jan-15-2006', //pgtextshort + '2006-Jan-15', //pgtextreverse + '10/Oct/2000:13:55:36 +0100', //clf + '10/Oct/2000:13:55:36 +00100', //clf + '2006', + '1986', // year + 'JAN', + 'January', ); foreach ($strs as $str) { - $t = strtotime($str, $time); - if (is_integer($t)) { - var_dump(date(DATE_RFC2822, $t)); - } else { - var_dump($t); - } + $t = strtotime($str, $time); + if (is_integer($t)) { + var_dump(date(DATE_RFC2822, $t)); + } else { + var_dump($t); + } } ?> diff --git a/ext/date/tests/strtotime3.phpt b/ext/date/tests/strtotime3.phpt index 97161f9dfe..f01af27a43 100644 --- a/ext/date/tests/strtotime3.phpt +++ b/ext/date/tests/strtotime3.phpt @@ -8,39 +8,39 @@ date_default_timezone_set('Europe/Lisbon'); $time = 1150494719; // 16/June/2006 $strs = array( - '', - " \t\r\n000", - 'yesterday', - '22:49:12', - '22:49:12 bogusTZ', - '22.49.12.42GMT', - '22.49.12.42bogusTZ', - 't0222', - 't0222 t0222', - '022233', - '022233 bogusTZ', - '2-3-2004', - '2.3.2004', - '20060212T23:12:23UTC', - '20060212T23:12:23 bogusTZ', - '2006167', //pgydotd - 'Jan-15-2006', //pgtextshort - '2006-Jan-15', //pgtextreverse - '10/Oct/2000:13:55:36 +0100', //clf - '10/Oct/2000:13:55:36 +00100', //clf - '2006', - '1986', // year - 'JAN', - 'January', + '', + " \t\r\n000", + 'yesterday', + '22:49:12', + '22:49:12 bogusTZ', + '22.49.12.42GMT', + '22.49.12.42bogusTZ', + 't0222', + 't0222 t0222', + '022233', + '022233 bogusTZ', + '2-3-2004', + '2.3.2004', + '20060212T23:12:23UTC', + '20060212T23:12:23 bogusTZ', + '2006167', //pgydotd + 'Jan-15-2006', //pgtextshort + '2006-Jan-15', //pgtextreverse + '10/Oct/2000:13:55:36 +0100', //clf + '10/Oct/2000:13:55:36 +00100', //clf + '2006', + '1986', // year + 'JAN', + 'January', ); foreach ($strs as $str) { - $t = strtotime($str, $time); - if (is_integer($t)) { - var_dump(date(DATE_RFC2822, $t)); - } else { - var_dump($t); - } + $t = strtotime($str, $time); + if (is_integer($t)) { + var_dump(date(DATE_RFC2822, $t)); + } else { + var_dump($t); + } } ?> diff --git a/ext/date/tests/strtotime_variation_scottish.phpt b/ext/date/tests/strtotime_variation_scottish.phpt index 740583a78e..ee2ff5f098 100644 --- a/ext/date/tests/strtotime_variation_scottish.phpt +++ b/ext/date/tests/strtotime_variation_scottish.phpt @@ -2,11 +2,11 @@ Checking whisky time --FILE-- <?php - date_default_timezone_set('UTC'); - var_dump(date('H:i:s', strtotime('back of 7'))); - var_dump(date('H:i:s', strtotime('front of 7'))); - var_dump(date('H:i:s', strtotime('back of 19'))); - var_dump(date('H:i:s', strtotime('front of 19'))); + date_default_timezone_set('UTC'); + var_dump(date('H:i:s', strtotime('back of 7'))); + var_dump(date('H:i:s', strtotime('front of 7'))); + var_dump(date('H:i:s', strtotime('back of 19'))); + var_dump(date('H:i:s', strtotime('front of 19'))); ?> --EXPECT-- string(8) "07:15:00" diff --git a/ext/date/tests/sunfuncts.phpt b/ext/date/tests/sunfuncts.phpt index 672b3affe2..6859aadc44 100644 --- a/ext/date/tests/sunfuncts.phpt +++ b/ext/date/tests/sunfuncts.phpt @@ -6,13 +6,13 @@ precision=13 <?php date_default_timezone_set('Asia/Jerusalem'); for($a=1;$a<=12;$a++){ - echo date_sunrise(mktime(1,1,1,$a,1,2003),SUNFUNCS_RET_TIMESTAMP,31.76670,35.23330,90.83,2)." "; - echo date_sunrise(mktime(1,1,1,$a,1,2003),SUNFUNCS_RET_STRING,31.76670,35.23330,90.83,2)." "; - echo date_sunrise(mktime(1,1,1,$a,1,2003),SUNFUNCS_RET_DOUBLE,31.76670,35.23330,90.83,2)."\n"; + echo date_sunrise(mktime(1,1,1,$a,1,2003),SUNFUNCS_RET_TIMESTAMP,31.76670,35.23330,90.83,2)." "; + echo date_sunrise(mktime(1,1,1,$a,1,2003),SUNFUNCS_RET_STRING,31.76670,35.23330,90.83,2)." "; + echo date_sunrise(mktime(1,1,1,$a,1,2003),SUNFUNCS_RET_DOUBLE,31.76670,35.23330,90.83,2)."\n"; - echo date_sunset(mktime(1,1,1,$a,1,2003),SUNFUNCS_RET_TIMESTAMP,31.76670,35.23330,90.83,2)." "; - echo date_sunset(mktime(1,1,1,$a,1,2003),SUNFUNCS_RET_STRING,31.76670,35.23330,90.83,2)." "; - echo date_sunset(mktime(1,1,1,$a,1,2003),SUNFUNCS_RET_DOUBLE,31.76670,35.23330,90.83,2)."\n"; + echo date_sunset(mktime(1,1,1,$a,1,2003),SUNFUNCS_RET_TIMESTAMP,31.76670,35.23330,90.83,2)." "; + echo date_sunset(mktime(1,1,1,$a,1,2003),SUNFUNCS_RET_STRING,31.76670,35.23330,90.83,2)." "; + echo date_sunset(mktime(1,1,1,$a,1,2003),SUNFUNCS_RET_DOUBLE,31.76670,35.23330,90.83,2)."\n"; } ?> --EXPECTF-- diff --git a/ext/date/tests/test-parse-from-format.phpt b/ext/date/tests/test-parse-from-format.phpt index ee0bd68d6b..670a316859 100644 --- a/ext/date/tests/test-parse-from-format.phpt +++ b/ext/date/tests/test-parse-from-format.phpt @@ -4,20 +4,20 @@ date_create_from_format() and date_parse_from_format(). <?php date_default_timezone_set('Europe/Oslo'); $formats = array( DATE_ATOM, DATE_COOKIE, DATE_ISO8601, DATE_RFC822, - DATE_RFC850, DATE_RFC1036, DATE_RFC1123, DATE_RFC2822, DATE_RFC3339, - DATE_RSS, DATE_W3C ); + DATE_RFC850, DATE_RFC1036, DATE_RFC1123, DATE_RFC2822, DATE_RFC3339, + DATE_RSS, DATE_W3C ); foreach( $formats as $format ) { - $date = new DateTime( "2008-07-08T22:14:12+02:00" ); - $formatted = $date->format( $format ) ; - $date2 = date_create_from_format( $format, $formatted ); - var_dump( $format, $formatted, $date2 ); - echo "\n"; - if ( $date2 === false ) - { - var_dump(date_parse_from_format( $format, $formatted ) ); - } + $date = new DateTime( "2008-07-08T22:14:12+02:00" ); + $formatted = $date->format( $format ) ; + $date2 = date_create_from_format( $format, $formatted ); + var_dump( $format, $formatted, $date2 ); + echo "\n"; + if ( $date2 === false ) + { + var_dump(date_parse_from_format( $format, $formatted ) ); + } } ?> --EXPECT-- diff --git a/ext/date/tests/time_basic.phpt b/ext/date/tests/time_basic.phpt index 0ff2f0120c..d97b73e216 100644 --- a/ext/date/tests/time_basic.phpt +++ b/ext/date/tests/time_basic.phpt @@ -10,7 +10,5 @@ Test return type and value for expected input time() var_dump(time()); ?> -===DONE=== --EXPECTF-- int(%d) -===DONE=== diff --git a/ext/date/tests/timezone-configuration.phpt b/ext/date/tests/timezone-configuration.phpt index b395853033..3e4340c38c 100644 --- a/ext/date/tests/timezone-configuration.phpt +++ b/ext/date/tests/timezone-configuration.phpt @@ -4,14 +4,14 @@ timezone configuration [1] date.timezone=GMT --FILE-- <?php - date_default_timezone_set('Europe/Oslo'); - echo strtotime("2005-06-18 22:15:44"), "\n"; + date_default_timezone_set('Europe/Oslo'); + echo strtotime("2005-06-18 22:15:44"), "\n"; - date_default_timezone_set('Europe/London'); - echo strtotime("2005-06-18 22:15:44"), "\n"; + date_default_timezone_set('Europe/London'); + echo strtotime("2005-06-18 22:15:44"), "\n"; - date_default_timezone_set('Europe/Oslo'); - echo strtotime("2005-06-18 22:15:44"), "\n"; + date_default_timezone_set('Europe/Oslo'); + echo strtotime("2005-06-18 22:15:44"), "\n"; ?> --EXPECT-- 1119125744 diff --git a/ext/date/tests/timezone_abbreviations_list_basic1.phpt b/ext/date/tests/timezone_abbreviations_list_basic1.phpt index 5232fe215f..0640b8a83d 100644 --- a/ext/date/tests/timezone_abbreviations_list_basic1.phpt +++ b/ext/date/tests/timezone_abbreviations_list_basic1.phpt @@ -22,8 +22,7 @@ echo "\n-- Format a sample entry --\n"; var_dump( $abbr["acst"] ); ?> -===DONE=== ---EXPECTF-- +--EXPECT-- *** Testing timezone_abbreviations_list() : basic functionality *** string(5) "array" int(144) @@ -85,4 +84,3 @@ array(6) { string(20) "Australia/Yancowinna" } } -===DONE=== diff --git a/ext/date/tests/timezone_identifiers_list_basic1.phpt b/ext/date/tests/timezone_identifiers_list_basic1.phpt index b6b0ca43b8..c537b9b4c5 100644 --- a/ext/date/tests/timezone_identifiers_list_basic1.phpt +++ b/ext/date/tests/timezone_identifiers_list_basic1.phpt @@ -23,7 +23,6 @@ var_dump(in_array("America/New_York", $zones)); var_dump(in_array("UTC", $zones)); ?> -===DONE=== --EXPECT-- *** Testing timezone_identifiers_list() : basic functionality *** Check return tpe is ARRAY @@ -32,5 +31,4 @@ Check array contains some common timezones bool(true) bool(true) bool(true) -===DONE=== diff --git a/ext/date/tests/timezone_name_from_abbr_basic1.phpt b/ext/date/tests/timezone_name_from_abbr_basic1.phpt index b181d8fb68..51b5d9b19e 100644 --- a/ext/date/tests/timezone_name_from_abbr_basic1.phpt +++ b/ext/date/tests/timezone_name_from_abbr_basic1.phpt @@ -3,7 +3,7 @@ Test timezone_name_from_abbr() function : basic functionality --FILE-- <?php /* Prototype : string timezone_name_from_abbr ( string $abbr [, int $gmtOffset= -1 [, int $isdst= -1 ]] ) - * Description: Returns the timezone name from abbrevation + * Description: Returns the timezone name from abbreviation * Source code: ext/date/php_date.c * Alias to functions: */ @@ -35,7 +35,6 @@ echo "-- Tests with invalid offsets --\n"; var_dump( timezone_name_from_abbr("", 5400) ); // offset = 1.5 hrs var_dump( timezone_name_from_abbr("", 62400) ); // offset = 24 hrs ?> -===DONE=== --EXPECT-- *** Testing timezone_name_from_abbr() : basic functionality *** -- Tests with special cases first - no lookup needed -- @@ -55,4 +54,3 @@ string(15) "America/Halifax" -- Tests with invalid offsets -- bool(false) bool(false) -===DONE=== diff --git a/ext/date/tests/timezone_offset_get_basic1.phpt b/ext/date/tests/timezone_offset_get_basic1.phpt index c7e197af85..e242200d7f 100644 --- a/ext/date/tests/timezone_offset_get_basic1.phpt +++ b/ext/date/tests/timezone_offset_get_basic1.phpt @@ -25,10 +25,8 @@ $tz = timezone_open("America/Los_Angeles"); var_dump(timezone_offset_get($tz, $date)); ?> -===DONE=== --EXPECTF-- *** Testing timezone_offset_get() : basic functionality *** %rint\(0\)|int\(3600\)%r %rint\(-18000\)|int\(-14400\)%r %rint\(-28800\)|int\(-25200\)%r -===DONE=== diff --git a/ext/date/tests/timezone_offset_get_error.phpt b/ext/date/tests/timezone_offset_get_error.phpt index 413755ac72..864dc54c2a 100644 --- a/ext/date/tests/timezone_offset_get_error.phpt +++ b/ext/date/tests/timezone_offset_get_error.phpt @@ -15,109 +15,66 @@ $date = date_create("GMT"); echo "*** Testing timezone_offset_get() : error conditions ***\n"; -echo "\n-- Testing timezone_offset_get() function with zero arguments --\n"; -try { - var_dump( timezone_offset_get() ); -} catch (Error $ex) { - var_dump($ex->getMessage()); - echo "\n"; -} - -echo "\n-- Testing timezone_offset_get() function with less than expected no. of arguments --\n"; -try { - var_dump( timezone_offset_get($tz) ); -} catch (Error $ex) { - var_dump($ex->getMessage()); - echo "\n"; -} - -echo "\n-- Testing timezone_offset_get() function with more than expected no. of arguments --\n"; -$extra_arg = 99; -try { - var_dump( timezone_offset_get($tz, $date, $extra_arg) ); -} catch (Error $ex) { - var_dump($ex->getMessage()); - echo "\n"; -} - echo "\n-- Testing timezone_offset_get() function with an invalid values for \$object argument --\n"; $invalid_obj = new stdClass(); try { - var_dump( timezone_offset_get($invalid_obj, $date) ); + var_dump( timezone_offset_get($invalid_obj, $date) ); } catch (Error $ex) { - var_dump($ex->getMessage()); - echo "\n"; + var_dump($ex->getMessage()); + echo "\n"; } $invalid_obj = 10; try { - var_dump( timezone_offset_get($invalid_obj, $date) ); + var_dump( timezone_offset_get($invalid_obj, $date) ); } catch (Error $ex) { - var_dump($ex->getMessage()); - echo "\n"; + var_dump($ex->getMessage()); + echo "\n"; } $invalid_obj = null; try { - var_dump( timezone_offset_get($invalid_obj, $date) ); + var_dump( timezone_offset_get($invalid_obj, $date) ); } catch (Error $ex) { - var_dump($ex->getMessage()); - echo "\n"; + var_dump($ex->getMessage()); + echo "\n"; } echo "\n-- Testing timezone_offset_get() function with an invalid values for \$datetime argument --\n"; $invalid_obj = new stdClass(); try { - var_dump( timezone_offset_get($tz, $invalid_obj) ); + var_dump( timezone_offset_get($tz, $invalid_obj) ); } catch (Error $ex) { - var_dump($ex->getMessage()); - echo "\n"; + var_dump($ex->getMessage()); + echo "\n"; } $invalid_obj = 10; try { - var_dump( timezone_offset_get($tz, $invalid_obj) ); + var_dump( timezone_offset_get($tz, $invalid_obj) ); } catch (Error $ex) { - var_dump($ex->getMessage()); - echo "\n"; + var_dump($ex->getMessage()); + echo "\n"; } $invalid_obj = null; try { - var_dump( timezone_offset_get($tz, $invalid_obj) ); + var_dump( timezone_offset_get($tz, $invalid_obj) ); } catch (Error $ex) { - var_dump($ex->getMessage()); - echo "\n"; + var_dump($ex->getMessage()); + echo "\n"; } ?> -===DONE=== ---EXPECTF-- +--EXPECT-- *** Testing timezone_offset_get() : error conditions *** --- Testing timezone_offset_get() function with zero arguments -- - -Warning: timezone_offset_get() expects exactly 2 parameters, 0 given in %s on line %d -bool(false) - --- Testing timezone_offset_get() function with less than expected no. of arguments -- - -Warning: timezone_offset_get() expects exactly 2 parameters, 1 given in %s on line %d -bool(false) - --- Testing timezone_offset_get() function with more than expected no. of arguments -- - -Warning: timezone_offset_get() expects exactly 2 parameters, 3 given in %s on line %d -bool(false) - -- Testing timezone_offset_get() function with an invalid values for $object argument -- -string(%d) "Argument 1 passed to timezone_offset_get() must be an instance of DateTimeZone, instance of stdClass given" +string(87) "timezone_offset_get(): Argument #1 ($object) must be of type DateTimeZone, object given" -string(%d) "Argument 1 passed to timezone_offset_get() must be an instance of DateTimeZone, int given" +string(84) "timezone_offset_get(): Argument #1 ($object) must be of type DateTimeZone, int given" -string(%d) "Argument 1 passed to timezone_offset_get() must be an instance of DateTimeZone, null given" +string(85) "timezone_offset_get(): Argument #1 ($object) must be of type DateTimeZone, null given" -- Testing timezone_offset_get() function with an invalid values for $datetime argument -- -string(%d) "Argument 2 passed to timezone_offset_get() must implement interface DateTimeInterface, instance of stdClass given" - -string(%d) "Argument 2 passed to timezone_offset_get() must implement interface DateTimeInterface, int given" +string(94) "timezone_offset_get(): Argument #2 ($datetime) must be of type DateTimeInterface, object given" -string(%d) "Argument 2 passed to timezone_offset_get() must implement interface DateTimeInterface, null given" +string(91) "timezone_offset_get(): Argument #2 ($datetime) must be of type DateTimeInterface, int given" -===DONE=== +string(92) "timezone_offset_get(): Argument #2 ($datetime) must be of type DateTimeInterface, null given" diff --git a/ext/date/tests/timezone_open_basic1.phpt b/ext/date/tests/timezone_open_basic1.phpt index ee54b5feb4..306c8e377d 100644 --- a/ext/date/tests/timezone_open_basic1.phpt +++ b/ext/date/tests/timezone_open_basic1.phpt @@ -15,7 +15,6 @@ var_dump( timezone_open("Europe/London") ); var_dump( timezone_open("America/Los_Angeles") ); ?> -===DONE=== --EXPECTF-- *** Testing timezone_open() : basic functionality *** object(DateTimeZone)#%d (2) { @@ -36,4 +35,3 @@ object(DateTimeZone)#%d (2) { ["timezone"]=> string(19) "America/Los_Angeles" } -===DONE=== diff --git a/ext/date/tests/timezone_transitions_get_basic1.phpt b/ext/date/tests/timezone_transitions_get_basic1.phpt index 2fd44a430d..92156d77d1 100644 --- a/ext/date/tests/timezone_transitions_get_basic1.phpt +++ b/ext/date/tests/timezone_transitions_get_basic1.phpt @@ -28,7 +28,6 @@ echo "\n-- Format a sample entry pfor Spring 1963 --\n"; var_dump( $tran[6] ); ?> -===DONE=== --EXPECT-- *** Testing timezone_transitions_get() : basic functionality *** @@ -50,4 +49,3 @@ array(5) { ["abbr"]=> string(3) "BST" } -===DONE=== |