. Fixed bug #77652 (Anonymous classes can lose their interface information).
(Nikita)
-- Standard:
- . Fixed bug #77664 (Segmentation fault when using undefined constant in
- custom wrapper). (Laruence)
- . Fixed bug #77669 (Crash in extract() when overwriting extracted array).
- (Nikita)
+- Date:
+ . Fixed bug #50020 (DateInterval:createDateFromString() silently fails).
+ (Derick)
- MySQLi:
. Fixed bug #77597 (mysqli_fetch_field hangs scripts). (Nikita)
- sodium:
. Fixed bug #77646 (sign_detached() strings not terminated). (Frank)
+- Standard:
+ . Fixed bug #77664 (Segmentation fault when using undefined constant in
+ custom wrapper). (Laruence)
+ . Fixed bug #77669 (Crash in extract() when overwriting extracted array).
+ (Nikita)
+
07 Mar 2019, PHP 7.2.16
- Core:
Z_PARAM_STR(time_str)
ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE);
- php_date_instantiate(date_ce_interval, return_value);
-
time = timelib_strtotime(ZSTR_VAL(time_str), ZSTR_LEN(time_str), &err, DATE_TIMEZONEDB, php_date_parse_tzfile_wrapper);
+
+ if (err->error_count > 0) {
+ php_error_docref(NULL, E_WARNING, "Unknown or bad format (%s) at position %d (%c): %s", ZSTR_VAL(time_str),
+ err->error_messages[0].position, err->error_messages[0].character ? err->error_messages[0].character : ' ', err->error_messages[0].message);
+ RETVAL_FALSE;
+ goto cleanup;
+ }
+
+ php_date_instantiate(date_ce_interval, return_value);
diobj = Z_PHPINTERVAL_P(return_value);
diobj->diff = timelib_rel_time_clone(&time->relative);
diobj->initialized = 1;
+
+cleanup:
timelib_time_dtor(time);
timelib_error_container_dtor(err);
}
--- /dev/null
+--TEST--
+Test date_interval_create_from_date_string() function : nonsense data
+--FILE--
+<?php
+$i = date_interval_create_from_date_string("foobar");
+var_dump($i);
+?>
+--EXPECTF--
+Warning: date_interval_create_from_date_string(): Unknown or bad format (foobar) at position 0 (f): The timezone could not be found in the database in %sdate_interval_create_from_date_string_broken.php on line 2
+bool(false)
Rodrigo Prado de Jesus <royopa [at] gmail [dot] com>
--FILE--
<?php
-$i = date_interval_create_from_date_string(null); //returns a empty object
+$i = date_interval_create_from_date_string(null);
var_dump($i);
?>
--EXPECTF--
-object(DateInterval)#%d (16) {
- ["y"]=>
- int(0)
- ["m"]=>
- int(0)
- ["d"]=>
- int(0)
- ["h"]=>
- int(0)
- ["i"]=>
- int(0)
- ["s"]=>
- int(0)
- ["f"]=>
- float(0)
- ["weekday"]=>
- int(0)
- ["weekday_behavior"]=>
- int(0)
- ["first_last_day_of"]=>
- int(0)
- ["invert"]=>
- int(0)
- ["days"]=>
- int(0)
- ["special_type"]=>
- int(0)
- ["special_amount"]=>
- int(0)
- ["have_weekday_relative"]=>
- int(0)
- ["have_special_relative"]=>
- int(0)
-}
+Warning: date_interval_create_from_date_string(): Unknown or bad format () at position 0 ( ): Empty string in %sdate_interval_create_from_date_string_nullparam.php on line 2
+bool(false)