From bce8c8fb272c6f0a84a1aa87d6dd0e7d6e28b6b3 Mon Sep 17 00:00:00 2001 From: =?utf8?q?M=C3=A1t=C3=A9=20Kocsis?= Date: Wed, 6 May 2020 09:26:48 +0200 Subject: [PATCH] Promote warning to exception in ZipArchive::extractTo() Closes GH-5516 --- ext/zip/php_zip.c | 5 ++--- ext/zip/php_zip.stub.php | 5 ++++- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/ext/zip/php_zip.c b/ext/zip/php_zip.c index dc60312285..c68bb3ccb2 100644 --- a/ext/zip/php_zip.c +++ b/ext/zip/php_zip.c @@ -2810,10 +2810,9 @@ static ZIPARCHIVE_METHOD(extractTo) } } break; - case IS_LONG: default: - php_error_docref(NULL, E_WARNING, "Invalid argument, expect string or array of strings"); - break; + zend_argument_type_error(2, "must be of type array|string|null, %s given", zend_zval_type_name(zval_files)); + RETURN_THROWS(); } } else { /* Extract all files */ diff --git a/ext/zip/php_zip.stub.php b/ext/zip/php_zip.stub.php index e7aabe2c6c..0cb0597ece 100644 --- a/ext/zip/php_zip.stub.php +++ b/ext/zip/php_zip.stub.php @@ -137,7 +137,10 @@ class ZipArchive /** @return bool */ public function unchangeName(string $name) {} - /** @return bool */ + /** + * @param array|string|null $files + * @return bool + */ public function extractTo(string $pathto, $files = null) {} /** @return string|false */ -- 2.40.0