Skip to content

Commit bce8c8f

Browse files
committed
Promote warning to exception in ZipArchive::extractTo()
Closes GH-5516
1 parent 650da66 commit bce8c8f

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

ext/zip/php_zip.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2810,10 +2810,9 @@ static ZIPARCHIVE_METHOD(extractTo)
28102810
}
28112811
}
28122812
break;
2813-
case IS_LONG:
28142813
default:
2815-
php_error_docref(NULL, E_WARNING, "Invalid argument, expect string or array of strings");
2816-
break;
2814+
zend_argument_type_error(2, "must be of type array|string|null, %s given", zend_zval_type_name(zval_files));
2815+
RETURN_THROWS();
28172816
}
28182817
} else {
28192818
/* Extract all files */

ext/zip/php_zip.stub.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,10 @@ public function unchangeIndex(int $index) {}
137137
/** @return bool */
138138
public function unchangeName(string $name) {}
139139

140-
/** @return bool */
140+
/**
141+
* @param array|string|null $files
142+
* @return bool
143+
*/
141144
public function extractTo(string $pathto, $files = null) {}
142145

143146
/** @return string|false */

0 commit comments

Comments
 (0)