reference/fileinfo/functions/finfo-open.xml
1160ec4e7d21a2619e9661d6afe3a6356267c6c2
...
...
@@ -4,25 +4,25 @@
4
4
<refnamediv>
5
5
<refname>finfo_open</refname>
6
6
<refname>finfo::__construct</refname>
7
-
<refpurpose>Create a new fileinfo resource</refpurpose>
7
+
<refpurpose>Create a new finfo instance</refpurpose>
8
8
</refnamediv>
9
9

10
10
<refsect1 role="description">
11
11
&reftitle.description;
12
12
<para>&style.procedural;</para>
13
-
<methodsynopsis role="procedural">
14
-
<type>resource</type><methodname>finfo_open</methodname>
15
-
<methodparam choice="opt"><type>int</type><parameter>options</parameter><initializer>FILEINFO_NONE</initializer></methodparam>
16
-
<methodparam choice="opt"><type>string</type><parameter>magic_file</parameter><initializer>&null;</initializer></methodparam>
13
+
<methodsynopsis>
14
+
<type class="union"><type>finfo</type><type>false</type></type><methodname>finfo_open</methodname>
15
+
<methodparam choice="opt"><type>int</type><parameter>flags</parameter><initializer><constant>FILEINFO_NONE</constant></initializer></methodparam>
16
+
<methodparam choice="opt"><type class="union"><type>string</type><type>null</type></type><parameter>magic_database</parameter><initializer>&null;</initializer></methodparam>
17
17
</methodsynopsis>
18
18
<para>&style.oop; (constructor):</para>
19
-
<constructorsynopsis>
19
+
<constructorsynopsis role="finfo">
20
20
<modifier>public</modifier> <methodname>finfo::__construct</methodname>
21
-
<methodparam choice="opt"><type>int</type><parameter>options</parameter><initializer>FILEINFO_NONE</initializer></methodparam>
22
-
<methodparam choice="opt"><type>string</type><parameter>magic_file</parameter><initializer>&null;</initializer></methodparam>
21
+
<methodparam choice="opt"><type>int</type><parameter>flags</parameter><initializer><constant>FILEINFO_NONE</constant></initializer></methodparam>
22
+
<methodparam choice="opt"><type class="union"><type>string</type><type>null</type></type><parameter>magic_database</parameter><initializer>&null;</initializer></methodparam>
23
23
</constructorsynopsis>
24
24
<para>
25
-
This function opens a magic database and returns its resource.
25
+
This function opens a magic database and returns its instance.
26
26
</para>
27
27
</refsect1>
28
28

...
...
@@ -31,7 +31,7 @@
31
31
<para>
32
32
<variablelist>
33
33
<varlistentry>
34
-
<term><parameter>options</parameter></term>
34
+
<term><parameter>flags</parameter></term>
35
35
<listitem>
36
36
<para>
37
37
One or disjunction of more <link linkend="fileinfo.constants">Fileinfo
...
...
@@ -40,7 +40,7 @@
40
40
</listitem>
41
41
</varlistentry>
42
42
<varlistentry>
43
-
<term><parameter>magic_file</parameter></term>
43
+
<term><parameter>magic_database</parameter></term>
44
44
<listitem>
45
45
<para>
46
46
Name of a magic database file, usually something like
...
...
@@ -63,32 +63,37 @@
63
63
&reftitle.returnvalues;
64
64
<para>
65
65
(Procedural style only)
66
-
Returns a magic database resource on success&return.falseforfailure;.
66
+
Returns an <classname>finfo</classname> instance on success,&return.falseforfailure;.
67
67
</para>
68
68
</refsect1>
69
69

70
-
<refsect1 role="notes">
71
-
&reftitle.notes;
72
-
<warning>
73
-
<para>
74
-
The expected magic database format changed in PHP 5.3.11 and 5.4.1.
75
-
Due to this, the internal magic database was upgraded. This mostly effects
76
-
code where an external magic database is used: reading an older magic file
77
-
will now fail.
78
-
79
-
Also, some textual representations of the mime types has changed, for
80
-
instance for PHP would be "PHP script, ASCII text" instead of "PHP script
81
-
text" returned.
82
-
</para>
83
-
</warning>
84
-
<note>
85
-
<para>
86
-
Generally, using the bundled magic database (by leaving
87
-
<parameter>magic_file</parameter> and the <literal>MAGIC</literal>
88
-
environment variables unset) is the best course of action unless you
89
-
specifically need a custom magic database.
90
-
</para>
91
-
</note>
70
+
<refsect1 role="changelog">
71
+
&reftitle.changelog;
72
+
<informaltable>
73
+
<tgroup cols="2">
74
+
<thead>
75
+
<row>
76
+
<entry>&Version;</entry>
77
+
<entry>&Description;</entry>
78
+
</row>
79
+
</thead>
80
+
<tbody>
81
+
<row>
82
+
<entry>8.1.0</entry>
83
+
<entry>
84
+
Returns an <classname>finfo</classname> instance now;
85
+
previously, a &resource; was returned.
86
+
</entry>
87
+
</row>
88
+
<row>
89
+
<entry>8.0.3</entry>
90
+
<entry>
91
+
<parameter>magic_database</parameter> is nullable now.
92
+
</entry>
93
+
</row>
94
+
</tbody>
95
+
</tgroup>
96
+
</informaltable>
92
97
</refsect1>
93
98

94
99
<refsect1 role="examples">
...
...
@@ -138,6 +143,18 @@ text/plain; charset=us-ascii
138
143
</screen>
139
144
</refsect1>
140
145

146
+
<refsect1 role="notes">
147
+
&reftitle.notes;
148
+
<note>
149
+
<para>
150
+
Generally, using the bundled magic database (by leaving
151
+
<parameter>magic_database</parameter> and the <literal>MAGIC</literal>
152
+
environment variables unset) is the best course of action unless you
153
+
specifically need a custom magic database.
154
+
</para>
155
+
</note>
156
+
</refsect1>
157
+

141
158
<refsect1 role="seealso">
142
159
&reftitle.seealso;
143
160
<para>
...
...
@@ -148,7 +165,6 @@ text/plain; charset=us-ascii
148
165
</refsect1>
149
166

150
167
</refentry>
151
-

152
168
<!-- Keep this comment at the end of the file
153
169
Local variables:
154
170
mode: sgml
155
171