@@ -672,6 +672,18 @@ static const char *php_date_short_day_name(timelib_sll y, timelib_sll m, timelib
672672}
673673/* }}} */
674674
675+ static zend_long date_date_to_zlong (timelib_time * d , int * error )
676+ {
677+ #if SIZEOF_ZEND_LONG >= SIZEOF_LONG_LONG
678+ if (error ) {
679+ * error = 0 ;
680+ }
681+ return (zend_long ) d -> sse ;
682+ #else
683+ return timelib_date_to_int (d , error );
684+ #endif
685+ }
686+
675687/* {{{ date_format - (gm)date helper */
676688static zend_string * date_format (const char * format , size_t format_len , const timelib_time * t , bool localtime )
677689{
@@ -874,7 +886,7 @@ static void php_date(INTERNAL_FUNCTION_PARAMETERS, bool localtime)
874886}
875887/* }}} */
876888
877- PHPAPI zend_string * php_format_date (const char * format , size_t format_len , time_t ts , bool localtime ) /* {{{ */
889+ PHPAPI zend_string * php_format_date (const char * format , size_t format_len , zend_long ts , bool localtime ) /* {{{ */
878890{
879891 timelib_time * t ;
880892 timelib_tzinfo * tzi ;
@@ -1125,7 +1137,7 @@ PHP_FUNCTION(strtotime)
11251137
11261138 timelib_fill_holes (t , now , TIMELIB_NO_CLONE );
11271139 timelib_update_ts (t , tzi );
1128- ts = timelib_date_to_int (t , & epoch_does_not_fit_in_zend_long );
1140+ ts = date_date_to_zlong (t , & epoch_does_not_fit_in_zend_long );
11291141
11301142 timelib_time_dtor (now );
11311143 timelib_time_dtor (t );
@@ -1208,8 +1220,7 @@ PHPAPI void php_mktime(INTERNAL_FUNCTION_PARAMETERS, bool gmt)
12081220 }
12091221
12101222 /* Clean up and return */
1211- ts = timelib_date_to_int (now , & epoch_does_not_fit_in_zend_long );
1212-
1223+ ts = date_date_to_zlong (now , & epoch_does_not_fit_in_zend_long );
12131224 if (epoch_does_not_fit_in_zend_long ) {
12141225 timelib_time_dtor (now );
12151226 php_error_docref (NULL , E_WARNING , "Epoch doesn't fit in a PHP integer" );
@@ -3933,7 +3944,7 @@ PHP_FUNCTION(date_timestamp_get)
39333944 timelib_update_ts (dateobj -> time , NULL );
39343945 }
39353946
3936- timestamp = timelib_date_to_int (dateobj -> time , & epoch_does_not_fit_in_zend_long );
3947+ timestamp = date_date_to_zlong (dateobj -> time , & epoch_does_not_fit_in_zend_long );
39373948
39383949 if (epoch_does_not_fit_in_zend_long ) {
39393950 zend_throw_error (date_ce_date_range_error , "Epoch doesn't fit in a PHP integer" );
0 commit comments