1
0
mirror of https://github.com/php/php-src.git synced 2026-03-24 00:02:20 +01:00
Files
archived-php-src/ext/zip/tests/gh18431.phpt
Niels Dossche b066ac0b23 Fix GH-18431: Registering ZIP progress callback twice doesn't work
Libzip already cleans up the previous callback, so when that means:
1. The callback zval being already copied over the previous one causes
   libzip to clean up the new callback object. This is the root cause.
2. Our own code to clean the old callback is redundant.

Closes GH-18432.
2025-04-26 14:21:03 +02:00

23 lines
467 B
PHP

--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)