@@ -1009,7 +1009,7 @@ PHPAPI zend_long php_parse_date(const char *string, zend_long *now)
1009
1009
PHP_FUNCTION (strtotime )
1010
1010
{
1011
1011
zend_string * times ;
1012
- int error1 , error2 ;
1012
+ int error1 , epoch_does_not_fit_in_zend_long ;
1013
1013
timelib_error_container * error ;
1014
1014
zend_long preset_ts , ts ;
1015
1015
zend_bool preset_ts_is_null = 1 ;
@@ -1024,7 +1024,6 @@ PHP_FUNCTION(strtotime)
1024
1024
1025
1025
/* timelib_strtotime() expects the string to not be empty */
1026
1026
if (ZSTR_LEN (times ) == 0 ) {
1027
- /* TODO Add a Warning? */
1028
1027
RETURN_FALSE ;
1029
1028
}
1030
1029
@@ -1048,14 +1047,14 @@ PHP_FUNCTION(strtotime)
1048
1047
1049
1048
timelib_fill_holes (t , now , TIMELIB_NO_CLONE );
1050
1049
timelib_update_ts (t , tzi );
1051
- ts = timelib_date_to_int (t , & error2 );
1050
+ ts = timelib_date_to_int (t , & epoch_does_not_fit_in_zend_long );
1052
1051
1053
1052
timelib_time_dtor (now );
1054
1053
timelib_time_dtor (t );
1055
1054
1056
1055
/* Seconds since epoch must fit in a zend_long */
1057
- if (error2 ) {
1058
- /* TODO Add warning? */
1056
+ if (epoch_does_not_fit_in_zend_long ) {
1057
+ php_error_docref ( NULL , E_WARNING , "Epoch doesn't fit in a PHP integer" );
1059
1058
RETURN_FALSE ;
1060
1059
}
1061
1060
@@ -1071,7 +1070,7 @@ PHPAPI void php_mktime(INTERNAL_FUNCTION_PARAMETERS, int gmt)
1071
1070
timelib_time * now ;
1072
1071
timelib_tzinfo * tzi = NULL ;
1073
1072
zend_long ts , adjust_seconds = 0 ;
1074
- int error ;
1073
+ int epoch_does_not_fit_in_zend_long ;
1075
1074
1076
1075
ZEND_PARSE_PARAMETERS_START (1 , 6 )
1077
1076
Z_PARAM_LONG (hou )
@@ -1129,12 +1128,12 @@ PHPAPI void php_mktime(INTERNAL_FUNCTION_PARAMETERS, int gmt)
1129
1128
}
1130
1129
1131
1130
/* Clean up and return */
1132
- ts = timelib_date_to_int (now , & error );
1131
+ ts = timelib_date_to_int (now , & epoch_does_not_fit_in_zend_long );
1133
1132
1134
1133
/* Seconds since epoch must fit in a zend_long */
1135
- if (error ) {
1134
+ if (epoch_does_not_fit_in_zend_long ) {
1136
1135
timelib_time_dtor (now );
1137
- /* TODO Add warning? */
1136
+ php_error_docref ( NULL , E_WARNING , "Epoch doesn't fit in a PHP integer" );
1138
1137
RETURN_FALSE ;
1139
1138
}
1140
1139
@@ -1198,7 +1197,6 @@ PHPAPI void php_strftime(INTERNAL_FUNCTION_PARAMETERS, int gmt)
1198
1197
ZEND_PARSE_PARAMETERS_END ();
1199
1198
1200
1199
if (ZSTR_LEN (format ) == 0 ) {
1201
- /* TODO Add a warning? */
1202
1200
RETURN_FALSE ;
1203
1201
}
1204
1202
@@ -3328,7 +3326,7 @@ PHP_FUNCTION(date_timestamp_get)
3328
3326
zval * object ;
3329
3327
php_date_obj * dateobj ;
3330
3328
zend_long timestamp ;
3331
- int error ;
3329
+ int epoch_does_not_fit_in_zend_long ;
3332
3330
3333
3331
if (zend_parse_method_parameters (ZEND_NUM_ARGS (), getThis (), "O" , & object , date_ce_interface ) == FAILURE ) {
3334
3332
RETURN_THROWS ();
@@ -3337,11 +3335,11 @@ PHP_FUNCTION(date_timestamp_get)
3337
3335
DATE_CHECK_INITIALIZED (dateobj -> time , DateTime );
3338
3336
timelib_update_ts (dateobj -> time , NULL );
3339
3337
3340
- timestamp = timelib_date_to_int (dateobj -> time , & error );
3338
+ timestamp = timelib_date_to_int (dateobj -> time , & epoch_does_not_fit_in_zend_long );
3341
3339
3342
3340
/* Seconds since epoch must fit in a zend_long */
3343
- if (error ) {
3344
- /* TODO Add warning? */
3341
+ if (epoch_does_not_fit_in_zend_long ) {
3342
+ php_error_docref ( NULL , E_WARNING , "Epoch doesn't fit in a PHP integer" );
3345
3343
RETURN_FALSE ;
3346
3344
}
3347
3345
0 commit comments