Commit 77a9d6dc81c for php

commit 77a9d6dc81c7d6da58dfc54f8709650271c52604
Author: Derick Rethans <github@derickrethans.nl>
Date:   Wed Dec 2 17:28:26 2026 +0000

    DateTimeZone->getTransitions() includes too-early results on 32-bit platforms (#26033)

    * DateTimeZone->getTransitions() includes too-early results on 32-bit platforms

    Closes GH-26032

    * Fixed additional test

diff --git a/NEWS b/NEWS
index 91c21c38d7f..07f7e7528a4 100644
--- a/NEWS
+++ b/NEWS
@@ -10,6 +10,10 @@ PHP                                                                        NEWS
   . Fixed bug GH-25959 ("consumed" stream filter loses or repeats data).
     (Artem Ukrainskiy)

+- Date:
+  . Fixed bug GH-26032 (DateTimeZone->getTransitions() includes too-early
+    results on 32-bit platforms, which are then garbled). (Derick)
+

 17 Dec 2026, PHP 8.4.29

diff --git a/ext/date/php_date.c b/ext/date/php_date.c
index 7b8fec3d2da..0e1bad7e32a 100644
--- a/ext/date/php_date.c
+++ b/ext/date/php_date.c
@@ -4444,7 +4444,9 @@ PHP_FUNCTION(timezone_transitions_get)
 	} else {
 		for (uint64_t i = begin; i < tzobj->tzi.tz->bit64.timecnt; ++i) {
 			if (tzobj->tzi.tz->trans[i] < timestamp_end) {
-				add(i, tzobj->tzi.tz->trans[i]);
+				if (tzobj->tzi.tz->trans[i] > timestamp_begin) {
+					add(i, tzobj->tzi.tz->trans[i]);
+				}
 			} else {
 				return;
 			}
diff --git a/ext/date/tests/bug80963.phpt b/ext/date/tests/bug80963.phpt
index c7f02a7397f..c0e57536063 100644
--- a/ext/date/tests/bug80963.phpt
+++ b/ext/date/tests/bug80963.phpt
@@ -27,7 +27,7 @@
   ["abbr"]=>
   string(3) "GMT"
 }
-int(237)
+int(23%d)
 array(5) {
   ["ts"]=>
   int(2140668000)
@@ -40,7 +40,7 @@
   ["abbr"]=>
   string(3) "EST"
 }
-int(144)
+int(14%d)
 array(5) {
   ["ts"]=>
   int(2140045200)
diff --git a/ext/date/tests/gh26032.phpt b/ext/date/tests/gh26032.phpt
new file mode 100644
index 00000000000..6c0cf56e88c
--- /dev/null
+++ b/ext/date/tests/gh26032.phpt
@@ -0,0 +1,42 @@
+--TEST--
+DateTimeZone::getTransitions() early results on 32-bit platforms
+--SKIPIF--
+<?php if (PHP_INT_SIZE != 4) die("skip 32-bit only"); ?>
+--FILE--
+<?php
+$timezone = new DateTimeZone("Europe/London");
+$transitions = $timezone->getTransitions();
+print_r(array_slice($transitions, 0, 3));
+?>
+--EXPECT--
+Array
+(
+    [0] => Array
+        (
+            [ts] => -2147483648
+            [time] => 1901-12-13T20:45:52+00:00
+            [offset] => -75
+            [isdst] =>
+            [abbr] => LMT
+        )
+
+    [1] => Array
+        (
+            [ts] => -1691964000
+            [time] => 1916-05-21T02:00:00+00:00
+            [offset] => 3600
+            [isdst] => 1
+            [abbr] => BST
+        )
+
+    [2] => Array
+        (
+            [ts] => -1680472800
+            [time] => 1916-10-01T02:00:00+00:00
+            [offset] => 0
+            [isdst] =>
+            [abbr] => GMT
+        )
+
+)
+