Bug #78383 [Com]: Casting a \Datetime to array no longer returns it properties

From: Date: Wed, 07 Aug 2019 16:02:26 +0000
Subject: Bug #78383 [Com]: Casting a \Datetime to array no longer returns it properties
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-222122@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=78383&edit=1 ID: 78383 Comment by: duncan3dc@php.net Reported by: jeremy at derusse dot com Summary: Casting a \Datetime to array no longer returns it properties Status: Open Type: Bug Package: Date/time related Operating System: Linux PHP Version: 7.4.0beta1 Block user comment: N Private report: N New Comment: Casting to an array is undefined, see here: https://www.php.net/manual/en/language.types.type-juggling.php ("The behaviour of an automatic conversion to array is currently undefined") Previous Comments: ------------------------------------------------------------------------ [2019-08-07 13:03:07] jeremy at derusse dot com Description: ------------ Casting an instance of \Datetime to an array should return date's properties. Since PHP 7.4, the array is empty. see https://3v4l.org/epBRn Test script: --------------- var_dump((array) new \Datetime('2000-01-01')); Expected result: ---------------- array(3) { ["date"]=> string(26) "2000-01-01 00:00:00.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } Actual result: -------------- array(0) { } ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=78383&edit=1

« previous php.bugs (#222122) next »