mirror of
https://github.com/php/php-src.git
synced 2025-08-15 21:48:51 +02:00
Merge branch 'PHP-8.3'
* PHP-8.3: zip: add new test for dynamic files
This commit is contained in:
commit
cc36d8dc6f
1 changed files with 50 additions and 0 deletions
50
ext/zip/tests/oo_addfile_proc.phpt
Normal file
50
ext/zip/tests/oo_addfile_proc.phpt
Normal file
|
@ -0,0 +1,50 @@
|
|||
--TEST--
|
||||
ziparchive::addFile() for dynamic files reported empty
|
||||
--EXTENSIONS--
|
||||
zip
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!file_exists('/proc/cpuinfo')) die('skip no /proc');
|
||||
if (!defined('ZipArchive::LENGTH_UNCHECKED')) die('skip libzip too old');
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
include __DIR__ . '/utils.inc';
|
||||
$file = __DIR__ . '/__tmp_oo_addfile_proc.zip';
|
||||
|
||||
$zip = new ZipArchive;
|
||||
if (!$zip->open($file, ZIPARCHIVE::CREATE)) {
|
||||
exit('failed');
|
||||
}
|
||||
if (!$zip->addFile('/proc/cpuinfo', 'cpu.txt', 0, ZipArchive::LENGTH_UNCHECKED)) {
|
||||
echo "failed\n";
|
||||
}
|
||||
if (!$zip->addFile('/proc/meminfo', 'mem.txt', 0, ZipArchive::LENGTH_UNCHECKED)) {
|
||||
echo "failed\n";
|
||||
}
|
||||
|
||||
if ($zip->status == ZIPARCHIVE::ER_OK) {
|
||||
dump_entries_name($zip);
|
||||
$zip->close();
|
||||
} else {
|
||||
echo "failed\n";
|
||||
}
|
||||
var_dump($zip->status);
|
||||
|
||||
if (!$zip->open($file)) {
|
||||
exit('failed');
|
||||
}
|
||||
var_dump(strlen($zip->getFromName('cpu.txt')) > 0);
|
||||
var_dump(strlen($zip->getFromName('mem.txt')) > 0);
|
||||
|
||||
@unlink($file);
|
||||
?>
|
||||
Done
|
||||
--EXPECTF--
|
||||
0 cpu.txt
|
||||
1 mem.txt
|
||||
int(0)
|
||||
bool(true)
|
||||
bool(true)
|
||||
Done
|
Loading…
Add table
Add a link
Reference in a new issue