mirror of
https://github.com/php/php-src.git
synced 2025-08-15 21:48:51 +02:00
ext/zip: Cancel operation if user callback throws an exception
This commit is contained in:
parent
79b9fe334a
commit
dccd4af9aa
2 changed files with 9 additions and 5 deletions
|
@ -3070,10 +3070,12 @@ static int php_zip_cancel_callback(zip_t *arch, void *ptr)
|
|||
ze_zip_object *obj = ptr;
|
||||
|
||||
zend_call_known_fcc(&obj->cancel_callback, &cb_retval, 0, NULL, NULL);
|
||||
if (!Z_ISUNDEF(cb_retval)) {
|
||||
retval = zval_get_long(&cb_retval);
|
||||
zval_ptr_dtor(&cb_retval);
|
||||
if (Z_ISUNDEF(cb_retval)) {
|
||||
/* Cancel if an exception has been thrown */
|
||||
return -1;
|
||||
}
|
||||
retval = zval_get_long(&cb_retval);
|
||||
zval_ptr_dtor(&cb_retval);
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
|
|
@ -91,7 +91,9 @@ ValueError: Invalid or uninitialized Zip object
|
|||
bool(true)
|
||||
bool(true)
|
||||
Trampoline for trampolineThrow
|
||||
|
||||
Warning: ZipArchive::close(): Operation cancelled in %s on line %d
|
||||
Exception: boo
|
||||
bool(false)
|
||||
string(8) "No error"
|
||||
bool(true)
|
||||
string(19) "Operation cancelled"
|
||||
Done
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue