diff options
author | Nikita Popov <nikita.ppv@gmail.com> | 2020-01-30 12:17:10 +0100 |
---|---|---|
committer | Nikita Popov <nikita.ppv@gmail.com> | 2020-01-30 12:17:10 +0100 |
commit | 187f359549dcd7b172806d79b40807a284b5fdad (patch) | |
tree | 9473fff3e5e0ece45e8c55d2ded28549e42e55b8 | |
parent | 68596ed71e44b64d15bb51cb67671ae8e41538f6 (diff) | |
parent | 494615fcb8c1fb5984e0e7d666e51a2dfc6bee55 (diff) | |
download | php-git-187f359549dcd7b172806d79b40807a284b5fdad.tar.gz |
Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
Fix leak in DateTimeImmutable::modify()
-rw-r--r-- | ext/date/php_date.c | 1 | ||||
-rw-r--r-- | ext/date/tests/DateTimeImmutable_modify_invalid_format.phpt | 12 |
2 files changed, 13 insertions, 0 deletions
diff --git a/ext/date/php_date.c b/ext/date/php_date.c index ca34ad4d8c..db04b53c34 100644 --- a/ext/date/php_date.c +++ b/ext/date/php_date.c @@ -3305,6 +3305,7 @@ PHP_METHOD(DateTimeImmutable, modify) date_clone_immutable(object, &new_object); if (!php_date_modify(&new_object, modify, modify_len)) { + zval_ptr_dtor(&new_object); RETURN_FALSE; } diff --git a/ext/date/tests/DateTimeImmutable_modify_invalid_format.phpt b/ext/date/tests/DateTimeImmutable_modify_invalid_format.phpt new file mode 100644 index 0000000000..3386f725ac --- /dev/null +++ b/ext/date/tests/DateTimeImmutable_modify_invalid_format.phpt @@ -0,0 +1,12 @@ +--TEST-- +DateTimeImmutable::modify() with invalid format +--FILE-- +<?php + +$datetime = new DateTimeImmutable; +var_dump($datetime->modify('')); + +?> +--EXPECTF-- +Warning: DateTimeImmutable::modify(): Failed to parse time string () at position 0 ( in %s on line %d +bool(false) |