mirror of
https://github.com/php/php-src.git
synced 2024-09-22 10:27:25 +00:00
Elevate warning to ValueError for invalid ZipArchive object
This commit is contained in:
parent
6902d14b81
commit
3c16606d46
@ -372,8 +372,8 @@ static int php_zip_parse_options(zval *options, zend_long *remove_all_path, char
|
||||
ze_zip_object *obj = Z_ZIP_P(object); \
|
||||
intern = obj->za; \
|
||||
if (!intern) { \
|
||||
php_error_docref(NULL, E_WARNING, "Invalid or uninitialized Zip object"); \
|
||||
RETURN_FALSE; \
|
||||
zend_value_error("Invalid or uninitialized Zip object"); \
|
||||
return; \
|
||||
} \
|
||||
}
|
||||
/* }}} */
|
||||
|
@ -66,10 +66,10 @@ class ZipArchive
|
||||
/** @return bool */
|
||||
public function close() {}
|
||||
|
||||
/** @return int|false */
|
||||
/** @return int */
|
||||
public function count() {}
|
||||
|
||||
/** @return string|false */
|
||||
/** @return string */
|
||||
public function getStatusString() {}
|
||||
|
||||
/** @return bool */
|
||||
|
@ -26,7 +26,11 @@ if (!$zip->open(__DIR__ . '/test.zip')) {
|
||||
}
|
||||
if ($zip->status == ZIPARCHIVE::ER_OK) {
|
||||
var_dump($zip->close());
|
||||
var_dump($zip->close());
|
||||
try {
|
||||
$zip->close();
|
||||
} catch (ValueError $err) {
|
||||
echo $err->getMessage(), PHP_EOL;
|
||||
}
|
||||
} else {
|
||||
die("Failure");
|
||||
}
|
||||
@ -39,7 +43,5 @@ NULL
|
||||
zip_close(): supplied resource is not a valid Zip Directory resource
|
||||
Object
|
||||
bool(true)
|
||||
|
||||
Warning: ZipArchive::close(): Invalid or uninitialized Zip object in %s on line %d
|
||||
bool(false)
|
||||
Invalid or uninitialized Zip object
|
||||
Done
|
||||
|
Loading…
Reference in New Issue
Block a user