1--TEST-- 2registerProgressCallback 3--SKIPIF-- 4<?php 5/* $Id$ */ 6if(!extension_loaded('zip')) die('skip'); 7if (!method_exists('ZipArchive', 'registerProgressCallback')) die('skip libzip too old'); 8?> 9--INI-- 10date.timezone=UTC 11--FILE-- 12<?php 13$dirname = dirname(__FILE__) . '/'; 14$file = $dirname . '__tmp_oo_progress.zip'; 15 16@unlink($file); 17 18$zip = new ZipArchive; 19if (!$zip->open($file, ZIPARCHIVE::CREATE)) { 20 exit('failed'); 21} 22 23var_dump($zip->registerProgressCallback(0.5, function ($r) { 24 // Only check start/end as intermediate is not reliable 25 if ($r == 0.0) echo "start\n"; 26 if ($r == 1.0) echo "end\n"; 27})); 28var_dump($zip->addFromString('foo', 'entry #1')); 29 30var_dump($zip->close()); 31unlink($file); 32?> 33Done 34--EXPECT-- 35bool(true) 36bool(true) 37start 38end 39bool(true) 40Done 41