summaryrefslogtreecommitdiff
path: root/ext/date/php_date.c
diff options
context:
space:
mode:
authorIgnace Nyamagana Butera <nyamsprod@gmail.com>2019-03-25 20:30:02 +0100
committerDerick Rethans <github@derickrethans.nl>2019-04-17 09:39:03 +0100
commit7b1a4e24008f34a76c343ece735953ad5124e09f (patch)
treecdd5479d78bf8e89a178be8d0a25283b7cfabb97 /ext/date/php_date.c
parent6fe75f9e45be60262bfe7e6bb92de445fe41c483 (diff)
downloadphp-git-7b1a4e24008f34a76c343ece735953ad5124e09f.tar.gz
Fixed bug #77909: DatePeriod::__construct() with invalid recurrence count value
Improve error message on invalid reccurence count Adding test when reccurence is -1
Diffstat (limited to 'ext/date/php_date.c')
-rw-r--r--ext/date/php_date.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/ext/date/php_date.c b/ext/date/php_date.c
index 9b37a9e3c1..f47ba5bc54 100644
--- a/ext/date/php_date.c
+++ b/ext/date/php_date.c
@@ -4645,6 +4645,10 @@ PHP_METHOD(DatePeriod, __construct)
dpobj->end = clone;
}
}
+
+ if (dpobj->end == NULL && recurrences < 1) {
+ php_error_docref(NULL, E_WARNING, "The recurrence count '%d' is invalid. Needs to be > 0", (int) recurrences);
+ }
/* options */
dpobj->include_start_date = !(options & PHP_DATE_PERIOD_EXCLUDE_START_DATE);