Skip to content

Commit f57925e

Browse files
committed
Add new methods from version 1.20.0
- ZipArchive::clearError() - ZipArchive::getStreamName($name, $flags=0) - ZipArchive::getStreamIndex($index, $flags=0)
1 parent 65a1dc5 commit f57925e

File tree

5 files changed

+280
-0
lines changed

5 files changed

+280
-0
lines changed

reference/zip/versions.xml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
<function name="ZipArchive::addFromString" from="PHP 5 &gt;= 5.2.0, PHP 7, PHP 8, PECL zip &gt;= 1.1.0"/>
1212
<function name="ZipArchive::addGlob" from="PHP 5 &gt;= 5.3.0, PHP 7, PHP 8, PECL zip &gt;= 1.9.0"/>
1313
<function name="ZipArchive::addPattern" from="PHP 5 &gt;= 5.3.0, PHP 7, PHP 8, PECL zip &gt;= 1.9.0"/>
14+
<function name="ZipArchive::clearError" from="PHP 8 &gt;= 8.2.0, PECL zip &gt;= 1.20.0"/>
1415
<function name="ZipArchive::close" from="PHP 5 &gt;= 5.2.0, PHP 7, PHP 8, PECL zip &gt;= 1.1.0"/>
1516
<function name="ZipArchive::count" from="PHP 7 &gt;= 7.2.0, PHP 8, PECL zip &gt;= 1.15.0"/>
1617
<function name="ZipArchive::deleteIndex" from="PHP 5 &gt;= 5.2.0, PHP 7, PHP 8, PECL zip &gt;= 1.5.0"/>
@@ -25,6 +26,8 @@
2526
<function name="ZipArchive::getFromName" from="PHP 5 &gt;= 5.2.0, PHP 7, PHP 8, PECL zip &gt;= 1.1.0"/>
2627
<function name="ZipArchive::getNameIndex" from="PHP 5 &gt;= 5.2.0, PHP 7, PHP 8, PECL zip &gt;= 1.5.0"/>
2728
<function name="ZipArchive::getStream" from="PHP 5 &gt;= 5.2.0, PHP 7, PHP 8, PECL zip &gt;= 1.1.0"/>
29+
<function name="ZipArchive::getStreamIndex" from="PHP 8 &gt;= 8.2.0, PECL zip &gt;= 1.20.0"/>
30+
<function name="ZipArchive::getStreamName" from="PHP 8 &gt;= 8.2.0, PECL zip &gt;= 1.20.0"/>
2831
<function name="ZipArchive::getStatusString" from="PHP 5 &gt;= 5.2.7, PHP 7, PHP 8"/>
2932
<function name="ZipArchive::isCompressionMethodSupported" from="PHP &gt;= 8.0.0, PECL zip &gt;= 1.19.0"/>
3033
<function name="ZipArchive::isEncryptionMethodSupported" from="PHP &gt;= 8.0.0, PECL zip &gt;= 1.19.0"/>
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<!-- $Revision$ -->
3+
<refentry xml:id="ziparchive.clearerror" xmlns="http://docbook.org/ns/docbook">
4+
<refnamediv>
5+
<refname>ZipArchive::clearError</refname>
6+
<refpurpose>Returns the status error message, system and/or zip messages</refpurpose>
7+
</refnamediv>
8+
<refsect1 role="description">
9+
&reftitle.description;
10+
<methodsynopsis>
11+
<modifier>public</modifier> <type>void</type><methodname>ZipArchive::clearError</methodname>
12+
<void/>
13+
</methodsynopsis>
14+
<para>
15+
Clear the status error message, system and/or zip messages.
16+
</para>
17+
</refsect1>
18+
19+
<refsect1 role="parameters">
20+
&reftitle.parameters;
21+
&no.function.parameters;
22+
</refsect1>
23+
24+
<refsect1 role="returnvalues">
25+
&reftitle.returnvalues;
26+
<para>
27+
&return.void;
28+
</para>
29+
</refsect1>
30+
31+
<refsect1 role="seealso">
32+
&reftitle.seealso;
33+
<para>
34+
<simplelist>
35+
<member><methodname>ZipArchive::getStatusString</methodname></member>
36+
</simplelist>
37+
</para>
38+
</refsect1>
39+
40+
</refentry>
41+
<!-- Keep this comment at the end of the file
42+
Local variables:
43+
mode: sgml
44+
sgml-omittag:t
45+
sgml-shorttag:t
46+
sgml-minimize-attributes:nil
47+
sgml-always-quote-attributes:t
48+
sgml-indent-step:1
49+
sgml-indent-data:t
50+
indent-tabs-mode:nil
51+
sgml-parent-document:nil
52+
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
53+
sgml-exposed-tags:nil
54+
sgml-local-catalogs:nil
55+
sgml-local-ecat-files:nil
56+
End:
57+
vim600: syn=xml fen fdm=syntax fdl=2 si
58+
vim: et tw=78 syn=sgml
59+
vi: ts=1 sw=1
60+
-->

reference/zip/ziparchive/getstream.xml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,17 @@ imagepng($im, 'a.png');
9696
</programlisting>
9797
</example>
9898
</refsect1>
99+
100+
<refsect1 role="seealso">
101+
&reftitle.seealso;
102+
<para>
103+
<simplelist>
104+
<member><methodname>ZipArchive::getStreamIndex</methodname></member>
105+
<member><methodname>ZipArchive::getStreamName</methodname></member>
106+
</simplelist>
107+
</para>
108+
</refsect1>
109+
99110
</refentry>
100111

101112
<!-- Keep this comment at the end of the file
Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<!-- $Revision$ -->
3+
<refentry xml:id="ziparchive.getstreamindex" xmlns="http://docbook.org/ns/docbook">
4+
<refnamediv>
5+
<refname>ZipArchive::getStreamIndex</refname>
6+
<refpurpose>Get a file handler to the entry defined by its index (read only)</refpurpose>
7+
</refnamediv>
8+
<refsect1 role="description">
9+
&reftitle.description;
10+
<methodsynopsis>
11+
<modifier>public</modifier> <type class="union"><type>resource</type><type>false</type></type><methodname>ZipArchive::getStreamIndex</methodname>
12+
<methodparam><type>int</type><parameter>index</parameter></methodparam>
13+
<methodparam choice="opt"><type>int</type><parameter>flags</parameter><initializer>0</initializer></methodparam>
14+
</methodsynopsis>
15+
<para>
16+
Get a file handler to the entry defined by its name. For now it only
17+
supports read operations.
18+
</para>
19+
</refsect1>
20+
<refsect1 role="parameters">
21+
&reftitle.parameters;
22+
<para>
23+
<variablelist>
24+
<varlistentry>
25+
<term><parameter>index</parameter></term>
26+
<listitem>
27+
<para>
28+
Index of the entry
29+
</para>
30+
</listitem>
31+
</varlistentry>
32+
<varlistentry>
33+
<term><parameter>flags</parameter></term>
34+
<listitem>
35+
<para>
36+
If flags is set to <constant>ZipArchive::FL_UNCHANGED</constant>, the original unchanged
37+
stream is returned.
38+
</para>
39+
</listitem>
40+
</varlistentry>
41+
</variablelist>
42+
</para>
43+
</refsect1>
44+
<refsect1 role="returnvalues">
45+
&reftitle.returnvalues;
46+
<para>
47+
Returns a file pointer (resource) on success&return.falseforfailure;.
48+
</para>
49+
</refsect1>
50+
<refsect1 role="examples">
51+
&reftitle.examples;
52+
<example>
53+
<title>Get the entry contents with <function>fread</function> and store it</title>
54+
<programlisting role="php">
55+
<![CDATA[
56+
<?php
57+
$contents = '';
58+
$z = new ZipArchive();
59+
if ($z->open('test.zip')) {
60+
$fp = $z->getStreamIndex(1, ZipArchive::FL_UNCHANGED);
61+
if(!$fp) die($z->getStatusString());
62+
63+
echo stream_get_contents($fp);
64+
65+
fclose($fp);
66+
}
67+
?>
68+
]]>
69+
</programlisting>
70+
</example>
71+
</refsect1>
72+
73+
<refsect1 role="seealso">
74+
&reftitle.seealso;
75+
<para>
76+
<simplelist>
77+
<member><methodname>ZipArchive::getStreamName</methodname></member>
78+
</simplelist>
79+
</para>
80+
</refsect1>
81+
82+
</refentry>
83+
84+
<!-- Keep this comment at the end of the file
85+
Local variables:
86+
mode: sgml
87+
sgml-omittag:t
88+
sgml-shorttag:t
89+
sgml-minimize-attributes:nil
90+
sgml-always-quote-attributes:t
91+
sgml-indent-step:1
92+
sgml-indent-data:t
93+
indent-tabs-mode:nil
94+
sgml-parent-document:nil
95+
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
96+
sgml-exposed-tags:nil
97+
sgml-local-catalogs:nil
98+
sgml-local-ecat-files:nil
99+
End:
100+
vim600: syn=xml fen fdm=syntax fdl=2 si
101+
vim: et tw=78 syn=sgml
102+
vi: ts=1 sw=1
103+
-->
Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<!-- $Revision$ -->
3+
<refentry xml:id="ziparchive.getstreamname" xmlns="http://docbook.org/ns/docbook">
4+
<refnamediv>
5+
<refname>ZipArchive::getStreamName</refname>
6+
<refpurpose>Get a file handler to the entry defined by its name (read only)</refpurpose>
7+
</refnamediv>
8+
<refsect1 role="description">
9+
&reftitle.description;
10+
<methodsynopsis>
11+
<modifier>public</modifier> <type class="union"><type>resource</type><type>false</type></type><methodname>ZipArchive::getStreamName</methodname>
12+
<methodparam><type>string</type><parameter>name</parameter></methodparam>
13+
<methodparam choice="opt"><type>int</type><parameter>flags</parameter><initializer>0</initializer></methodparam>
14+
</methodsynopsis>
15+
<para>
16+
Get a file handler to the entry defined by its name. For now it only
17+
supports read operations.
18+
</para>
19+
</refsect1>
20+
<refsect1 role="parameters">
21+
&reftitle.parameters;
22+
<para>
23+
<variablelist>
24+
<varlistentry>
25+
<term><parameter>name</parameter></term>
26+
<listitem>
27+
<para>
28+
The name of the entry to use.
29+
</para>
30+
</listitem>
31+
</varlistentry>
32+
<varlistentry>
33+
<term><parameter>flags</parameter></term>
34+
<listitem>
35+
<para>
36+
If flags is set to <constant>ZipArchive::FL_UNCHANGED</constant>, the original unchanged
37+
stream is returned.
38+
</para>
39+
</listitem>
40+
</varlistentry>
41+
</variablelist>
42+
</para>
43+
</refsect1>
44+
<refsect1 role="returnvalues">
45+
&reftitle.returnvalues;
46+
<para>
47+
Returns a file pointer (resource) on success&return.falseforfailure;.
48+
</para>
49+
</refsect1>
50+
<refsect1 role="examples">
51+
&reftitle.examples;
52+
<example>
53+
<title>Get the entry contents with <function>fread</function> and store it</title>
54+
<programlisting role="php">
55+
<![CDATA[
56+
<?php
57+
$contents = '';
58+
$z = new ZipArchive();
59+
if ($z->open('test.zip')) {
60+
$fp = $z->getStreamName('test', ZipArchive::FL_UNCHANGED);
61+
if(!$fp) die($z->getStatusString());
62+
63+
echo stream_get_contents($fp);
64+
65+
fclose($fp);
66+
}
67+
?>
68+
]]>
69+
</programlisting>
70+
</example>
71+
</refsect1>
72+
73+
<refsect1 role="seealso">
74+
&reftitle.seealso;
75+
<para>
76+
<simplelist>
77+
<member><methodname>ZipArchive::getStreamIndex</methodname></member>
78+
</simplelist>
79+
</para>
80+
</refsect1>
81+
82+
</refentry>
83+
84+
<!-- Keep this comment at the end of the file
85+
Local variables:
86+
mode: sgml
87+
sgml-omittag:t
88+
sgml-shorttag:t
89+
sgml-minimize-attributes:nil
90+
sgml-always-quote-attributes:t
91+
sgml-indent-step:1
92+
sgml-indent-data:t
93+
indent-tabs-mode:nil
94+
sgml-parent-document:nil
95+
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
96+
sgml-exposed-tags:nil
97+
sgml-local-catalogs:nil
98+
sgml-local-ecat-files:nil
99+
End:
100+
vim600: syn=xml fen fdm=syntax fdl=2 si
101+
vim: et tw=78 syn=sgml
102+
vi: ts=1 sw=1
103+
-->

0 commit comments

Comments
 (0)