下位互換性のない変更点
オブジェクトと配列の型変換における数値キーの扱い
配列からオブジェクトへのキャストやその逆のキャストにおける、数値キーの扱いが改善されました。
明示的なキャストだけではなく settype() を使った場合も同様です。
数値キーの配列をオブジェクトにキャストしたときに、その要素にアクセスできるようになったのです。
また、オブジェクトに数値のキーが含まれる場合に、
配列にキャストしてもその要素にアクセスできるようになりました。
以前のバージョンでは、get_class() に NULL
を渡すと、そのコンテキストの外側のクラスを返していました。
この機能は削除され、NULL
を渡すと E_WARNING
が発生するようになりました。
以前と同様の挙動を実現したい場合は、NULL
を渡すのではなく単にパラメータを省略するようにしあしょう。
countabe ではない型をカウントしたときの警告
countable ではない型に対して count() (およびそのエイリアスである
sizeof()) を使ったときに
E_WARNING
が発生するようになりました。
ext/hash がリソースからオブジェクトへ
長期にわたるリソースからオブジェクトへの移行作業の一環として、
Hash 拡張モジュールがリソースではなくオブジェクトを使うようになりました。
開発者側から見て特に変わるところはありませんが、もし
is_resource() を使ったチェックを行っているのなら、
それを is_object() に書き換える必要があります。
SSL/TLS のデフォルトの改善
デフォルト設定が以下のように変わりました。
-
tls:// が、TLSv1.0 や TLSv1.1 や TLSv1.2 のデフォルトになりました。
-
ssl:// は tls:// のエイリアスになりました。
-
STREAM_CRYPTO_METHOD_TLS_* 定数のデフォルトが、
TLSv1.0 だけではなく TLSv1.0 または TLSv1.1 + TLSv1.2 となりました。
gettype() return value on closed resources
Previously, using gettype() on a closed resource would
return a string of "unknown type". Now, a string of
"resource (closed)" will be returned.
is_object() and __PHP_Incomplete_Class
Previously, using is_object() on the
__PHP_Incomplete_Class class would return FALSE
.
Now, TRUE
will be returned.
Promote the error level of undefined constants
Unqualified references to undefined constants will now generate an
E_WARNING
(instead of an E_NOTICE
).
In the next major version of PHP, they will generate
Error exceptions.
Windows support
The officially supported, minimum Windows versions are now Windows 7/Server
2008 R2.
Checks on default property values of traits
Compatibilitiy checks upon default trait property values will no longer
perform casting.
object for class names
The object name was previously soft-reserved in PHP 7.0.
This is now hard-reserved, prohibiting it from being used as a class, trait,
or interface name.
NetWare support
Support for NetWare has now been removed.
bcmod() changes with floats
The bcmod() function no longer truncates fractional
numbers to integers. As such, its behavior now follows
fmod(), rather than the % operator.
For example bcmod('4', '3.5') now returns
0.5 instead of 1.
The json_decode() function option,
JSON_OBJECT_AS_ARRAY
, is now used if the second
parameter (assoc) is NULL
. Previously,
JSON_OBJECT_AS_ARRAY
was always ignored.
Sequences generated by rand() and
mt_rand() for a specific seed may differ from PHP 7.1 on
64-bit machines (due to the fixing of a modulo bias bug in the
implementation).
The sql.safe_mode
ini setting has now been removed.