]> granicus.if.org Git - php/commitdiff
Promote warning to exception in ZipArchive::extractTo()
authorMáté Kocsis <kocsismate@woohoolabs.com>
Wed, 6 May 2020 07:26:48 +0000 (09:26 +0200)
committerMáté Kocsis <kocsismate@woohoolabs.com>
Wed, 6 May 2020 17:22:52 +0000 (19:22 +0200)
Closes GH-5516

ext/zip/php_zip.c
ext/zip/php_zip.stub.php

index dc6031228506b2846cf4afb278cc8c8c767dd775..c68bb3ccb21aba9c9581572ba5f559b37f6ad05b 100644 (file)
@@ -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 */
index e7aabe2c6c20ba3592abef531a338f15ebaf0b22..0cb0597ecebd6570f9a5b51f27f7dae4cf8de08d 100644 (file)
@@ -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 */