|
New features
Constant expressions
It is now possible to provide a scalar expression involving numeric and
string literals and/or constants in contexts where PHP previously expected
a static value, such as constant and property declarations and default
function arguments.
It is also now possible to define a constant array using the
const keyword:
Variadic functions via ...
Variadic functions can
now be implemented using the ... operator, instead of
relying on func_get_args.
Argument unpacking via ...
Arrays and
Traversable objects can be unpacked into
argument lists when calling functions by using the ...
operator. This is also known as the splat operator in other languages,
including Ruby.
Exponentiation via **
A right associative ** operator has been added to
support exponentiation, along with a **= shorthand
assignment operator.
use function and use const
The
use
operator has been extended to support importing functions and constants in
addition to classes. This is achieved via the
use function and use const
constructs, respectively.
phpdbg
PHP now includes an interactive debugger called phpdbg implemented as a
SAPI module. For more information, please visit the
phpdbg documentation.
Default character encoding
default_charset is now used as
the default character set for the htmlentities,
html_entity_decode and
htmlspecialchars functions. Note that if the (now
deprecated) iconv and mbstring encoding settings are set, they will take
precedence over default_charset for iconv and mbstring functions,
respectively.
The default value for this setting is UTF-8 .
Large file uploads
Files larger than 2 gigabytes in size are now accepted.
GMP supports operator overloading
GMP objects now support operator
overloading and casting to scalar types. This allows for more expressive
code using GMP:
hash_equals for timing attack safe string comparison
The hash_equals function has been added to compare
two strings in constant time. This should be used to mitigate timing
attacks; for instance, when testing crypt password
hashes (assuming that you are unable to use
password_hash and
password_verify, which aren't susceptible to timing
attacks).
__debugInfo()
The __debugInfo()
magic method has been added to allow objects to change the properties and
values that are shown when the object is output using
var_dump.
gost-crypto hash algorithm
The gost-crypto hash algorithm has been added. This
implements the GOST hash function using the CryptoPro S-box tables as
specified by
» RFC 4357, section 11.2.
SSL/TLS improvements
A wide range of improvements have been made to the SSL/TLS support in PHP
5.6. These include
enabling peer verification by default,
supporting certificate fingerprint matching, mitigating against TLS
renegotiation attacks, and many new
SSL context options to allow more fine
grained control over protocol and verification settings when using
encrypted streams.
These changes are described in more detail in the
OpenSSL changes in PHP 5.6.x
section of this migration guide.
pgsql async support
The pgsql extension now supports
asynchronous connections and queries, thereby enabling non-blocking
behaviour when interacting with PostgreSQL databases. Asynchronous
connections may be established via the
PGSQL_CONNECT_ASYNC constant, and the new
pg_connect_poll, pg_socket,
pg_consume_input and pg_flush
functions may be used to handle asynchronous connections and queries.
|