UPGRADING 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531
  1. $Id$
  2. PHP 5.6 UPGRADE NOTES
  3. 1. Backward Incompatible Changes
  4. 2. New Features
  5. 3. Changes in SAPI modules
  6. 4. Deprecated Functionality
  7. 5. Changed Functions
  8. 6. New Functions
  9. 7. New Classes and Interfaces
  10. 8. Removed Extensions
  11. 9. Other Changes to Extensions
  12. 10. New Global Constants
  13. 11. Changes to INI File Handling
  14. 12. Other Changes
  15. ========================================
  16. 1. Backward Incompatible Changes
  17. ========================================
  18. - Core:
  19. By fixing bug #66015 it is no longer possible to overwrite keys in static scalar
  20. arrays. Quick example to illustrate:
  21. class Test {
  22. const FIRST = 1;
  23. public $array = array(
  24. self::FIRST => 'first',
  25. 'second',
  26. 'third'
  27. );
  28. }
  29. Test::$array will have as expected three array keys (1, 2, 3) and no longer
  30. two (0, 1). self::FIRST will no longer overwrite 'third' having key 1 then,
  31. but will mark the beginning of indexing.
  32. - JSON:
  33. json_decode() no longer accepts non-lowercase variants of lone JSON true,
  34. false or null values. For example, True or FALSE will now cause json_decode to
  35. return NULL and set an error value you can fetch with json_last_error().
  36. This affects JSON texts consisting solely of true, false or null. Text
  37. containing non-lowercase values inside JSON arrays or objects has never been
  38. accepted.
  39. - OpenSSL:
  40. To prevent man-in-the-middle attacks against encrypted transfers client
  41. streams now verify peer certificates by default. Previous versions
  42. required users to manually enable peer verification. As a result of this
  43. change, existing code using ssl:// or tls:// stream wrappers (e.g.
  44. file_get_contents(), fsockopen(), stream_socket_client()) may no longer
  45. connect successfully without manually disabling peer verification via the
  46. stream context's "verify_peer" setting. Encrypted transfers delegate to
  47. operating system certificate stores by default if not overridden via the
  48. new openssl.cafile and openssl.cafile ini directives or via call-time SSL
  49. context options, so most users should be unaffected by this transparent
  50. security enhancement. (https://wiki.php.net/rfc/tls-peer-verification)
  51. - Mcrypt:
  52. The mcrypt_encrypt(), mcrypt_decrypt() and mcrypt_{MODE}() functions no
  53. longer accept keys or IVs with incorrect sizes. Furthermore an IV is now
  54. required if the used block cipher mode requires it.
  55. - cURL:
  56. Uploads using the @file syntax are now unsupported by default.
  57. - IMAP:
  58. Starting with 5.6.38, rsh/ssh logins are disabled by default. Use
  59. imap.enable_insecure_rsh if you want to enable them. Note that the IMAP
  60. library does not filter mailbox names before passing them to rsh/ssh
  61. command, thus passing untrusted data to this function with rsh/ssh enabled
  62. is insecure.
  63. ========================================
  64. 2. New Features
  65. ========================================
  66. - Added constant scalar expressions syntax.
  67. (https://wiki.php.net/rfc/const_scalar_exprs)
  68. - Added dedicated syntax for variadic functions.
  69. (https://wiki.php.net/rfc/variadics)
  70. - Added support for argument unpacking to complement the variadic syntax.
  71. (https://wiki.php.net/rfc/argument_unpacking)
  72. - Added an exponentiation operator (**).
  73. (https://wiki.php.net/rfc/pow-operator)
  74. - Added unified default encoding. default_charset=UTF-8 and functions/extensions
  75. use encoding settings honor default_charset.
  76. - The php://input stream is now re-usable and can be used concurrently with
  77. enable_post_data_reading=0.
  78. - Added use function and use const.
  79. (https://wiki.php.net/rfc/use_function)
  80. - Added a function for timing attack safe string comparison
  81. (https://wiki.php.net/rfc/timing_attack)
  82. - Added the __debugInfo() magic method to allow userland classes to implement
  83. the get_debug_info API previously available only to extensions.
  84. (https://wiki.php.net/rfc/debug-info)
  85. - Added gost-crypto (CryptoPro S-box) hash algorithm.
  86. - Stream wrappers verify peer certificates and host names by default in
  87. encrypted client streams.
  88. - Added openssl certificate fingerprint support (inclusive stream context
  89. option).
  90. - Added support for SAN x509 extension matching when verifing host names in
  91. encrypted streams.
  92. - Added a range of new SSL context options for improved encrypted stream
  93. server security (https://wiki.php.net/rfc/improved-tls-defaults):
  94. . "honor_cipher_order" allows servers to prioritize cipher suites of their
  95. choosing when negotiating SSL/TLS handshakes.
  96. . "single_ecdh_use" and "single_dh_use" allow for improved forward
  97. secrecy in encrypted stream servers.
  98. . "dh_param" allows specification of pre-generated key generation
  99. parameters when negotiating ephemeral DHE ciphers in stream servers.
  100. . "ecdh_curve" allows stream servers to specify which curve to use when
  101. negotiating ephemeral ECDHE ciphers (defaults to NIST P-256).
  102. . "rsa_key_size" SSL context option gives stream servers control
  103. over the key size (in bits) used when negotiating RSA ciphers.
  104. . "capture_session_meta" if specified stores an array of data describing
  105. the TLS session's protocol/cipher in the "session_meta" SSL context key.
  106. - Added automatic mitigation against client-initated TLS renegotiation DoS
  107. attacks in encrypted server streams. Renegotiation limiting may be
  108. customized via three new SSL context options:
  109. . "reneg_limit" (number of allowed renegotiations per time window)
  110. . "reneg_window" (renegotiation time window in seconds)
  111. . "reneg_limit_callback" (optional notification callback on limiting)
  112. - Encrypted TLS servers now support the server name indication (SNI) TLS
  113. extension via the new "SNI_server_certs" SSL context option.
  114. - Added "crypto_method" SSL context option for use in encrypted streams.
  115. - Added "peer_name" SSL context option to better reflect peer certificate
  116. name matching using SAN extension (replaces deprecated "CN_match").
  117. - Added stream wrapper support when specifying "cafile" SSL context paths.
  118. - Independent peer cert and peer name validation is now available via a new
  119. boolean "verify_peer_name" SSL context option. This option is enabled by
  120. default in encrypted client streams.
  121. - Added protocol-specific tlsv1.0://, tlsv1.1:// and tlsv1.2:// encryption
  122. stream wrappers. tls:// wrapper now supports TLSv1.1 and TLSv1.2 (previously
  123. only supported TLSv1).
  124. - Stream crypto method specification now accepts flags instead of values
  125. allowing support for multiple discrete protocols in a given stream.
  126. - PostgreSQL database connections may now be established asynchronously using
  127. new constants and polling functions in ext/pgsql.
  128. - Non-blocking read/write query behavior now optionally available in database
  129. operations using the ext/pgsql extension.
  130. ========================================
  131. 3. Changes in SAPI modules
  132. ========================================
  133. - Added phpdbg SAPI.
  134. (https://wiki.php.net/rfc/phpdbg)
  135. - Support for FPM workers changing the apparmor profile through the pool configuration.
  136. (https://wiki.php.net/rfc/fpm_change_hat)
  137. - Support for several XML MIME types in the built-in CLI server. For static
  138. files with extensions .xml, .xsl, .xsd the Content-Type header
  139. application/xml is now sent automatically.
  140. ========================================
  141. 4. Deprecated Functionality
  142. ========================================
  143. - Incompatible context calls:
  144. Instance calls from an incompatible context are now deprecated and issue
  145. E_DEPRECATED instead of E_STRICT. See https://wiki.php.net/rfc/incompat_ctx
  146. - The "CN_match" and "SNI_server_name" SSL context options are deprecated in
  147. favor of the new "peer_name" option. Name verification now checks certificate
  148. SAN names as well as the CN field and the specific name fields are deprecated
  149. to avoid confusion. Their use triggers E_DEPRECATED but continues to work as
  150. before. If specified, the specific values take precedence over the general
  151. "peer_name" value.
  152. - Deprecated PDO::PGSQL_ATTR_DISABLE_NATIVE_PREPARED_STATEMENT, an
  153. undocument constant effectively equivalent to PDO::ATTR_EMULATE_PREPARES.
  154. - Deprecated INIs: Following INIs are deprecated in favour of new
  155. internal_encoding/input_encoding/output_encoding. Refer to "Changes to
  156. encodings in PHP 5.6" in "11. Other Changes" section for more details.
  157. iconv.input_encoding
  158. iconv.output_encoding
  159. iconv.internal_encoding
  160. mbstring.http_input
  161. mbstring.http_output
  162. mbstring.internal_encoding
  163. ========================================
  164. 5. Changed Functions
  165. ========================================
  166. - cURL:
  167. CURLOPT_SAFE_UPLOAD is now turned on by default and uploads with @file
  168. do not work unless it is explicitly set to false.
  169. curl_setopt() now supports the following nullable settings (>= 5.5.11):
  170. . CURLOPT_CUSTOMREQUEST
  171. . CURLOPT_FTPPORT
  172. . CURLOPT_RANGE
  173. . CURLOPT_FTP_ACCOUNT
  174. . CURLOPT_RTSP_SESSION_ID
  175. . CURLOPT_KRBLEVEL
  176. . CURLOPT_KRB4LEVEL
  177. curl_getinfo($ch, CURLINFO_CERTINFO) returns certificate Subject and Issuer
  178. as a string (PHP >= 5.6.25)
  179. - Strings:
  180. substr_compare() now allows $length to be zero.
  181. pack() and unpack() now support 64-bit format specifiers: q, Q, J and P.
  182. - Crypt:
  183. crypt() will now raise an E_NOTICE error if the salt parameter is omitted.
  184. See: https://wiki.php.net/rfc/crypt_function_salt
  185. - Mcrypt:
  186. The $source parameter of mcrypt_create_iv() now defaults to
  187. MCRYPT_DEV_URANDOM instead of MCRYPT_DEV_RANDOM.
  188. - OpenSSL:
  189. The $crypto_type parameter is now optional in stream_socket_enable_crypto()
  190. if the stream's SSL context specifies the new "crypto_type" option. The
  191. crypto method from the context is used as a fallback if no crypto method is
  192. specified at call-time.
  193. - Reflection:
  194. ReflectionClass::newInstanceWithoutConstructor previously didn't allow the
  195. instantiation of any internal class which used custom object storage
  196. (overriding the default create_object handler), this was changed to only
  197. reject the instantiation of such classes if the class is also marked as
  198. final.
  199. - XMLReader:
  200. XMLReader::getAttributeNs and XMLReader::getAttributeNo now return NULL if
  201. the attribute could not be found, just like XMLReader::getAttribute.
  202. - Pgsql:
  203. pg_insert()/pg_select()/pg_update()/pg_delete() are no longer EXPERIMENTAL.
  204. The following functions no longer block until query write completion if the
  205. socket stream underlying a database connection is set to non-blocking mode:
  206. . pg_send_execute()
  207. . pg_send_prepare()
  208. . pg_send_query()
  209. . pg_send_query_params()
  210. - unserialize:
  211. Manipulated serialization strings for objects implementing Serializable by
  212. replacing "C:" with "O:" at the start will now produce an error.
  213. - parse_ini_file():
  214. - parse_ini_string():
  215. Added scanner mode INI_SCANNER_TYPED to yield typed .ini values.
  216. For PHP >= 5.6.1
  217. - JSON:
  218. Added JSON_PRESERVE_ZERO_FRACTION option (PHP >= 5.6.5)
  219. ========================================
  220. 6. New Functions
  221. ========================================
  222. - Datetime:
  223. Added DatePeriod::getStartDate(), DatePeriod::getEndDate(), DatePeriod::getDateInterval() in 5.6.5.
  224. - GMP:
  225. Added gmp_root($a, $nth) and gmp_rootrem($a, $nth) for calculating nth roots.
  226. Added gmp_import($data, $word_size = 1, $options = GMP_MSW_FIRST | GMP_NATIVE_ENDIAN) in PHP 5.6.1.
  227. Added gmp_export($gmpnumber, $word_size = 1, $options = GMP_MSW_FIRST | GMP_NATIVE_ENDIAN) in PHP 5.6.1.
  228. Added gmp_random_range() and gmp_random_bits() in PHP 5.6.3.
  229. - Hash
  230. Added hash_equals($known_string, $user_string)
  231. - OpenSSL:
  232. Added string openssl_x509_fingerprint($x509, $type, $binary).
  233. Added string openssl_spki_new($private_key, $challenge, $algorithm)
  234. Added bool openssl_spki_verify($spkac)
  235. Added string openssl_spki_export($spkac)
  236. Added string openssl_spki_export_challenge($spkac)
  237. Added array openssl_get_cert_locations()
  238. - LDAP:
  239. Added ldap_escape($value, $ignore = "", $flags = 0).
  240. Added ldap_modify_batch($link_identifier, $dn, $modifications) described in
  241. https://wiki.php.net/rfc/ldap_modify_batch.
  242. - Pgsql:
  243. Added pg_socket($connection) to allow async connections and non-blocking IO
  244. Added pg_connect_poll($connection) for establishing async connections
  245. Added pg_consume_input($connection) for non-blocking query result consumption
  246. Added pg_flush($connection) for non-blocking query write completion
  247. - PDO_pgsql
  248. Added PDO::pgsqlGetNotify($result_type = PDO::FETCH_USE_DEFAULT, $ms_timeout = 0)
  249. Added PDO::pgsqlGetPid()
  250. - Reflection
  251. Added ReflectionFunction::isVariadic() and ReflectionParameter::isVariadic().
  252. - SPL
  253. Added SplFileObject::fread($length) to complement fwrite() method (>= 5.5.11)
  254. - Zip:
  255. Added ZipArchive::setPassword($password)
  256. ========================================
  257. 7. New Classes and Interfaces
  258. ========================================
  259. ========================================
  260. 8. Removed Extensions
  261. ========================================
  262. ========================================
  263. 9. Other Changes to Extensions
  264. ========================================
  265. - cURL:
  266. - The following constants have been removed as they are now marked "obsolete"
  267. in the underlying library and never had any effect to begin with:
  268. . CURLOPT_CLOSEPOLICY
  269. . CURLCLOSEPOLICY_CALLBACK
  270. . CURLCLOSEPOLICY_LEAST_RECENTLY_USED
  271. . CURLCLOSEPOLICY_LEAST_TRAFFIC
  272. . CURLCLOSEPOLICY_OLDEST
  273. . CURLCLOSEPOLICY_SLOWEST
  274. - GMP:
  275. The GMP extension now uses objects as the underlying data structure, rather
  276. than resources. GMP instances now support dumping, serialization, cloning,
  277. casts to primitive types and have overloaded operators.
  278. (RFC: https://wiki.php.net/rfc/operator_overloading_gmp)
  279. - OCI8:
  280. - Added Implicit Result Set support for Oracle Database 12c with a
  281. new oci_get_implicit_resultset() function.
  282. - Using 'oci_execute($s, OCI_NO_AUTO_COMMIT)' for a SELECT no longer
  283. unnecessarily initiates an internal ROLLBACK during connection
  284. close.
  285. - Multi-row OCI_RETURN_LOB queries require fewer "round trips" to the database.
  286. - Added DTrace probes enabled with PHP's generic --enable-dtrace
  287. - The oci_internal_debug() function is now a no-op.
  288. - The phpinfo() output format for OCI8 has changed.
  289. - OpenSSL:
  290. - The "SNI_enabled" SSL stream context option is now set to TRUE by default
  291. if supported by the underlying openssl library.
  292. - PCRE:
  293. - The information collected by the (*MARK) backtracking control verb is now
  294. collected into the "MARK" index of the $matches array for preg_match(),
  295. preg_match_all() and preg_replace_callback().
  296. - Pgsql:
  297. - pg_insert()/pg_select()/pg_update()/pg_delete()/pg_meta_data()/pg_convert()
  298. are no longer EXPERIMENTAL
  299. - Added PGSQL_DML_ESCAPE option for pg_insert()/pg_select()/pg_update()/pg_delete()
  300. that simply escapes all supplied parameters. These functions can be as fast as
  301. native query. Unvalidated data(Unknown data types) is passed as string.
  302. JSON/Array/etc are supported both PGSQL_DML_ESCAPE and pg_convert() as string.
  303. - pg_select() returns PostgreSQL query resource when query is executed.
  304. - Added extended flag parameter for pg_meta_data(). pg_meta_data() always
  305. returns "is enum" attribute.
  306. - The new pg_socket() function returns a socket stream with no behavior other
  307. than to allow IO-readiness polling on a DB connection socket. Calling
  308. stream_set_blocking() on its result enables non-blocking behavior.
  309. - Passing the new PGSQL_CONNECT_ASYNC flag to pg_connect() allows applications
  310. to poll for IO readiness via pg_connect_poll() and establish connections
  311. asynchronously.
  312. - PDO_pgsql:
  313. - Added PDO::PGSQL_ATTR_DISABLE_PREPARES constant to execute the queries
  314. without preparing them, while still passing parameters separately from
  315. the command text using PQexecParams.
  316. - Added LISTEN/NOTIFY support via PDO::pgsqlGetNotify / PDO::pgsqlGetPid()
  317. as described in https://bugs.php.net/bug.php?id=42614.
  318. - DOM:
  319. - DOMNode::textContent is now a writeable property. (>= 5.6.1)
  320. ========================================
  321. 10. New Global Constants
  322. ========================================
  323. - CURL:
  324. CURL_HTTP_VERSION_2_0 and CURL_VERSION_HTTP2 (>= 5.6.8)
  325. - GD:
  326. IMG_WEBP (>= 5.6.25)
  327. - LDAP:
  328. LDAP_ESCAPE_FILTER int(1)
  329. LDAP_ESCAPE_DN int(2)
  330. - Pgsql:
  331. PGSQL_DML_ESCAPE int(4096)
  332. PGSQL_CONNECT_ASYNC
  333. PGSQL_CONNECTION_STARTED
  334. PGSQL_CONNECTION_MADE
  335. PGSQL_CONNECTION_AWAITING_RESPONSE
  336. PGSQL_CONNECTION_AUTH_OK
  337. PGSQL_CONNECTION_SSL_STARTUP
  338. PGSQL_CONNECTION_SETENV
  339. PGSQL_POLLING_FAILED
  340. PGSQL_POLLING_READING
  341. PGSQL_POLLING_WRITING
  342. PGSQL_POLLING_OK
  343. PGSQL_POLLING_ACTIVE
  344. - OpenSSL:
  345. STREAM_CRYPTO_METHOD_TLSv1_0_CLIENT int(9)
  346. STREAM_CRYPTO_METHOD_TLSv1_1_CLIENT int(17)
  347. STREAM_CRYPTO_METHOD_TLSv1_2_CLIENT int(33)
  348. STREAM_CRYPTO_METHOD_ANY_CLIENT int(63)
  349. STREAM_CRYPTO_METHOD_TLSv1_0_SERVER int(8)
  350. STREAM_CRYPTO_METHOD_TLSv1_1_SERVER int(16)
  351. STREAM_CRYPTO_METHOD_TLSv1_2_SERVER int(32)
  352. STREAM_CRYPTO_METHOD_ANY_SERVER int(62)
  353. OPENSSL_DEFAULT_STREAM_CIPHERS string
  354. ========================================
  355. 11. Changes to INI File Handling
  356. ========================================
  357. - Core:
  358. Changed always_populate_raw_post_data to throw a deprecation warning when
  359. enabled and to recognize the value -1 for never populating the global
  360. $HTTP_RAW_POST_DATA variable, which will be default in future PHP versions.
  361. default_charset is set to UTF-8. It was empty previously. default_charset
  362. is used where it is applicable. Iconv/Mbstring/htmlentities/htmlspecialchars/
  363. html_entity_decode use default_charset as default encoding.
  364. internal_encoding/input_encoding/output_encoding is added for encoding
  365. handling modules. Refer to "Changes to encodings in PHP 5.6" in "11. Other Changes"
  366. section for more details.
  367. - cURL:
  368. If the new openssl.cafile ini directive is specified ext/curl will give the
  369. openssl path precedence over its own curl.cainfo directive.
  370. - OpenSSL:
  371. openssl.cafile and openssl.capath ini directives have been added to allow
  372. global CA default specification as necessary.
  373. ========================================
  374. 12. Other Changes
  375. ========================================
  376. - File upload:
  377. Uploads equal or greater than 2GB in size are now accepted.
  378. - HTTP stream wrapper:
  379. HTTP 1.1 requests now include a Connection: close header unless explicitly
  380. overridden by setting a Connection header via the header context option.
  381. - PDO_pgsql
  382. A libpq version providing PQexecParams, PQprepare, PQescapeStringConn,
  383. PQescapeByteaConn is now required. According to the release notes that means
  384. 8.0.8+ or 8.1.4+.
  385. - Zip:
  386. New --with-libzip option allow to use system libzip. Version > 0.11 required,
  387. Version >= 0.11.2 recommended for all features.
  388. - Changes to encodings in PHP 5.6
  389. The default value of default_charset is now UTF-8 when it is not
  390. explicitly set in php.ini
  391. The following php.ini parameters were added:
  392. internal_encoding
  393. input_encoding
  394. output_encoding
  395. The values of the following php.ini parameters have become empty in
  396. PHP 5.6 (previously they were all ISO-8859-1)
  397. iconv.input_encoding
  398. iconv.output_encoding
  399. iconv.internal_encoding
  400. Changes were made to character set handling in:
  401. - the iconv and mbstring extensions,
  402. - and htmlentities(), htmlspecialchars(), html_entity_decode() functions
  403. The precedence for these is now:
  404. default_charset < internal/input/output_encoding < (mbstring.* || iconv.*) < function parameter
  405. For example, the easiest way to use the UTF-8 encoding is to set
  406. default_charset=UTF-8 and leave the following php.ini parameters
  407. empty:
  408. iconv.input_encoding
  409. iconv.output_encoding
  410. iconv.internal_encoding
  411. mbstring.http_input
  412. mbstring.http_output
  413. mbstring.internal_encoding
  414. internal_encoding
  415. input_encoding
  416. output_encoding
  417. The mb_regex_encoding() default setting is changed from EUC-JP to UTF-8.