[php-src] PR #25878: Fix NULL pointer dereference in intl_datetime_decompose() for uninitialized DateTime subclass

From: Date: Sat, 28 Nov 2026 17:18:43 +0000
Subject: [php-src] PR #25878: Fix NULL pointer dereference in intl_datetime_decompose() for uninitialized DateTime subclass
Groups: php.git-pulls 
Request: Send a blank email to git-pulls+get-41165@lists.php.net to get a copy of this message
Pull Request: https://github.com/php/php-src/pull/25878 Author: hohphu8 In intl_datetime_decompose() (ext/intl/common/common_date.cpp), the if (millis) block dereferences datetime->time->us without checking whether datetime->time is initialized (unlike the if (tz) block immediately below it). A DateTime subclass that skips parent::__construct() and overrides getTimestamp() to return an int causes a NULL pointer dereference when passed to IntlDateFormatter::formatObject() or IntlDateFormatter::format(). Check if (!datetime->time) before accessing datetime->time->us and report U_ILLEGAL_ARGUMENT_ERROR consistently with the if (tz) branch, while preserving existing getTimestamp() error behavior for subclasses that do not override it. Added a regression test covering both IntlDateFormatter::formatObject() and IntlDateFormatter::format(). Note: AI-assisted code audit; manually verified and reproduced locally.

« previous php.git-pulls (#41165) next »