Backward incompatible changes

Although most existing PHP 5 code should work without changes, please take note of some backward incompatible changes:

Array keys won't be overwritten when defining an array as a property of a class via an array literal

Previously, arrays declared as class properties which mixed explicit and implicit keys could have array elements silently overwritten if an explicit key was the same as a sequential implicit key. For example:

<?php
class C {
const
ONE = 1;
public
$array = [
self::ONE => 'foo',
'bar',
'quux',
];
}

var_dump((new C)->array);
?>

Π’ PHP 5.5 ΠΏΠΎΠ΄Π°Π½ΠΈΠΉ Π²ΠΈΡ‰Π΅ ΠΏΡ€ΠΈΠΊΠ»Π°Π΄ Π²ΠΈΠ²Π΅Π΄Π΅:

array(2) {
  [0]=>
  string(3) "bar"
  [1]=>
  string(4) "quux"
}

Π’ PHP 5.6 ΠΏΠΎΠ΄Π°Π½ΠΈΠΉ Π²ΠΈΡ‰Π΅ ΠΏΡ€ΠΈΠΊΠ»Π°Π΄ Π²ΠΈΠ²Π΅Π΄Π΅:

array(3) {
  [1]=>
  string(3) "foo"
  [2]=>
  string(3) "bar"
  [3]=>
  string(4) "quux"
}

json_decode() strictness

json_decode() now rejects non-lowercase variants of the JSON literals true, false and null at all times, as per the JSON specification, and sets json_last_error() accordingly. Previously, inputs to json_decode() that consisted solely of one of these values in upper or mixed case were accepted.

This change will only affect cases where invalid JSON was being passed to json_decode(): valid JSON input is unaffected and will continue to be parsed normally.

Stream wrappers now verify peer certificates and host names by default when using SSL/TLS

Усі ΡˆΠΈΡ„Ρ€ΠΎΠ²Π°Π½Ρ– ΠΊΠ»Ρ–Ρ”Π½Ρ‚ΡΡŒΠΊΡ– ΠΏΠΎΡ‚ΠΎΠΊΠΈ Ρ‚Π΅ΠΏΠ΅Ρ€ Π²ΠΌΠΈΠΊΠ°ΡŽΡ‚ΡŒ ΠΎΠ΄Π½ΠΎΡ€Π°Π½Π³ΠΎΠ²Ρƒ ΠΏΠ΅Ρ€Π΅Π²Ρ–Ρ€ΠΊΡƒ. Π’ΠΈΠΊΠΎΡ€ΠΈΡΡ‚ΠΎΠ²ΡƒΡ”Ρ‚ΡŒΡΡ стандартний ΠΏΠ°ΠΊΠ΅Ρ‚ CA Π²Ρ–Π΄ OpenSSL для ΠΏΠ΅Ρ€Π΅Π²Ρ–Ρ€ΠΊΠΈ ΠΎΠ΄Π½ΠΎΡ€Π°Π½Π³ΠΎΠ²ΠΎΠ³ΠΎ сСртифіката. Π—Π΄Π΅Π±Ρ–Π»ΡŒΡˆΠΎΠ³ΠΎ Π½Π΅ ΠΏΠΎΡ‚Ρ€Ρ–Π±Π½ΠΎ вносити ΠΆΠΎΠ΄Π½ΠΈΡ… Π·ΠΌΡ–Π½ для Π·Π²'язку Ρ–Π· сСрвСрами, Ρ‰ΠΎ ΠΌΠ°ΡŽΡ‚ΡŒ дійсні сСртифікати SSL, ΠΎΡΠΊΡ–Π»ΡŒΠΊΠΈ дистриб'ΡŽΡ‚ΠΎΡ€ΠΈ Π·Π°Π·Π²ΠΈΡ‡Π°ΠΉ Π½Π°Π»Π°ΡˆΡ‚ΠΎΠ²ΡƒΡŽΡ‚ΡŒ OpenSSL Π½Π° використання Π΄ΠΎΠ±Ρ€Π΅ Π²Ρ–Π΄ΠΎΠΌΠΈΡ… ΠΏΠ°ΠΊΠ΅Ρ‚Ρ–Π² CA.

Π‘Ρ‚Π°Π½Π΄Π°Ρ€Ρ‚Π½ΠΈΠΉ ΠΏΠ°ΠΊΠ΅Ρ‚ CA ΠΌΠΎΠΆΠ΅ Π±ΡƒΡ‚ΠΈ Π·ΠΌΡ–Π½Π΅Π½ΠΈΠΉ для всього сСрвСра Π·Π° допомогою Π΄ΠΈΡ€Π΅ΠΊΡ‚ΠΈΠ² openssl.cafile Π°Π±ΠΎ openssl.capath, Π° Ρ‚Π°ΠΊΠΎΠΆ для ΠΎΠΊΡ€Π΅ΠΌΠΎΠ³ΠΎ Π·Π°ΠΏΠΈΡ‚Ρƒ Π·Π° допомогою ΠΎΠΏΡ†Ρ–ΠΉ контСксту cafile Π°Π±ΠΎ capath context options.

Π₯ΠΎΡ‡Π° Ρ†Π΅ Π½Π΅ Ρ€Π΅ΠΊΠΎΠΌΠ΅Π½Π΄ΡƒΡ”Ρ‚ΡŒΡΡ, Π°Π»Π΅ ΠΌΠΎΠΆΠ½Π° Π²ΠΈΠΌΠΊΠ½ΡƒΡ‚ΠΈ ΠΏΠ΅Ρ€Π΅Π²Ρ–Ρ€ΠΊΡƒ ΠΎΠ΄Π½ΠΎΡ€Π°Π½Π³ΠΎΠ²ΠΎΠ³ΠΎ сСртифіката Π² Π·Π°ΠΏΠΈΡ‚Ρ–, Π²ΡΡ‚Π°Π½ΠΎΠ²ΠΈΠ²ΡˆΠΈ ΠΎΠΏΡ†Ρ–ΡŽ контСксту verify_peer як false, Π°Π±ΠΎ Π²ΠΈΠΌΠΊΠ½ΡƒΡ‚ΠΈ ΠΏΠ΅Ρ€Π΅Π²Ρ–Ρ€ΠΊΡƒ Ρ–ΠΌΠ΅Π½Ρ– ΠΎΠ΄Π½ΠΎΡ€Π°Π½Π³ΠΎΠ²ΠΎΠ³ΠΎ ΠΏΡ€ΠΈΡΡ‚Ρ€ΠΎΡŽ, Π²ΡΡ‚Π°Π½ΠΎΠ²ΠΈΠ²ΡˆΠΈ ΠΎΠΏΡ†Ρ–ΡŽ контСксту verify_peer_name як false.

GMP resources are now objects

GMP resources are now objects. The functional API implemented in the GMP extension has not changed, and code should run unmodified unless it checks explicitly for a resource using is_resource() or similar.

Mcrypt functions now require valid keys and IVs

mcrypt_encrypt(), mcrypt_decrypt(), mcrypt_cbc(), mcrypt_cfb(), mcrypt_ecb(), mcrypt_generic() and mcrypt_ofb() will no longer accept keys or IVs with incorrect sizes, and block cipher modes that require IVs will now fail if an IV isn't provided.

cURL file uploads

Uploads using the @file syntax now require CURLOPT_SAFE_UPLOAD to be set to false. CURLFile should be used instead.

οΌ‹add a note

User Contributed Notes

There are no user contributed notes for this page.