| 
        php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login | 
 PatchesPull Requests
Pull requests: 
 HistoryAllCommentsChangesGit/SVN commits             
             [2018-01-14 13:07 UTC] gmblar+php at gmail dot com
 
-Status: Open
+Status: Closed
  [2018-01-14 13:07 UTC] gmblar+php at gmail dot com
  | 
    |||||||||||||||||||||||||||
            
                 
                Copyright © 2001-2025 The PHP GroupAll rights reserved.  | 
        Last updated: Tue Nov 04 04:00:01 2025 UTC | 
Description: ------------ getTransitions is slow with large negative or positive values. With the default values PHP_INT_MIN and PHP_INT_MAX the function takes a very long time. Test script: --------------- <?php function measure_duration(callable $callback) { $start = microtime(true); call_user_func($callback); $duration = microtime(true) - $start; printf("Duration: %s\n\n", number_format($duration, 6)); } $timezone = new DateTimeZone('Europe/Berlin'); measure_duration(function() use($timezone) { printf("Default Value\n"); $timezone->getTransitions(); }); measure_duration(function() use($timezone) { $timestamp = 0; printf("Timestamp for %s\n", date('Y-m-d H:i:s', $timestamp)); $timezone->getTransitions($timestamp); }); measure_duration(function() use($timezone) { $timestamp = -62135596800; printf("Timestamp for %s\n", date('Y-m-d H:i:s', $timestamp)); $timezone->getTransitions($timestamp); }); Expected result: ---------------- Default Value Duration: 0.000268 Timestamp for 1970-01-01 00:00:00 Duration: 0.000134 Timestamp for 0001-01-01 00:00:00 Duration: 0.000161 Actual result: -------------- Default Value Duration: 0.018967 Timestamp for 1970-01-01 00:00:00 Duration: 0.000101 Timestamp for 0001-01-01 00:00:00 Duration: 0.000095