Skip to content

Commit

Permalink
Fixed bug #71053 (Type Hint about DateTime::diff does not match with …
Browse files Browse the repository at this point in the history
…informed)
  • Loading branch information
reeze committed Dec 9, 2015
1 parent 0adbf6d commit 943b23d
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 2 deletions.
4 changes: 4 additions & 0 deletions NEWS
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@ PHP NEWS
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
?? Jan 2016 PHP 7.0.2

- Date:
. Fixed bug #71053 (Type Hint about DateTime::diff does not match with
informed). (Reeze Xia)

- Mbstring:
. Fixed bug #71066 (mb_send_mail: Program terminated with signal SIGSEGV,
Segmentation fault). (Laruence)
Expand Down
4 changes: 2 additions & 2 deletions ext/date/php_date.c
Original file line number Diff line number Diff line change
Expand Up @@ -3579,9 +3579,9 @@ PHP_FUNCTION(date_diff)
zval *object1, *object2;
php_date_obj *dateobj1, *dateobj2;
php_interval_obj *interval;
zend_long absolute = 0;
zend_bool absolute = 0;

if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "OO|l", &object1, date_ce_interface, &object2, date_ce_interface, &absolute) == FAILURE) {
if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "OO|b", &object1, date_ce_interface, &object2, date_ce_interface, &absolute) == FAILURE) {
RETURN_FALSE;
}
dateobj1 = Z_PHPDATE_P(object1);
Expand Down
13 changes: 13 additions & 0 deletions ext/date/tests/bug71053.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
--TEST--
Bug #71053 (Type Hint about DateTime::diff does not match with informed)
--FILE--
<?php
declare(strict_types=1);

$date1 = new \DateTime();
$date2 = clone $date1;

var_dump(count($date1->diff($date2 , true)) > 0);
?>
--EXPECT--
bool(true)

0 comments on commit 943b23d

Please sign in to comment.