Commit 032b2d392de for php.net
commit 032b2d392de231c0cdbbc886be5f00fa59dc98c1
Author: Derick Rethans <github@derickrethans.nl>
Date: Fri Jul 10 16:52:26 2026 +0100
Fixed __debugInfo() usage on PHP 8.5 and later for DatePeriod (#22677)
diff --git a/ext/date/php_date.c b/ext/date/php_date.c
index bcf4bcdded0..ad4b4a51101 100644
--- a/ext/date/php_date.c
+++ b/ext/date/php_date.c
@@ -6076,6 +6076,17 @@ static zval *date_period_get_property_ptr_ptr(zend_object *object, zend_string *
static HashTable *date_period_get_properties_for(zend_object *object, zend_prop_purpose purpose)
{
+ if (purpose == ZEND_PROP_PURPOSE_DEBUG) {
+ if (object->ce->__debugInfo) {
+ int is_temp = 0;
+ HashTable *ht = zend_std_get_debug_info(object, &is_temp);
+ if (ht && !is_temp) {
+ GC_TRY_ADDREF(ht);
+ }
+ return ht;
+ }
+ }
+
php_period_obj *period_obj = php_period_obj_from_obj(object);
HashTable *props = zend_array_dup(zend_std_get_properties(object));
if (!period_obj->initialized) {