1
0
mirror of https://github.com/php/php-src.git synced 2026-03-24 00:02:20 +01:00

Merge branch 'PHP-8.3' into PHP-8.4

* PHP-8.3:
  Fix GH-18431: Registering ZIP progress callback twice doesn't work
This commit is contained in:
Niels Dossche
2025-04-26 14:23:54 +02:00
3 changed files with 28 additions and 8 deletions

4
NEWS
View File

@@ -15,6 +15,10 @@ PHP NEWS
. Fixed bug GH-17403 (Potential deadlock when putenv fails). (nielsdos)
. Fixed bug GH-18400 (http_build_query type error is inaccurate). (nielsdos)
- Zip:
. Fixed bug GH-18431 (Registering ZIP progress callback twice doesn't work).
(nielsdos)
24 Apr 2025, PHP 8.4.7
- Core:

View File

@@ -3054,14 +3054,11 @@ PHP_METHOD(ZipArchive, registerProgressCallback)
obj = Z_ZIP_P(self);
/* free if called twice */
_php_zip_progress_callback_free(obj);
/* register */
ZVAL_COPY(&obj->progress_callback, &fci.function_name);
if (zip_register_progress_callback_with_state(intern, rate, _php_zip_progress_callback, _php_zip_progress_callback_free, obj)) {
RETURN_FALSE;
}
ZVAL_COPY(&obj->progress_callback, &fci.function_name);
RETURN_TRUE;
}
@@ -3099,14 +3096,11 @@ PHP_METHOD(ZipArchive, registerCancelCallback)
obj = Z_ZIP_P(self);
/* free if called twice */
_php_zip_cancel_callback_free(obj);
/* register */
ZVAL_COPY(&obj->cancel_callback, &fci.function_name);
if (zip_register_cancel_callback_with_state(intern, _php_zip_cancel_callback, _php_zip_cancel_callback_free, obj)) {
RETURN_FALSE;
}
ZVAL_COPY(&obj->cancel_callback, &fci.function_name);
RETURN_TRUE;
}

View File

@@ -0,0 +1,22 @@
--TEST--
GH-18431 (Registering ZIP progress callback twice doesn't work)
--EXTENSIONS--
zip
--FILE--
<?php
$file = __DIR__ . '/gh18431.zip';
$callback = var_dump(...);
$zip = new ZipArchive;
$zip->open($file, ZIPARCHIVE::CREATE);
$zip->registerProgressCallback(0.5, $callback);
$zip->registerProgressCallback(0.5, $callback);
$zip->addFromString('foo', 'entry #1');
?>
--CLEAN--
<?php
$file = __DIR__ . '/gh18431.zip';
@unlink($file);
?>
--EXPECT--
float(0)
float(1)