From: Máté Kocsis Date: Wed, 6 May 2020 07:26:48 +0000 (+0200) Subject: Promote warning to exception in ZipArchive::extractTo() X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=bce8c8fb272c6f0a84a1aa87d6dd0e7d6e28b6b3;p=php Promote warning to exception in ZipArchive::extractTo() Closes GH-5516 --- 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 */