@@ -672,6 +672,18 @@ static const char *php_date_short_day_name(timelib_sll y, timelib_sll m, timelib
672
672
}
673
673
/* }}} */
674
674
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
+
675
687
/* {{{ date_format - (gm)date helper */
676
688
static zend_string * date_format (const char * format , size_t format_len , const timelib_time * t , bool localtime )
677
689
{
@@ -874,7 +886,7 @@ static void php_date(INTERNAL_FUNCTION_PARAMETERS, bool localtime)
874
886
}
875
887
/* }}} */
876
888
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 ) /* {{{ */
878
890
{
879
891
timelib_time * t ;
880
892
timelib_tzinfo * tzi ;
@@ -1125,7 +1137,7 @@ PHP_FUNCTION(strtotime)
1125
1137
1126
1138
timelib_fill_holes (t , now , TIMELIB_NO_CLONE );
1127
1139
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 );
1129
1141
1130
1142
timelib_time_dtor (now );
1131
1143
timelib_time_dtor (t );
@@ -1208,8 +1220,7 @@ PHPAPI void php_mktime(INTERNAL_FUNCTION_PARAMETERS, bool gmt)
1208
1220
}
1209
1221
1210
1222
/* 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 );
1213
1224
if (epoch_does_not_fit_in_zend_long ) {
1214
1225
timelib_time_dtor (now );
1215
1226
php_error_docref (NULL , E_WARNING , "Epoch doesn't fit in a PHP integer" );
@@ -3915,7 +3926,7 @@ PHP_FUNCTION(date_timestamp_get)
3915
3926
timelib_update_ts (dateobj -> time , NULL );
3916
3927
}
3917
3928
3918
- timestamp = timelib_date_to_int (dateobj -> time , & epoch_does_not_fit_in_zend_long );
3929
+ timestamp = date_date_to_zlong (dateobj -> time , & epoch_does_not_fit_in_zend_long );
3919
3930
3920
3931
if (epoch_does_not_fit_in_zend_long ) {
3921
3932
zend_throw_error (date_ce_date_range_error , "Epoch doesn't fit in a PHP integer" );
0 commit comments