From: Nikita Popov Date: Thu, 8 Aug 2019 07:55:29 +0000 (+0200) Subject: Fixed bug #78383 X-Git-Tag: php-7.4.0beta4~48 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=fc17bfaacfd48b3952652792bf684ff223499678;p=php Fixed bug #78383 --- diff --git a/NEWS b/NEWS index 997e19c95c..21c109430f 100644 --- a/NEWS +++ b/NEWS @@ -2,6 +2,9 @@ PHP NEWS ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| ?? ??? ????, PHP 7.4.0beta3 +- Date: + . Fixed bug #78383 (Casting a DateTime to array no longer returns its + properties). (Nikita) 08 Aug 2019, PHP 7.4.0beta2 diff --git a/ext/date/php_date.c b/ext/date/php_date.c index e7c68954bb..7898a05ca7 100644 --- a/ext/date/php_date.c +++ b/ext/date/php_date.c @@ -2293,6 +2293,7 @@ static HashTable *date_object_get_properties_for(zval *object, zend_prop_purpose case ZEND_PROP_PURPOSE_SERIALIZE: case ZEND_PROP_PURPOSE_VAR_EXPORT: case ZEND_PROP_PURPOSE_JSON: + case ZEND_PROP_PURPOSE_ARRAY_CAST: break; default: return zend_std_get_properties_for(object, purpose); @@ -2414,6 +2415,7 @@ static HashTable *date_object_get_properties_for_timezone(zval *object, zend_pro case ZEND_PROP_PURPOSE_SERIALIZE: case ZEND_PROP_PURPOSE_VAR_EXPORT: case ZEND_PROP_PURPOSE_JSON: + case ZEND_PROP_PURPOSE_ARRAY_CAST: break; default: return zend_std_get_properties_for(object, purpose); diff --git a/ext/date/tests/bug78383.phpt b/ext/date/tests/bug78383.phpt new file mode 100644 index 0000000000..78d4617fb0 --- /dev/null +++ b/ext/date/tests/bug78383.phpt @@ -0,0 +1,24 @@ +--TEST-- +Bug #78383: Casting a DateTime to array no longer returns its properties +--FILE-- + +--EXPECT-- +array(3) { + ["date"]=> + string(26) "2000-01-01 00:00:00.000000" + ["timezone_type"]=> + int(3) + ["timezone"]=> + string(3) "UTC" +} +array(2) { + ["timezone_type"]=> + int(3) + ["timezone"]=> + string(13) "Europe/Berlin" +}