-
Notifications
You must be signed in to change notification settings - Fork 788
/
Copy pathnew-features.xml
491 lines (424 loc) · 14.4 KB
/
new-features.xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
<?xml version="1.0" encoding="utf-8"?>
<sect1 xml:id="migration81.new-features" xmlns:xlink="http://www.w3.org/1999/xlink">
<title>New Features</title>
<sect2 xml:id="migration81.new-features.core">
<title>PHP Core</title>
<sect3 xml:id="migration81.new-features.core.octal-literal-prefix">
<title>Integer Octal Literal Prefix</title>
<para>
Octal integers can now use an explicit
<literal>0o</literal>/<literal>0O</literal>
prefix in integer literals,
similarly to binary and hexadecimal integer literals.
<informalexample>
<programlisting role="php">
<![CDATA[
<?php
014; // Non-prefix octal literal
0o14; // Prefixed octal literal
?>
]]>
</programlisting>
</informalexample>
</para>
<!-- RFC: https://wiki.php.net/rfc/explicit_octal_notation -->
</sect3>
<sect3 xml:id="migration81.new-features.core.unpacking-string-keys">
<title>Array Unpacking with String Keys</title>
<para>
Added support for <link linkend="language.types.array.unpacking">array unpacking with strings keys</link>.
<informalexample>
<programlisting role="php">
<![CDATA[
<?php
$arr1 = [1, 'a' => 'b'];
$arr2 = [...$arr1, 'c' => 'd']; //[1, 'a' => 'b', 'c' => 'd']
?>
]]>
</programlisting>
</informalexample>
</para>
<!-- RFC: https://wiki.php.net/rfc/array_unpacking_string_keys -->
</sect3>
<sect3 xml:id="migration81.new-features.core.named-arg-after-unpack">
<title>Named Argument After Argument Unpacking</title>
<para>
It is now possible to specify named arguments after an argument unpack.
<!-- TODO Add an example -->
e.g.
foo(...$args, named: $arg).
</para>
</sect3>
<sect3 xml:id="migration81.new-features.core.upload-full-path-key">
<title>full-path Key for File Uploads</title>
<para>
File uploads now provide an additional <literal>full_path</literal> key,
which contains the full path (rather than just the basename) of the uploaded file.
This is intended for use in conjunction with "upload webkitdirectory".
</para>
<!-- RFC: https://wiki.php.net/rfc/array_unpacking_string_keys -->
</sect3>
<sect3 xml:id="migration81.new-features.core.enums">
<title>Enumerations</title>
<para>
Support for <link linkend="language.enumerations">Enumerations</link> has been added.
<!-- RFC: https://wiki.php.net/rfc/enumerations -->
</para>
</sect3>
<sect3 xml:id="migration81.new-features.core.fibers">
<title>Fibers</title>
<para>
Support for <link linkend="language.fibers">Fibers</link> has been added.
<!-- RFC: https://wiki.php.net/rfc/fibers -->
</para>
</sect3>
<sect3 xml:id="migration81.new-features.core.callable-syntax">
<title>First Class Callable Syntax</title>
<para>
Closures for callables can now be created using <link linkend="functions.first_class_callable_syntax">the syntax <code>myFunc(...)</code></link>,
which is identical to <code>Closure::fromCallable('myFunc')</code>.
<!-- RFC: https://wiki.php.net/rfc/first_class_callable_syntax -->
</para>
<note>
<simpara>
The <code>...</code> is part of the syntax, and not an omission.
</simpara>
</note>
</sect3>
<sect3 xml:id="migration81.new-features.core.intersection-types">
<title>Intersection Types</title>
<para>
Support for <link linkend="language.types.type-system.composite.intersection">intersection types</link> has been added.
<!-- RFC: https://wiki.php.net/rfc/pure-intersection-types -->
</para>
<caution>
<simpara>
<link linkend="language.types.type-system.composite.intersection">
Intersection types</link> cannot be used together with
<link linkend="language.types.declarations.composite.union">
union types</link>
</simpara>
</caution>
</sect3>
<sect3 xml:id="migration81.new-features.core.never-type">
<title>Never type</title>
<para>
A new return only type &never; has been added.
This indicates that a function either <function>exit</function>,
throws an exception, or doesn't terminate.
<!-- RFC: https://wiki.php.net/rfc/noreturn_type -->
</para>
</sect3>
<sect3 xml:id="migration81.new-features.core.new-in-initializer">
<title>&new; in Initializers</title>
<para>
It is now possible to use <code>new ClassName()</code> expressions as the
default value of a parameter, static variable, global constant initializers,
and as attribute arguments.
Objects can also be passed to <function>define</function> now.
<!-- TODO Add an example -->
</para>
<!-- RFC: https://wiki.php.net/rfc/new_in_initializers -->
</sect3>
<sect3 xml:id="migration81.new-features.core.readonly">
<title>Readonly properties</title>
<para>
Support for <link linkend="language.oop5.properties.readonly-properties">readonly</link> has been added.
<!-- RFC: https://wiki.php.net/rfc/readonly_properties_v2 -->
</para>
</sect3>
<sect3 xml:id="migration81.new-features.core.final-constants">
<title>Final class constants</title>
<para>
Added support for <link linkend="language.oop5.final.example.php81">the <modifier>final</modifier> modifier for class constants</link>.
Also, interface constants become overridable by default.
<!-- RFC: https://wiki.php.net/rfc/final_class_const -->
</para>
</sect3>
</sect2>
<sect2 xml:id="migration81.new-features.curl">
<title>CURL</title>
<para>
Added the <constant>CURLOPT_DOH_URL</constant> option.
</para>
<para>
Added options for blob certificate when libcurl >= 7.71.0:
</para>
<itemizedlist>
<listitem>
<simpara><constant>CURLOPT_ISSUERCERT_BLOB</constant></simpara>
</listitem>
<listitem>
<simpara><constant>CURLOPT_PROXY_ISSUERCERT</constant></simpara>
</listitem>
<listitem>
<simpara><constant>CURLOPT_PROXY_ISSUERCERT_BLOB</constant></simpara>
</listitem>
<listitem>
<simpara><constant>CURLOPT_PROXY_SSLCERT_BLOB</constant></simpara>
</listitem>
<listitem>
<simpara><constant>CURLOPT_PROXY_SSLKEY_BLOB</constant></simpara>
</listitem>
<listitem>
<simpara><constant>CURLOPT_SSLCERT_BLOB</constant></simpara>
</listitem>
<listitem>
<simpara><constant>CURLOPT_SSLKEY_BLOB</constant></simpara>
</listitem>
</itemizedlist>
<para>
Added <classname>CURLStringFile</classname>, which can be used to post
a file from a &string; rather than a file:
<informalexample>
<programlisting role="php">
<![CDATA[
<?php
$file = new CURLStringFile($data, 'filename.txt', 'text/plain');
curl_setopt($curl, CURLOPT_POSTFIELDS, ['file' => $file]);
?>
]]>
</programlisting>
</informalexample>
</para>
</sect2>
<sect2 xml:id="migration81.new-features.fpm">
<title>FPM</title>
<para>
Added openmetrics status format. It can be used by Prometheus to fetch FPM
metrics.
</para>
<para>
Added new pool option for the dynamic process manager called
<literal>pm.max_spawn_rate</literal>. It allows to start a number of children
at a faster rate when dynamic pm is selected.
The default value is <literal>32</literal> which was the previous
hard coded value.
</para>
</sect2>
<sect2 xml:id="migration81.new-features.gd">
<title>GD</title>
<para>
Avif support is now available through
<function>imagecreatefromavif</function> and
<function>imageavif</function>,
if libgd has been built with Avif support.
</para>
</sect2>
<sect2 xml:id="migration81.new-features.hash">
<title>Hash</title>
<para>
The following functions <function>hash</function>,
<function>hash_file</function>, and <function>hash_init</function>
now support an additional optional <parameter>options</parameter>
argument, which can be used to pass algorithm specific data.
</para>
<sect3 xml:id="migration81.new-features.hash.murmurhash3">
<title>MurmurHash3</title>
<para>
Added support for <literal>MurmurHash3</literal> with streaming
support. The following variants are implemented:
</para>
<itemizedlist>
<listitem>
<simpara>murmur3a, 32-bit hash</simpara>
</listitem>
<listitem>
<simpara>murmur3c, 128-bit hash for x86</simpara>
</listitem>
<listitem>
<simpara>murmur3f, 128-bit hash for x64</simpara>
</listitem>
</itemizedlist>
<para>
The initial hash state can be passed through the <literal>seed</literal>
key in the <parameter>options</parameter> array, for example:
<informalexample>
<programlisting role="php">
<![CDATA[
<?php
$h = hash("murmur3f", $data, options: ["seed" => 42]);
echo $h, "\n";
?>
]]>
</programlisting>
</informalexample>
A valid seed value is within the range from <literal>0</literal>
to the platform defined <constant>UINT_MAX</constant>, usually
<literal>4294967295</literal>.
</para>
</sect3>
<sect3 xml:id="migration81.new-features.hash.xxhash">
<title>xxHash</title>
<para>
Added support for <literal>xxHash</literal>.
The following variants are implemented:
</para>
<itemizedlist>
<listitem>
<simpara>xxh32, 32-bit hash</simpara>
</listitem>
<listitem>
<simpara>xxh64, 64-bit hash</simpara>
</listitem>
<listitem>
<simpara>xxh3, 64-bit hash</simpara>
</listitem>
<listitem>
<simpara>xxh128, 128-bit hash</simpara>
</listitem>
</itemizedlist>
<para>
The initial hash state can be passed through the <literal>seed</literal>
key in the <parameter>options</parameter> array, for example:
<informalexample>
<programlisting role="php">
<![CDATA[
<?php
$h = hash("xxh3", $data, options: ["seed" => 42]);
echo $h, "\n";
?>
]]>
</programlisting>
</informalexample>
Secret usage is supported through passing the <literal>secret</literal>
key in the <parameter>options</parameter> array, too:
<informalexample>
<programlisting role="php">
<![CDATA[
<?php
$h = hash("xxh3", $data, options: ["secret" => "at least 136 bytes long secret here"]);
echo $h, "\n";
?>
]]>
</programlisting>
</informalexample>
The quality of the custom secret is crucial for the quality of the resulting hash.
It is highly recommended for the secret to use the best possible entropy.
</para>
</sect3>
</sect2>
<sect2 xml:id="migration81.new-features.mysqli">
<title>MySQLi</title>
<sect3 xml:id="migration81.new-features.mysqli.local_infile_directory">
<title>New INI directive <literal>mysqli.local_infile_directory</literal></title>
<para>
The <link linkend="ini.mysqli.local-infile-directory">mysqli.local_infile_directory</link>
INI directive has been added, which can be used to specify a directory from
which files are allowed to be loaded. It is only meaningful if
<link linkend="ini.mysqli.allow-local-infile">mysqli.allow_local_infile</link>
is not enabled, as all directories are allowed in that case.
</para>
</sect3>
<sect3 xml:id="migration81.new-features.mysqli.bind-in-execute">
<title>Binding parameters in execute</title>
<para>
It is now possible to bind parameters by passing them as an array to
<methodname>mysqli_stmt::execute</methodname>. All values will be bound as
strings. Only list arrays are allowed. This new feature is not available
when MySQLi is compiled with libmysqlclient.
<!-- RFC: https://wiki.php.net/rfc/mysqli_bind_in_execute -->
<informalexample>
<programlisting role="php">
<![CDATA[
<?php
$stmt = $mysqli->prepare('INSERT INTO users(id, name) VALUES(?,?)');
$stmt->execute([1, $username]);
?>
]]>
</programlisting>
</informalexample>
</para>
</sect3>
<sect3 xml:id="migration81.new-features.mysqli.mysqli_fetch_column">
<title>New method <methodname>mysqli_result::fetch_column</methodname></title>
<para>
<methodname>mysqli_result::fetch_column</methodname>
has been added to allow fetching a single scalar value from the result set.
The new method accepts an optional 0-based <parameter>column</parameter>
parameter of type &integer; specifying which column to fetch from.
<!-- RFC: https://wiki.php.net/rfc/mysqli_fetch_column -->
<informalexample>
<programlisting role="php">
<![CDATA[
<?php
$result = $mysqli->query('SELECT username FROM users WHERE id = 123');
echo $result->fetch_column();
?>
]]>
</programlisting>
</informalexample>
</para>
</sect3>
</sect2>
<sect2 xml:id="migration81.new-features.pdo_mysql">
<title>PDO</title>
<para>
The <constant>PDO::MYSQL_ATTR_LOCAL_INFILE_DIRECTORY</constant> attribute
has been added, which can be used to specify a directory from which files
are allowed to be loaded.
It is only meaningful if <constant>PDO::MYSQL_ATTR_LOCAL_INFILE</constant>
is not enabled, as all directories are allowed in that case.
</para>
</sect2>
<sect2 xml:id="migration81.new-features.pdo_sqlite">
<title>PDO_SQLite</title>
<para>
SQLite's <literal>"file:"</literal> DSN syntax is now supported,
which allows specifying additional flags.
This feature is not available if open_basedir is set.
<informalexample>
<programlisting role="php">
<![CDATA[
<?php
new PDO('sqlite:file:path/to/sqlite.db?mode=ro')
?>
]]>
</programlisting>
</informalexample>
</para>
</sect2>
<sect2 xml:id="migration81.new-features.posix">
<title>POSIX</title>
<para>
Added <constant>POSIX_RLIMIT_KQUEUES</constant> and <constant>POSIX_RLIMIT_NPTS</constant>.
These rlimits are only available on FreeBSD.
</para>
</sect2>
<sect2 xml:id="migration81.new-features.standard">
<title>Standard</title>
<para>
<function>fputcsv</function> now accepts a new
<parameter>eol</parameter> argument which allows to define a custom
End of Line sequence, the default remains the same and is <literal>"\n"</literal>.
</para>
</sect2>
<sect2 xml:id="migration81.new-features.spl">
<title>SPL</title>
<para>
<methodname>SplFileObject::fputcsv</methodname> now accepts a new
<parameter>eol</parameter> argument which allows to define a custom
End of Line sequence, the default remains the same and is <literal>"\n"</literal>.
</para>
</sect2>
</sect1>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->