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
+};
+
const zend_function_entry date_funcs_date[] = {
PHP_ME(DateTime, __construct, arginfo_date_create, ZEND_ACC_CTOR|ZEND_ACC_PUBLIC)
PHP_ME(DateTime, __wakeup, NULL, ZEND_ACC_PUBLIC)
const zend_function_entry date_funcs_immutable[] = {
PHP_ME(DateTimeImmutable, __construct, arginfo_date_create, ZEND_ACC_CTOR|ZEND_ACC_PUBLIC)
+ PHP_ME(DateTime, __wakeup, NULL, ZEND_ACC_PUBLIC)
PHP_ME(DateTimeImmutable, __set_state, NULL, 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(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)
/* }}} */
zend_class_entry *date_ce_date, *date_ce_timezone, *date_ce_interval, *date_ce_period;
-zend_class_entry *date_ce_immutable;
+zend_class_entry *date_ce_immutable, *date_ce_interface;
PHPAPI zend_class_entry *php_date_get_date_ce(void)
static void date_register_classes(TSRMLS_D)
{
- zend_class_entry ce_date, ce_immutable, ce_timezone, ce_interval, ce_period;
+ zend_class_entry ce_date, ce_immutable, ce_timezone, ce_interval, ce_period, ce_interface;
+
+ INIT_CLASS_ENTRY(ce_interface, "DateTimeInterface", date_funcs_interface);
+ date_ce_interface = zend_register_internal_interface(&ce_interface TSRMLS_CC);
INIT_CLASS_ENTRY(ce_date, "DateTime", date_funcs_date);
ce_date.create_object = date_object_new_date;
date_object_handlers_date.compare_objects = date_object_compare_date;
date_object_handlers_date.get_properties = date_object_get_properties;
date_object_handlers_date.get_gc = date_object_get_gc;
+ zend_class_implements(date_ce_date TSRMLS_CC, 1, date_ce_interface);
#define REGISTER_DATE_CLASS_CONST_STRING(const_name, value) \
zend_declare_class_constant_stringl(date_ce_date, const_name, sizeof(const_name)-1, value, sizeof(value)-1 TSRMLS_CC);
INIT_CLASS_ENTRY(ce_immutable, "DateTimeImmutable", date_funcs_immutable);
ce_immutable.create_object = date_object_new_date;
- date_ce_immutable = zend_register_internal_class_ex(&ce_immutable, date_ce_date, "DateTime" TSRMLS_CC);
+ date_ce_immutable = zend_register_internal_class_ex(&ce_immutable, NULL, NULL TSRMLS_CC);
memcpy(&date_object_handlers_immutable, zend_get_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.get_properties = date_object_get_properties;
+ zend_class_implements(date_ce_immutable TSRMLS_CC, 1, date_ce_interface);
INIT_CLASS_ENTRY(ce_timezone, "DateTimeZone", date_funcs_timezone);
ce_timezone.create_object = date_object_new_timezone;
myht = Z_OBJPROP_P(object);
if (!php_date_initialize_from_hash(&return_value, &dateobj, myht TSRMLS_CC)) {
- php_error(E_ERROR, "Invalid serialization data for DateTime object");
+ php_error(E_ERROR, "Invalid serialization data for DateTimeInterface object");
}
}
/* }}} */
}
/* }}} */
-/* {{{ proto string date_format(DateTime object, string format)
+/* {{{ proto string date_format(DateTimeInterface object, string format)
Returns date formatted according to given format
*/
PHP_FUNCTION(date_format)
char *format;
int format_len;
- if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os", &object, date_ce_date, &format, &format_len) == FAILURE) {
+ if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os", &object, date_ce_interface, &format, &format_len) == FAILURE) {
RETURN_FALSE;
}
dateobj = (php_date_obj *) zend_object_store_get_object(object TSRMLS_CC);
char *modify;
int modify_len;
- if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os", &object, date_ce_date, &modify, &modify_len) == FAILURE) {
+ if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os", &object, date_ce_immutable, &modify, &modify_len) == FAILURE) {
RETURN_FALSE;
}
{
zval *object, *interval, *new_object;
- if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "OO", &object, date_ce_date, &interval, date_ce_interval) == FAILURE) {
+ if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "OO", &object, date_ce_immutable, &interval, date_ce_interval) == FAILURE) {
RETURN_FALSE;
}
{
zval *object, *interval, *new_object;
- if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "OO", &object, date_ce_date, &interval, date_ce_interval) == FAILURE) {
+ if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "OO", &object, date_ce_immutable, &interval, date_ce_interval) == FAILURE) {
RETURN_FALSE;
}
}
/* }}} */
-/* {{{ proto DateTimeZone date_timezone_get(DateTime object)
+/* {{{ proto DateTimeZone date_timezone_get(DateTimeInterface object)
Return new DateTimeZone object relative to give DateTime
*/
PHP_FUNCTION(date_timezone_get)
php_date_obj *dateobj;
php_timezone_obj *tzobj;
- if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", &object, date_ce_date) == FAILURE) {
+ if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", &object, date_ce_interface) == FAILURE) {
RETURN_FALSE;
}
dateobj = (php_date_obj *) zend_object_store_get_object(object TSRMLS_CC);
zval *object, *new_object;
zval *timezone_object;
- if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "OO", &object, date_ce_date, &timezone_object, date_ce_timezone) == FAILURE) {
+ if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "OO", &object, date_ce_immutable, &timezone_object, date_ce_timezone) == FAILURE) {
RETURN_FALSE;
}
}
/* }}} */
-/* {{{ proto long date_offset_get(DateTime object)
+/* {{{ proto long date_offset_get(DateTimeInterface object)
Returns the DST offset.
*/
PHP_FUNCTION(date_offset_get)
php_date_obj *dateobj;
timelib_time_offset *offset;
- if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", &object, date_ce_date) == FAILURE) {
+ if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", &object, date_ce_interface) == FAILURE) {
RETURN_FALSE;
}
dateobj = (php_date_obj *) zend_object_store_get_object(object TSRMLS_CC);
zval *object, *new_object;
long h, i, s = 0;
- if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Oll|l", &object, date_ce_date, &h, &i, &s) == FAILURE) {
+ if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Oll|l", &object, date_ce_immutable, &h, &i, &s) == FAILURE) {
RETURN_FALSE;
}
zval *object, *new_object;
long y, m, d;
- if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Olll", &object, date_ce_date, &y, &m, &d) == FAILURE) {
+ if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Olll", &object, date_ce_immutable, &y, &m, &d) == FAILURE) {
RETURN_FALSE;
}
zval *object, *new_object;
long y, w, d = 1;
- if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Oll|l", &object, date_ce_date, &y, &w, &d) == FAILURE) {
+ if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Oll|l", &object, date_ce_immutable, &y, &w, &d) == FAILURE) {
RETURN_FALSE;
}
zval *object, *new_object;
long timestamp;
- if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Ol", &object, date_ce_date, ×tamp) == FAILURE) {
+ if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Ol", &object, date_ce_immutable, ×tamp) == FAILURE) {
RETURN_FALSE;
}
}
/* }}} */
-/* {{{ proto long date_timestamp_get(DateTime object)
+/* {{{ proto long date_timestamp_get(DateTimeInterface object)
Gets the Unix timestamp.
*/
PHP_FUNCTION(date_timestamp_get)
long timestamp;
int error;
- if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", &object, date_ce_date) == FAILURE) {
+ if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", &object, date_ce_interface) == FAILURE) {
RETURN_FALSE;
}
dateobj = (php_date_obj *) zend_object_store_get_object(object TSRMLS_CC);
zend_error_handling error_handling;
zend_replace_error_handling(EH_THROW, NULL, &error_handling TSRMLS_CC);
- if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, "OOl|l", &start, date_ce_date, &interval, date_ce_interval, &recurrences, &options) == FAILURE) {
- if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, "OOO|l", &start, date_ce_date, &interval, date_ce_interval, &end, date_ce_date, &options) == FAILURE) {
+ if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, "OOl|l", &start, date_ce_interface, &interval, date_ce_interval, &recurrences, &options) == FAILURE) {
+ if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, "OOO|l", &start, date_ce_interface, &interval, date_ce_interval, &end, date_ce_date, &options) == FAILURE) {
if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, "s|l", &isostr, &isostr_len, &options) == FAILURE) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "This constructor accepts either (DateTime, DateInterval, int) OR (DateTime, DateInterval, DateTime) OR (string) as arguments.");
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "This constructor accepts either (DateTimeInterface, DateInterval, int) OR (DateTimeInterface, DateInterval, DateTime) OR (string) as arguments.");
zend_restore_error_handling(&error_handling TSRMLS_CC);
return;
}
new DatePeriod();
?>
--EXPECTF--
-Fatal error: Uncaught exception 'Exception' with message 'DatePeriod::__construct(): This constructor accepts either (DateTime, DateInterval, int) OR (DateTime, DateInterval, DateTime) OR (string) as arguments.' in %s:%d
+Fatal error: Uncaught exception 'Exception' with message 'DatePeriod::__construct(): This constructor accepts either (DateTimeInterface, DateInterval, int) OR (DateTimeInterface, DateInterval, DateTime) OR (string) as arguments.' in %s:%d
Stack trace:
#0 %s(%d): DatePeriod->__construct()
#1 {main}
- thrown in %s on line %d
\ No newline at end of file
+ thrown in %s on line %d
-- Testing date_create() function with an invalid values for $object argument --
-Warning: date_format() expects parameter 1 to be DateTime, object given in %sp on line %d
+Warning: date_format() expects parameter 1 to be DateTimeInterface, object given in %sp on line %d
bool(false)
-Warning: date_format() expects parameter 1 to be DateTime, integer given in %s on line %d
+Warning: date_format() expects parameter 1 to be DateTimeInterface, integer given in %s on line %d
bool(false)
-Warning: date_format() expects parameter 1 to be DateTime, null given in %s on line %d
+Warning: date_format() expects parameter 1 to be DateTimeInterface, null given in %s on line %d
bool(false)
===DONE===
Test date_format() function : usage variation - Passing unexpected values to first argument $object.
--FILE--
<?php
-/* Prototype : string date_format ( DateTime $object , string $format )
+/* Prototype : string date_format ( DateTimeInterface $object , string $format )
* Description: Returns date formatted according to given format
* Source code: ext/date/php_date.c
- * Alias to functions: DateTime::format
+ * Alias to functions: DateTimeInterface::format
*/
echo "*** Testing date_format() : usage variation - unexpected values to first argument \$object***\n";
-- int 0 --
-Warning: date_format() expects parameter 1 to be DateTime, integer given in %s on line %d
+Warning: date_format() expects parameter 1 to be DateTimeInterface, integer given in %s on line %d
bool(false)
-- int 1 --
-Warning: date_format() expects parameter 1 to be DateTime, integer given in %s on line %d
+Warning: date_format() expects parameter 1 to be DateTimeInterface, integer given in %s on line %d
bool(false)
-- int 12345 --
-Warning: date_format() expects parameter 1 to be DateTime, integer given in %s on line %d
+Warning: date_format() expects parameter 1 to be DateTimeInterface, integer given in %s on line %d
bool(false)
-- int -12345 --
-Warning: date_format() expects parameter 1 to be DateTime, integer given in %s on line %d
+Warning: date_format() expects parameter 1 to be DateTimeInterface, integer given in %s on line %d
bool(false)
-- float 10.5 --
-Warning: date_format() expects parameter 1 to be DateTime, double given in %s on line %d
+Warning: date_format() expects parameter 1 to be DateTimeInterface, double given in %s on line %d
bool(false)
-- float -10.5 --
-Warning: date_format() expects parameter 1 to be DateTime, double given in %s on line %d
+Warning: date_format() expects parameter 1 to be DateTimeInterface, double given in %s on line %d
bool(false)
-- float .5 --
-Warning: date_format() expects parameter 1 to be DateTime, double given in %s on line %d
+Warning: date_format() expects parameter 1 to be DateTimeInterface, double given in %s on line %d
bool(false)
-- empty array --
-Warning: date_format() expects parameter 1 to be DateTime, array given in %s on line %d
+Warning: date_format() expects parameter 1 to be DateTimeInterface, array given in %s on line %d
bool(false)
-- int indexed array --
-Warning: date_format() expects parameter 1 to be DateTime, array given in %s on line %d
+Warning: date_format() expects parameter 1 to be DateTimeInterface, array given in %s on line %d
bool(false)
-- associative array --
-Warning: date_format() expects parameter 1 to be DateTime, array given in %s on line %d
+Warning: date_format() expects parameter 1 to be DateTimeInterface, array given in %s on line %d
bool(false)
-- nested arrays --
-Warning: date_format() expects parameter 1 to be DateTime, array given in %s on line %d
+Warning: date_format() expects parameter 1 to be DateTimeInterface, array given in %s on line %d
bool(false)
-- uppercase NULL --
-Warning: date_format() expects parameter 1 to be DateTime, null given in %s on line %d
+Warning: date_format() expects parameter 1 to be DateTimeInterface, null given in %s on line %d
bool(false)
-- lowercase null --
-Warning: date_format() expects parameter 1 to be DateTime, null given in %s on line %d
+Warning: date_format() expects parameter 1 to be DateTimeInterface, null given in %s on line %d
bool(false)
-- lowercase true --
-Warning: date_format() expects parameter 1 to be DateTime, boolean given in %s on line %d
+Warning: date_format() expects parameter 1 to be DateTimeInterface, boolean given in %s on line %d
bool(false)
-- lowercase false --
-Warning: date_format() expects parameter 1 to be DateTime, boolean given in %s on line %d
+Warning: date_format() expects parameter 1 to be DateTimeInterface, boolean given in %s on line %d
bool(false)
-- uppercase TRUE --
-Warning: date_format() expects parameter 1 to be DateTime, boolean given in %s on line %d
+Warning: date_format() expects parameter 1 to be DateTimeInterface, boolean given in %s on line %d
bool(false)
-- uppercase FALSE --
-Warning: date_format() expects parameter 1 to be DateTime, boolean given in %s on line %d
+Warning: date_format() expects parameter 1 to be DateTimeInterface, boolean given in %s on line %d
bool(false)
-- empty string DQ --
-Warning: date_format() expects parameter 1 to be DateTime, string given in %s on line %d
+Warning: date_format() expects parameter 1 to be DateTimeInterface, string given in %s on line %d
bool(false)
-- empty string SQ --
-Warning: date_format() expects parameter 1 to be DateTime, string given in %s on line %d
+Warning: date_format() expects parameter 1 to be DateTimeInterface, string given in %s on line %d
bool(false)
-- string DQ --
-Warning: date_format() expects parameter 1 to be DateTime, string given in %s on line %d
+Warning: date_format() expects parameter 1 to be DateTimeInterface, string given in %s on line %d
bool(false)
-- string SQ --
-Warning: date_format() expects parameter 1 to be DateTime, string given in %s on line %d
+Warning: date_format() expects parameter 1 to be DateTimeInterface, string given in %s on line %d
bool(false)
-- mixed case string --
-Warning: date_format() expects parameter 1 to be DateTime, string given in %s on line %d
+Warning: date_format() expects parameter 1 to be DateTimeInterface, string given in %s on line %d
bool(false)
-- heredoc --
-Warning: date_format() expects parameter 1 to be DateTime, string given in %s on line %d
+Warning: date_format() expects parameter 1 to be DateTimeInterface, string given in %s on line %d
bool(false)
-- instance of classWithToString --
-Warning: date_format() expects parameter 1 to be DateTime, object given in %s on line %d
+Warning: date_format() expects parameter 1 to be DateTimeInterface, object given in %s on line %d
bool(false)
-- instance of classWithoutToString --
-Warning: date_format() expects parameter 1 to be DateTime, object given in %s on line %d
+Warning: date_format() expects parameter 1 to be DateTimeInterface, object given in %s on line %d
bool(false)
-- undefined var --
-Warning: date_format() expects parameter 1 to be DateTime, null given in %s on line %d
+Warning: date_format() expects parameter 1 to be DateTimeInterface, null given in %s on line %d
bool(false)
-- unset var --
-Warning: date_format() expects parameter 1 to be DateTime, null given in %s on line %d
+Warning: date_format() expects parameter 1 to be DateTimeInterface, null given in %s on line %d
bool(false)
-- resource --
-Warning: date_format() expects parameter 1 to be DateTime, resource given in %s on line %d
+Warning: date_format() expects parameter 1 to be DateTimeInterface, resource given in %s on line %d
bool(false)
===DONE===
--FILE--
<?php
-/* Prototype : int date_offset_get ( DateTime $object )
+/* Prototype : int date_offset_get ( DateTimeInterface $object )
* Description: Returns the daylight saving time offset
* Source code: ext/date/php_date.c
- * Alias to functions: DateTime::getOffset
+ * Alias to functions: DateTimeInterface::getOffset
*/
//Set the default time zone
-- Testing date_offset_get() function with an invalid values for $object argument --
-Warning: date_offset_get() expects parameter 1 to be DateTime, object given in %s on line %d
+Warning: date_offset_get() expects parameter 1 to be DateTimeInterface, object given in %s on line %d
bool(false)
-Warning: date_offset_get() expects parameter 1 to be DateTime, integer given in %s on line %d
+Warning: date_offset_get() expects parameter 1 to be DateTimeInterface, integer given in %s on line %d
bool(false)
-Warning: date_offset_get() expects parameter 1 to be DateTime, null given in %s on line %d
+Warning: date_offset_get() expects parameter 1 to be DateTimeInterface, null given in %s on line %d
bool(false)
===DONE===
Test date_offset_get() function : usage variation - Passing unexpected values to first argument $object.
--FILE--
<?php
-/* Prototype : int date_offset_get ( DateTime $object )
+/* Prototype : int date_offset_get ( DateTimeInterface $object )
* Description: Returns the daylight saving time offset
* Source code: ext/date/php_date.c
- * Alias to functions: DateTime::getOffset
+ * Alias to functions: DateTimeInterface::getOffset
*/
echo "*** Testing date_offset_get() : usage variation - unexpected values to first argument \$object***\n";
-- int 0 --
-Warning: date_offset_get() expects parameter 1 to be DateTime, integer given in %s on line %d
+Warning: date_offset_get() expects parameter 1 to be DateTimeInterface, integer given in %s on line %d
bool(false)
-- int 1 --
-Warning: date_offset_get() expects parameter 1 to be DateTime, integer given in %s on line %d
+Warning: date_offset_get() expects parameter 1 to be DateTimeInterface, integer given in %s on line %d
bool(false)
-- int 12345 --
-Warning: date_offset_get() expects parameter 1 to be DateTime, integer given in %s on line %d
+Warning: date_offset_get() expects parameter 1 to be DateTimeInterface, integer given in %s on line %d
bool(false)
-- int -12345 --
-Warning: date_offset_get() expects parameter 1 to be DateTime, integer given in %s on line %d
+Warning: date_offset_get() expects parameter 1 to be DateTimeInterface, integer given in %s on line %d
bool(false)
-- float 10.5 --
-Warning: date_offset_get() expects parameter 1 to be DateTime, double given in %s on line %d
+Warning: date_offset_get() expects parameter 1 to be DateTimeInterface, double given in %s on line %d
bool(false)
-- float -10.5 --
-Warning: date_offset_get() expects parameter 1 to be DateTime, double given in %s on line %d
+Warning: date_offset_get() expects parameter 1 to be DateTimeInterface, double given in %s on line %d
bool(false)
-- float .5 --
-Warning: date_offset_get() expects parameter 1 to be DateTime, double given in %s on line %d
+Warning: date_offset_get() expects parameter 1 to be DateTimeInterface, double given in %s on line %d
bool(false)
-- empty array --
-Warning: date_offset_get() expects parameter 1 to be DateTime, array given in %s on line %d
+Warning: date_offset_get() expects parameter 1 to be DateTimeInterface, array given in %s on line %d
bool(false)
-- int indexed array --
-Warning: date_offset_get() expects parameter 1 to be DateTime, array given in %s on line %d
+Warning: date_offset_get() expects parameter 1 to be DateTimeInterface, array given in %s on line %d
bool(false)
-- associative array --
-Warning: date_offset_get() expects parameter 1 to be DateTime, array given in %s on line %d
+Warning: date_offset_get() expects parameter 1 to be DateTimeInterface, array given in %s on line %d
bool(false)
-- nested arrays --
-Warning: date_offset_get() expects parameter 1 to be DateTime, array given in %s on line %d
+Warning: date_offset_get() expects parameter 1 to be DateTimeInterface, array given in %s on line %d
bool(false)
-- uppercase NULL --
-Warning: date_offset_get() expects parameter 1 to be DateTime, null given in %s on line %d
+Warning: date_offset_get() expects parameter 1 to be DateTimeInterface, null given in %s on line %d
bool(false)
-- lowercase null --
-Warning: date_offset_get() expects parameter 1 to be DateTime, null given in %s on line %d
+Warning: date_offset_get() expects parameter 1 to be DateTimeInterface, null given in %s on line %d
bool(false)
-- lowercase true --
-Warning: date_offset_get() expects parameter 1 to be DateTime, boolean given in %s on line %d
+Warning: date_offset_get() expects parameter 1 to be DateTimeInterface, boolean given in %s on line %d
bool(false)
-- lowercase false --
-Warning: date_offset_get() expects parameter 1 to be DateTime, boolean given in %s on line %d
+Warning: date_offset_get() expects parameter 1 to be DateTimeInterface, boolean given in %s on line %d
bool(false)
-- uppercase TRUE --
-Warning: date_offset_get() expects parameter 1 to be DateTime, boolean given in %s on line %d
+Warning: date_offset_get() expects parameter 1 to be DateTimeInterface, boolean given in %s on line %d
bool(false)
-- uppercase FALSE --
-Warning: date_offset_get() expects parameter 1 to be DateTime, boolean given in %s on line %d
+Warning: date_offset_get() expects parameter 1 to be DateTimeInterface, boolean given in %s on line %d
bool(false)
-- empty string DQ --
-Warning: date_offset_get() expects parameter 1 to be DateTime, string given in %s on line %d
+Warning: date_offset_get() expects parameter 1 to be DateTimeInterface, string given in %s on line %d
bool(false)
-- empty string SQ --
-Warning: date_offset_get() expects parameter 1 to be DateTime, string given in %s on line %d
+Warning: date_offset_get() expects parameter 1 to be DateTimeInterface, string given in %s on line %d
bool(false)
-- string DQ --
-Warning: date_offset_get() expects parameter 1 to be DateTime, string given in %s on line %d
+Warning: date_offset_get() expects parameter 1 to be DateTimeInterface, string given in %s on line %d
bool(false)
-- string SQ --
-Warning: date_offset_get() expects parameter 1 to be DateTime, string given in %s on line %d
+Warning: date_offset_get() expects parameter 1 to be DateTimeInterface, string given in %s on line %d
bool(false)
-- mixed case string --
-Warning: date_offset_get() expects parameter 1 to be DateTime, string given in %s on line %d
+Warning: date_offset_get() expects parameter 1 to be DateTimeInterface, string given in %s on line %d
bool(false)
-- heredoc --
-Warning: date_offset_get() expects parameter 1 to be DateTime, string given in %s on line %d
+Warning: date_offset_get() expects parameter 1 to be DateTimeInterface, string given in %s on line %d
bool(false)
-- instance of classWithToString --
-Warning: date_offset_get() expects parameter 1 to be DateTime, object given in %s on line %d
+Warning: date_offset_get() expects parameter 1 to be DateTimeInterface, object given in %s on line %d
bool(false)
-- instance of classWithoutToString --
-Warning: date_offset_get() expects parameter 1 to be DateTime, object given in %s on line %d
+Warning: date_offset_get() expects parameter 1 to be DateTimeInterface, object given in %s on line %d
bool(false)
-- undefined var --
-Warning: date_offset_get() expects parameter 1 to be DateTime, null given in %s on line %d
+Warning: date_offset_get() expects parameter 1 to be DateTimeInterface, null given in %s on line %d
bool(false)
-- unset var --
-Warning: date_offset_get() expects parameter 1 to be DateTime, null given in %s on line %d
+Warning: date_offset_get() expects parameter 1 to be DateTimeInterface, null given in %s on line %d
bool(false)
-- resource --
-Warning: date_offset_get() expects parameter 1 to be DateTime, resource given in %s on line %d
+Warning: date_offset_get() expects parameter 1 to be DateTimeInterface, resource given in %s on line %d
bool(false)
===DONE===
-Warning: date_timestamp_get() expects parameter 1 to be DateTime, integer given in %s on line %d
\ No newline at end of file
+Warning: date_timestamp_get() expects parameter 1 to be DateTimeInterface, integer given in %s on line %d
Test date_timezone_get() function : error conditions
--FILE--
<?php
-/* Prototype : DateTimeZone date_timezone_get ( DateTime $object )
- * Description: Return time zone relative to given DateTime
+/* Prototype : DateTimeZone date_timezone_get ( DateTimeInterface $object )
+ * Description: Return time zone relative to given DateTimeInterface
* Source code: ext/date/php_date.c
- * Alias to functions: DateTime::getTimezone
+ * Alias to functions: DateTimeInterface::getTimezone
*/
// Set timezone
-- Testing date_timezone_get() function with an invalid values for $object argument --
-Warning: date_timezone_get() expects parameter 1 to be DateTime, object given in %s on line %d
+Warning: date_timezone_get() expects parameter 1 to be DateTimeInterface, object given in %s on line %d
bool(false)
-Warning: date_timezone_get() expects parameter 1 to be DateTime, integer given in %s on line %d
+Warning: date_timezone_get() expects parameter 1 to be DateTimeInterface, integer given in %s on line %d
bool(false)
-Warning: date_timezone_get() expects parameter 1 to be DateTime, null given in %s on line %d
+Warning: date_timezone_get() expects parameter 1 to be DateTimeInterface, null given in %s on line %d
bool(false)
===DONE===
Test date_timezone_get() function : usage variation - Passing unexpected values to first argument $object.
--FILE--
<?php
-/* Prototype : DateTimeZone date_timezone_get ( DateTime $object )
- * Description: Return time zone relative to given DateTime
+/* Prototype : DateTimeZone date_timezone_get ( DateTimeInterface $object )
+ * Description: Return time zone relative to given DateTimeInterface
* Source code: ext/date/php_date.c
- * Alias to functions: DateTime::getTimezone
+ * Alias to functions: DateTimeInterface::getTimezone
*/
echo "*** Testing date_timezone_get() : usage variation - unexpected values to first argument \$object***\n";
-- int 0 --
-Warning: date_timezone_get() expects parameter 1 to be DateTime, integer given in %s on line %d
+Warning: date_timezone_get() expects parameter 1 to be DateTimeInterface, integer given in %s on line %d
bool(false)
-- int 1 --
-Warning: date_timezone_get() expects parameter 1 to be DateTime, integer given in %s on line %d
+Warning: date_timezone_get() expects parameter 1 to be DateTimeInterface, integer given in %s on line %d
bool(false)
-- int 12345 --
-Warning: date_timezone_get() expects parameter 1 to be DateTime, integer given in %s on line %d
+Warning: date_timezone_get() expects parameter 1 to be DateTimeInterface, integer given in %s on line %d
bool(false)
-- int -12345 --
-Warning: date_timezone_get() expects parameter 1 to be DateTime, integer given in %s on line %d
+Warning: date_timezone_get() expects parameter 1 to be DateTimeInterface, integer given in %s on line %d
bool(false)
-- float 10.5 --
-Warning: date_timezone_get() expects parameter 1 to be DateTime, double given in %s on line %d
+Warning: date_timezone_get() expects parameter 1 to be DateTimeInterface, double given in %s on line %d
bool(false)
-- float -10.5 --
-Warning: date_timezone_get() expects parameter 1 to be DateTime, double given in %s on line %d
+Warning: date_timezone_get() expects parameter 1 to be DateTimeInterface, double given in %s on line %d
bool(false)
-- float .5 --
-Warning: date_timezone_get() expects parameter 1 to be DateTime, double given in %s on line %d
+Warning: date_timezone_get() expects parameter 1 to be DateTimeInterface, double given in %s on line %d
bool(false)
-- empty array --
-Warning: date_timezone_get() expects parameter 1 to be DateTime, array given in %s on line %d
+Warning: date_timezone_get() expects parameter 1 to be DateTimeInterface, array given in %s on line %d
bool(false)
-- int indexed array --
-Warning: date_timezone_get() expects parameter 1 to be DateTime, array given in %s on line %d
+Warning: date_timezone_get() expects parameter 1 to be DateTimeInterface, array given in %s on line %d
bool(false)
-- associative array --
-Warning: date_timezone_get() expects parameter 1 to be DateTime, array given in %s on line %d
+Warning: date_timezone_get() expects parameter 1 to be DateTimeInterface, array given in %s on line %d
bool(false)
-- nested arrays --
-Warning: date_timezone_get() expects parameter 1 to be DateTime, array given in %s on line %d
+Warning: date_timezone_get() expects parameter 1 to be DateTimeInterface, array given in %s on line %d
bool(false)
-- uppercase NULL --
-Warning: date_timezone_get() expects parameter 1 to be DateTime, null given in %s on line %d
+Warning: date_timezone_get() expects parameter 1 to be DateTimeInterface, null given in %s on line %d
bool(false)
-- lowercase null --
-Warning: date_timezone_get() expects parameter 1 to be DateTime, null given in %s on line %d
+Warning: date_timezone_get() expects parameter 1 to be DateTimeInterface, null given in %s on line %d
bool(false)
-- lowercase true --
-Warning: date_timezone_get() expects parameter 1 to be DateTime, boolean given in %s on line %d
+Warning: date_timezone_get() expects parameter 1 to be DateTimeInterface, boolean given in %s on line %d
bool(false)
-- lowercase false --
-Warning: date_timezone_get() expects parameter 1 to be DateTime, boolean given in %s on line %d
+Warning: date_timezone_get() expects parameter 1 to be DateTimeInterface, boolean given in %s on line %d
bool(false)
-- uppercase TRUE --
-Warning: date_timezone_get() expects parameter 1 to be DateTime, boolean given in %s on line %d
+Warning: date_timezone_get() expects parameter 1 to be DateTimeInterface, boolean given in %s on line %d
bool(false)
-- uppercase FALSE --
-Warning: date_timezone_get() expects parameter 1 to be DateTime, boolean given in %s on line %d
+Warning: date_timezone_get() expects parameter 1 to be DateTimeInterface, boolean given in %s on line %d
bool(false)
-- empty string DQ --
-Warning: date_timezone_get() expects parameter 1 to be DateTime, string given in %s on line %d
+Warning: date_timezone_get() expects parameter 1 to be DateTimeInterface, string given in %s on line %d
bool(false)
-- empty string SQ --
-Warning: date_timezone_get() expects parameter 1 to be DateTime, string given in %s on line %d
+Warning: date_timezone_get() expects parameter 1 to be DateTimeInterface, string given in %s on line %d
bool(false)
-- string DQ --
-Warning: date_timezone_get() expects parameter 1 to be DateTime, string given in %s on line %d
+Warning: date_timezone_get() expects parameter 1 to be DateTimeInterface, string given in %s on line %d
bool(false)
-- string SQ --
-Warning: date_timezone_get() expects parameter 1 to be DateTime, string given in %s on line %d
+Warning: date_timezone_get() expects parameter 1 to be DateTimeInterface, string given in %s on line %d
bool(false)
-- mixed case string --
-Warning: date_timezone_get() expects parameter 1 to be DateTime, string given in %s on line %d
+Warning: date_timezone_get() expects parameter 1 to be DateTimeInterface, string given in %s on line %d
bool(false)
-- heredoc --
-Warning: date_timezone_get() expects parameter 1 to be DateTime, string given in %s on line %d
+Warning: date_timezone_get() expects parameter 1 to be DateTimeInterface, string given in %s on line %d
bool(false)
-- instance of classWithToString --
-Warning: date_timezone_get() expects parameter 1 to be DateTime, object given in %s on line %d
+Warning: date_timezone_get() expects parameter 1 to be DateTimeInterface, object given in %s on line %d
bool(false)
-- instance of classWithoutToString --
-Warning: date_timezone_get() expects parameter 1 to be DateTime, object given in %s on line %d
+Warning: date_timezone_get() expects parameter 1 to be DateTimeInterface, object given in %s on line %d
bool(false)
-- undefined var --
-Warning: date_timezone_get() expects parameter 1 to be DateTime, null given in %s on line %d
+Warning: date_timezone_get() expects parameter 1 to be DateTimeInterface, null given in %s on line %d
bool(false)
-- unset var --
-Warning: date_timezone_get() expects parameter 1 to be DateTime, null given in %s on line %d
+Warning: date_timezone_get() expects parameter 1 to be DateTimeInterface, null given in %s on line %d
bool(false)
-- resource --
-Warning: date_timezone_get() expects parameter 1 to be DateTime, resource given in %s on line %d
+Warning: date_timezone_get() expects parameter 1 to be DateTimeInterface, resource given in %s on line %d
bool(false)
===DONE===