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
|
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<sect1 xml:id="migration72.new-features" xmlns:xlink="http://www.w3.org/1999/xlink">
<title>New features</title>
<sect2 xml:id="migration72.new-features.object-type">
<title>New object type</title>
<para>
A new type, <type>object</type>, has been introduced that can be used for
(contravariant) parameter typing and (covariant) return typing of any
objects.
</para>
<informalexample>
<programlisting role="php">
<![CDATA[
<?php
function test(object $obj) : object
{
return new SplQueue();
}
test(new stdClass());
]]>
</programlisting>
</informalexample>
</sect2>
<sect2 xml:id="migration72.new-features.ext-loading-by-name">
<title>Extension loading by name</title>
<para>
Shared extensions no longer require their file extension
(<literal>.so</literal> for Unix or <literal>.dll</literal> for Windows) to
be specified. This is enabled in the php.ini file, as well as in the
<function>dl</function> function.
</para>
</sect2>
<sect2 xml:id="migration72.new-features.abstract-method-overriding">
<title>Abstract method overriding</title>
<para>
Abstract methods can now be overridden when an abstract class extends
another abstract class.
</para>
<informalexample>
<programlisting role="php">
<![CDATA[
<?php
abstract class A
{
abstract function test(string $s);
}
abstract class B extends A
{
// overridden - still maintaining contravariance for parameters and covariance for return
abstract function test($s) : int;
}
]]>
</programlisting>
</informalexample>
</sect2>
<sect2 xml:id="migration72.new-features.sodium">
<title><link linkend="book.sodium">Sodium</link> is now a core extension</title>
<para>
The modern Sodium cryptography library has now become a core extension in PHP.
</para>
<para>
For a complete function reference, see the <link linkend="book.sodium">Sodium</link>
chapter.
</para>
</sect2>
<sect2 xml:id="migration72.new-features.pws-hashing-with-argon2">
<title>Password hashing with Argon2</title>
<para>
Argon2 has been added to the <link linkend="book.password">password hashing API</link>,
where the following constants have been exposed:
</para>
<itemizedlist>
<listitem>
<simpara>
<constant>PASSWORD_ARGON2I</constant>
</simpara>
</listitem>
<listitem>
<simpara>
<constant>PASSWORD_ARGON2_DEFAULT_MEMORY_COST</constant>
</simpara>
</listitem>
<listitem>
<simpara>
<constant>PASSWORD_ARGON2_DEFAULT_TIME_COST</constant>
</simpara>
</listitem>
<listitem>
<simpara>
<constant>PASSWORD_ARGON2_DEFAULT_THREADS</constant>
</simpara>
</listitem>
</itemizedlist>
</sect2>
<sect2 xml:id="migration72.new-features.pdo-extended-str-types">
<title>Extended string types for <link linkend="book.pdo">PDO</link></title>
<para>
PDO's string type has been extended to support the national character type
when emulating prepares. This has been done with the following constants:
</para>
<itemizedlist>
<listitem>
<simpara>
<constant>PDO::PARAM_STR_NATL</constant>
</simpara>
</listitem>
<listitem>
<simpara>
<constant>PDO::PARAM_STR_CHAR</constant>
</simpara>
</listitem>
<listitem>
<simpara>
<constant>PDO::ATTR_DEFAULT_STR_PARAM</constant>
</simpara>
</listitem>
</itemizedlist>
<para>
These constants are utilised by bitwise <literal>OR</literal>'ing them with
<constant>PDO::PARAM_STR</constant>:
</para>
<informalexample>
<programlisting role="php">
<![CDATA[
<?php
$db->quote('über', PDO::PARAM_STR | PDO::PARAM_STR_NATL);
]]>
</programlisting>
</informalexample>
</sect2>
<sect2 xml:id="migration72.new-features.additional-emulated-prepares-debugging-info">
<title>Additional emulated prepares debugging information for <link linkend="book.pdo">PDO</link></title>
<para>
The <function>PDOStatement::debugDumpParams</function> method has been
updated to include the SQL being sent to the DB, where the full, raw query
(including the replaced placeholders with their bounded values) will be
shown. This has been added to aid with debugging emulated prepares (and so
it will only be available when emulated prepares are turned on).
</para>
</sect2>
<sect2 xml:id="migration72.new-features.extended-ops-in-ldap">
<title>Support for extended operations in <link linkend="book.ldap">LDAP</link></title>
<para>
Support for EXOP has been added to the LDAP extension. This has been done by
exposing the following functions and constants:
</para>
<itemizedlist>
<listitem>
<simpara>
<function>ldap_parse_exop</function>
</simpara>
</listitem>
<listitem>
<simpara>
<function>ldap_exop</function>
</simpara>
</listitem>
<listitem>
<simpara>
<function>ldap_exop_passwd</function>
</simpara>
</listitem>
<listitem>
<simpara>
<function>ldap_exop_whoami</function>
</simpara>
</listitem>
<listitem>
<simpara>
<constant>LDAP_EXOP_START_TLS</constant>
</simpara>
</listitem>
<listitem>
<simpara>
<constant>LDAP_EXOP_MODIFY_PASSWD</constant>
</simpara>
</listitem>
<listitem>
<simpara>
<constant>LDAP_EXOP_REFRESH</constant>
</simpara>
</listitem>
<listitem>
<simpara>
<constant>LDAP_EXOP_WHO_AM_I</constant>
</simpara>
</listitem>
<listitem>
<simpara>
<constant>LDAP_EXOP_TURN</constant>
</simpara>
</listitem>
</itemizedlist>
</sect2>
<sect2 xml:id="migration72.new-features.addr-info-in-sockets">
<title>Address Information additions to the <link linkend="book.sockets">Sockets</link> extension</title>
<para>
The sockets extension now has the ability to lookup address information, as
well as connect to it, bind to it, and explain it. The following four
functions have been added for this:
</para>
<itemizedlist>
<listitem>
<simpara>
<function>socket_addrinfo_lookup</function>
</simpara>
</listitem>
<listitem>
<simpara>
<function>socket_addrinfo_connect</function>
</simpara>
</listitem>
<listitem>
<simpara>
<function>socket_addrinfo_bind</function>
</simpara>
</listitem>
<listitem>
<simpara>
<function>socket_addrinfo_explain</function>
</simpara>
</listitem>
</itemizedlist>
</sect2>
<sect2 xml:id="migration72.new-features.param-type-widening">
<title>Parameter type widening</title>
<para>
Parameter types from overridden methods and from interface implementations
may now be omitted. This is still in compliance with LSP, since parameters
types are contravariant.
</para>
<informalexample>
<programlisting role="php">
<![CDATA[
<?php
interface A
{
public function Test(array $input);
}
class B implements A
{
public function Test($input){} // type omitted for $input
}
]]>
</programlisting>
</informalexample>
</sect2>
<sect2 xml:id="migration72.new-features.trailing-comma-in-grouped-namespaces">
<title>Allow a trailing comma for grouped namespaces</title>
<para>
A trailing comma can now be added to the group-use syntax introduced in
PHP 7.0.
</para>
<informalexample>
<programlisting role="php">
<![CDATA[
<?php
use Foo\Bar\{
Foo,
Bar,
Baz,
};
]]>
</programlisting>
</informalexample>
</sect2>
<sect2 xml:id="migration72.new-features.proc_nice-windows-support">
<title><function>proc_nice</function> support on Windows</title>
<para>
The <function>proc_nice</function> function is now supported on Windows.
</para>
</sect2>
<sect2 xml:id="migration72.new-features.pack-unpack-endian-support">
<title><function>pack</function> and <function>unpack</function> endian support</title>
<para>
The <function>pack</function> and <function>unpack</function> functions now
support float and double in both little and big endian.
</para>
</sect2>
<sect2 xml:id="migration72.new-features.exif-features">
<title>Enhancements to the <link linkend="book.exif">EXIF</link> extension</title>
<para>
The EXIF extension has been updated to support a much larger range of formats. This
means that their format specific tags are now properly translated when parsing images
with the <function>exif_read_data</function> function. The following new formats are
now supported:
</para>
<itemizedlist>
<listitem>
<simpara>
Samsung
</simpara>
</listitem>
<listitem>
<simpara>
DJI
</simpara>
</listitem>
<listitem>
<simpara>
Panasonic
</simpara>
</listitem>
<listitem>
<simpara>
Sony
</simpara>
</listitem>
<listitem>
<simpara>
Pentax
</simpara>
</listitem>
<listitem>
<simpara>
Minolta
</simpara>
</listitem>
<listitem>
<simpara>
Sigma/Foveon
</simpara>
</listitem>
<listitem>
<simpara>
AGFA
</simpara>
</listitem>
<listitem>
<simpara>
Kyocera
</simpara>
</listitem>
<listitem>
<simpara>
Ricoh
</simpara>
</listitem>
<listitem>
<simpara>
Epson
</simpara>
</listitem>
</itemizedlist>
<para>
The EXIF functions <function>exif_read_data</function> and <function>exif_thumbnail</function>
now support passing streams as their first argument.
</para>
</sect2>
<sect2 xml:id="migration72.new-features.pcre">
<title>New features in <link linkend="book.pcre">PCRE</link></title>
<itemizedlist>
<listitem>
<simpara>
The <literal>J</literal> modifier for setting PCRE_DUPNAMES has been added.
</simpara>
</listitem>
</itemizedlist>
</sect2>
<sect2 xml:id="migration72.new-features.sqlite3">
<title><link linkend="book.sqlite3">SQLite3</link> allows writing BLOBs</title>
<para>
<methodname>SQLite3::openBlob</methodname> now allows to open BLOB fields in
write mode; formerly only read mode was supported.
</para>
</sect2>
<sect2 xml:id="migration72.new-features.oci8">
<title><link linkend="book.oci8">Oracle OCI8</link> Transparent Application Failover Callbacks</title>
<para>
Support for <link linkend="oci8.taf">Oracle Database Transparent Application Failover (TAF) callbacks</link>
has been added. TAF allows PHP OCI8 applications to
automatically reconnect to a preconfigured database when a connection
is broken. The new TAF callback support allows PHP applications to
monitor and control reconnection during failover.
</para>
</sect2>
<sect2 xml:id="migration72.new-features.zip">
<title>Enhancements to the <link linkend="book.zip">ZIP</link> extension</title>
<para>
Read and write support for encrypted archives has been added (requires libzip 1.2.0).
</para>
<para>
The <classname>ZipArchive</classname> class now implements the <interfacename>Countable</interfacename>
interface.
</para>
<para>
The <literal>zip://</literal> stream now accepts a <literal>'password'</literal> context option.
</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
-->
|