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 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495
|
<?xml version="1.0" encoding="utf-8"?>
<sect1 xml:id="migration84.deprecated">
<title>Deprecated Features</title>
<sect2 xml:id="migration84.deprecated.core">
<title>PHP Core</title>
<sect3 xml:id="migration84.deprecated.core.implicitly-nullable-parameter">
<!-- RFC: https://wiki.php.net/rfc/deprecate-implicitly-nullable-types -->
<title>Implicitly nullable parameter</title>
<simpara>
A parameter's type is implicitly widened to accept <type>null</type>
if the default value for it is &null;.
</simpara>
<para>
The following code:
<informalexample>
<programlisting role="php">
<![CDATA[
<?php
function foo(T1 $a = null) {}
]]>
</programlisting>
</informalexample>
should be converted to:
<informalexample>
<programlisting role="php">
<![CDATA[
<?php
function foo(T1|null $a = null) {}
]]>
</programlisting>
</informalexample>
or
<informalexample>
<programlisting role="php">
<![CDATA[
<?php
function foo(?T1 $a = null) {}
]]>
</programlisting>
</informalexample>
</para>
<para>
However, if such a parameter declaration is followed by a mandatory
parameter:
<informalexample>
<programlisting role="php">
<![CDATA[
<?php
function foo(T1 $a, T2 $b = null, T3 $c) {}
]]>
</programlisting>
</informalexample>
It must be converted to:
<informalexample>
<programlisting role="php">
<![CDATA[
<?php
function foo(T1 $a, T2|null $b, T3 $c) {}
]]>
</programlisting>
</informalexample>
or
<informalexample>
<programlisting role="php">
<![CDATA[
<?php
function foo(T1 $a, ?T2 $b, T3 $c) {}
]]>
</programlisting>
</informalexample>
as optional parameter before required ones are deprecated.
</para>
</sect3>
<sect3>
<!-- RFC: https://wiki.php.net/rfc/raising_zero_to_power_of_negative_number -->
<title>Raising zero to the power of negative number</title>
<simpara>
Raising a number to the power of a negative number is equivalent to taking
the reciprocal of the number raised to the positive opposite of the power.
That is, <literal>10<superscript>-2</superscript></literal> is the same as
<literal>1 / 10<superscript>2</superscript></literal>.
Therefore raising <literal>0</literal> to the power of a negative number
corresponds to dividing by <literal>0</literal>, i.e.
<literal>0<superscript>-2</superscript></literal> is the same as
<literal>1 / 0<superscript>2</superscript></literal>, or
<literal>1 / 0</literal>. Thus, this behavior has been deprecated.
</simpara>
<simpara>
This affects the exponentiation operator <literal>**</literal>
and the <function>pow</function> function.
</simpara>
<simpara>
If the IEEE 754 semantics are desired one should use the new
<function>fpow</function> function.
</simpara>
</sect3>
<sect3 xml:id="migration84.deprecated.core.underscore-class-name">
<!-- RFC: https://wiki.php.net/rfc/deprecations_php_8_4#deprecate_using_a_single_underscore_as_a_class_name -->
<title>Using underscore <literal>_</literal> as class name</title>
<para>
Naming a class <literal>_</literal> is now deprecated:
<informalexample>
<programlisting role="php">
<![CDATA[
<?php
class _ {}
]]>
</programlisting>
</informalexample>
</para>
<note>
<para>
Classes whose names start with an underscore are <emphasis>not</emphasis>
deprecated:
<informalexample>
<programlisting role="php">
<![CDATA[
<?php
class _MyClass {}
]]>
</programlisting>
</informalexample>
</para>
</note>
</sect3>
<sect3>
<!-- RFC: https://wiki.php.net/rfc/deprecations_php_8_4#deprecate_passing_e_user_error_to_trigger_error -->
<title>
Using <function>trigger_error</function> with
<constant>E_USER_ERROR</constant>
</title>
<simpara>
Calling <function>trigger_error</function> with
<parameter>error_level</parameter> being equal to
<constant>E_USER_ERROR</constant> is now deprecated.
</simpara>
<simpara>
Such usages should be replaced by either throwing an exception,
or calling <function>exit</function>, whichever is more appropriate.
</simpara>
</sect3>
<sect3>
<!-- RFC: https://wiki.php.net/rfc/deprecations_php_8_4#remove_e_strict_error_level_and_deprecate_e_strict_constant -->
<title>
The <constant>E_STRICT</constant> constant
</title>
<simpara>
Because the <constant>E_STRICT</constant> error level was removed,
this constant is now deprecated.
</simpara>
</sect3>
</sect2>
<sect2 xml:id="migration84.deprecated.core.curl">
<title>cURL</title>
<simpara>
The <constant>CURLOPT_BINARYTRANSFER</constant> constant is now deprecated.
</simpara>
</sect2>
<sect2 xml:id="migration84.deprecated.core.date">
<title>Date</title>
<simpara>
The <code> DatePeriod::__construct(string $isostr, int $options = 0)</code>
signature has been deprecated.
Use <methodname>DatePeriod::createFromISO8601String</methodname> instead.
</simpara>
<!-- RFC: https://wiki.php.net/rfc/deprecations_php_8_4#constants_sunfuncs_ret_string_sunfuncs_ret_double_sunfuncs_ret_timestamp -->
<simpara>
The <constant>SUNFUNCS_RET_TIMESTAMP</constant>,
<constant>SUNFUNCS_RET_STRING</constant>,
and <constant>SUNFUNCS_RET_DOUBLE</constant> constants are now deprecated.
This follows from the deprecation of the <function>date_sunset</function> and
<function>date_sunrise</function> functions in PHP 8.1.0.
</simpara>
</sect2>
<sect2 xml:id="migration84.deprecated.core.dba">
<title>DBA</title>
<!-- RFC: https://wiki.php.net/rfc/deprecations_php_8_4#deprecate_passing_null_and_false_to_dba_key_split -->
<simpara>
Passing &null; or &false; to <function>dba_key_split</function> is now
deprecated.
It would always return &false; in those cases.
</simpara>
</sect2>
<sect2 xml:id="migration84.deprecated.core.dom">
<title>DOM</title>
<!-- RFC: https://wiki.php.net/rfc/deprecations_php_8_4#deprecate_dom_php_err_constant -->
<simpara>
The <constant>DOM_PHP_ERR</constant> constant is now deprecated.
</simpara>
<!-- RFC: https://wiki.php.net/rfc/deprecations_php_8_4#formally_deprecate_soft-deprecated_domdocument_and_domentity_properties -->
<para>
The following properties have been formally deprecated:
<simplelist>
<member><property>DOMDocument::$actualEncoding</property></member>
<member><property>DOMDocument::$config</property></member>
<member><property>DOMEntity::$actualEncoding</property></member>
<member><property>DOMEntity::$encoding</property></member>
<member><property>DOMEntity::$version</property></member>
</simplelist>
</para>
</sect2>
<sect2 xml:id="migration84.deprecated.core.hash">
<title>Hash</title>
<!-- RFC: https://wiki.php.net/rfc/deprecations_php_8_4#deprecate_passing_incorrect_data_types_for_options_to_exthash_functions -->
<simpara>
Passing invalid options to hash functions is now deprecated.
</simpara>
</sect2>
<sect2 xml:id="migration84.deprecated.intl">
<title>Intl</title>
<simpara>
Calling <function>intlcal_set</function> or
<methodname>IntlCalendar::set</methodname>
with more than two arguments is deprecated.
Use either <methodname>IntlCalendar::setDate</methodname> or
<methodname>IntlCalendar::setDateTime</methodname> instead.
</simpara>
<simpara>
Calling <function>intlgregcal_create_instance</function> or
<methodname>IntlGregorianCalendar::__construct</methodname>
with more than two arguments is deprecated.
Use either <methodname>IntlGregorianCalendar::createFromDate</methodname> or
<methodname>IntlGregorianCalendar::createFromDateTime</methodname> instead.
</simpara>
</sect2>
<sect2 xml:id="migration84.deprecated.ldap">
<title>LDAP</title>
<simpara>
Calling <function>ldap_connect</function>
with more than two arguments is deprecated.
Use <function>ldap_connect_wallet</function> instead.
</simpara>
<simpara>
Calling <function>ldap_exop</function>
with more than four arguments is deprecated.
Use <function>ldap_exop_sync</function> instead.
</simpara>
</sect2>
<sect2 xml:id="migration84.deprecated.core.mysqli">
<title>MySQLi</title>
<!-- RFC: https://wiki.php.net/rfc/deprecations_php_8_4#mysqli_ping_and_mysqliping -->
<simpara>
The <function>mysqli_ping</function> function and
<methodname>mysqli::ping</methodname> method
are now deprecated as the reconnect feature was removed in PHP 8.2.0.
</simpara>
<!-- RFC: https://wiki.php.net/rfc/deprecations_php_8_4#deprecate_mysqli_kill -->
<simpara>
The <function>mysqli_kill</function> function and
<methodname>mysqli::kill</methodname> method
are now deprecated.
If this functionality is needed a SQL <literal>KILL</literal> command
can be used instead.
</simpara>
<!-- RFC: https://wiki.php.net/rfc/deprecations_php_8_4#deprecate_mysqli_refresh -->
<simpara>
The <function>mysqli_refresh</function> function and
<methodname>mysqli::refresh</methodname> method
are now deprecated.
If this functionality is needed a SQL <literal>FLUSH</literal> command
can be used instead.
All <constant>MYSQLI_REFRESH_<replaceable>*</replaceable></constant>
constants have been deprecated as well.
</simpara>
<!-- RFC: https://wiki.php.net/rfc/deprecations_php_8_4#deprecate_the_second_parameter_to_mysqli_store_result -->
<simpara>
Passing the <parameter>mode</parameter> parameter to
<function>mysqli_store_result</function> explicitly has been deprecated.
As the <constant>MYSQLI_STORE_RESULT_COPY_DATA</constant> constant was
only used in conjunction with this function it has also been deprecated.
</simpara>
</sect2>
<sect2 xml:id="migration84.deprecated.core.pdo-pgsql">
<title>PDO_PGSQL</title>
<simpara>
Using escaped question marks (<literal>??</literal>) inside
dollar-quoted strings is deprecated.
Because PDO_PGSQL now has its own SQL parser with dollar-quoted strings
support, it is no longer necessary to escape question marks inside them.
</simpara>
</sect2>
<sect2 xml:id="migration84.deprecated.core.pgsql">
<title>PGSQL</title>
<simpara>
The 2 arguments signature of <function>pg_fetch_result</function>,
<function>pg_field_prtlen</function>, and
<function>pg_field_is_null</function> is now deprecated.
Use the 3 arguments signature with <parameter>row</parameter> set to
&null; instead.
</simpara>
</sect2>
<sect2 xml:id="migration84.deprecated.random">
<title>Random</title>
<!-- RFC: https://wiki.php.net/rfc/deprecations_php_8_4#deprecate_lcg_value -->
<simpara>
<function>lcg_value</function> is now deprecated,
as the function is broken in multiple ways.
Use <methodname>Random\Randomizer::getFloat</methodname> instead.
</simpara>
</sect2>
<sect2 xml:id="migration84.deprecated.reflection">
<title>Reflection</title>
<simpara>
Calling <methodname>ReflectionMethod::__construct</methodname>
with one arguments is deprecated.
Use <methodname>ReflectionMethod::createFromMethodName</methodname> instead.
</simpara>
</sect2>
<sect2 xml:id="migration84.deprecated.session">
<title>Session</title>
<simpara>
Calling <function>session_set_save_handler</function>
with more than two arguments is deprecated.
Use the two arguments signature instead.
</simpara>
<!-- RFC: https://wiki.php.net/rfc/deprecations_php_8_4#sessionsid_length_and_sessionsid_bits_per_character -->
<simpara>
Changing the value of the
<link linkend="ini.session.sid-length"><literal>session.sid_length</literal></link> and
<link linkend="ini.session.sid-bits-per-character"><literal>session.sid_bits_per_character</literal></link>
INI settings is deprecated.
Update the session storage backend to accept 32 character hexadecimal
session IDs and stop changing these two INI settings instead.
</simpara>
<!-- RFC: https://wiki.php.net/rfc/deprecate-get-post-sessions -->
<simpara>
Changing the value of the
<link linkend="ini.session.use-only-cookies"><literal>session.use_only_cookies</literal></link>,
<link linkend="ini.session.use-trans-sid"><literal>session.use_trans_sid</literal></link>,
<link linkend="ini.session.trans-sid-tags"><literal>session.trans_sid_tags</literal></link>,
<link linkend="ini.session.trans-sid-hosts"><literal>session.trans_sid_hosts</literal></link>, and
<link linkend="ini.session.referer-check"><literal>session.referer_check</literal></link>
INI settings is deprecated.
The <constant>SID</constant> constant is also deprecated.
</simpara>
</sect2>
<sect2 xml:id="migration84.deprecated.core.soap">
<title>SOAP</title>
<!-- RFC: https://wiki.php.net/rfc/deprecations_php_8_4#deprecate_soap_functions_all_constant_and_passing_it_to_soapserveraddfunction -->
<simpara>
Passing an <type>int</type> to
<methodname>SoapServer::addFunction</methodname> is now deprecated.
If all PHP functions need to be provided flatten the array returned by
<function>get_defined_functions</function>.
</simpara>
<!-- RFC: https://wiki.php.net/rfc/deprecations_php_8_4#deprecate_soap_functions_all_constant_and_passing_it_to_soapserveraddfunction -->
<simpara>
The <constant>SOAP_FUNCTIONS_ALL</constant> constant is now deprecated.
</simpara>
</sect2>
<sect2 xml:id="migration84.deprecated.core.spl">
<title>SPL</title>
<simpara>
The <methodname>SplFixedArray::__wakeup</methodname> method is now
deprecated, as it implements
<methodname>SplFixedArray::__serialize</methodname> and
<methodname>SplFixedArray::__unserialize</methodname>
which need to be overwritten instead.
</simpara>
<!-- RFC: https://wiki.php.net/rfc/deprecations_php_8_4#deprecate_proprietary_csv_escaping_mechanism -->
<simpara>
Using the default value for the <parameter>escape</parameter> parameter for the
<methodname>SplFileObject::setCsvControl</methodname>,
<methodname>SplFileObject::fputcsv</methodname>, and
<methodname>SplFileObject::fgetcsv</methodname> is now deprecated.
<!-- TODO: Link to named arguments feature -->
It must be passed explicitly either positionally or via named arguments.
This does not apply to <methodname>SplFileObject::fputcsv</methodname>
and <methodname>SplFileObject::fgetcsv</methodname> if
<methodname>SplFileObject::setCsvControl</methodname> was used to set a
new default value.
</simpara>
</sect2>
<sect2 xml:id="migration84.deprecated.standard">
<title>Standard</title>
<simpara>
Calling <function>stream_context_set_option</function>
with two arguments is deprecated.
Use <function>stream_context_set_options</function> instead.
</simpara>
<!-- RFC: https://wiki.php.net/rfc/deprecations_php_8_4#unserialize_s_s_tag -->
<simpara>
Unserializing strings using the uppercase <literal>S</literal> tag
with <function>unserialize</function> is deprecated.
</simpara>
<!-- RFC: https://wiki.php.net/rfc/deprecations_php_8_4#deprecate_proprietary_csv_escaping_mechanism -->
<simpara>
Using the default value for the <parameter>escape</parameter> parameter for the
<function>fputcsv</function>,
<function>fgetcsv</function>, and
<function>str_getcsv</function> is now deprecated.
<!-- TODO: Link to named arguments feature -->
It must be passed explicitly either positionally or via named arguments.
</simpara>
</sect2>
<sect2 xml:id="migration84.deprecated.core.xml">
<title>XML</title>
<!-- RFC: https://wiki.php.net/rfc/deprecations_php_8_4#xml_set_object_and_xml_set_handler_with_string_method_names -->
<simpara>
The <function>xml_set_object</function> function has been deprecated.
</simpara>
<!-- RFC: https://wiki.php.net/rfc/deprecations_php_8_4#xml_set_object_and_xml_set_handler_with_string_method_names -->
<simpara>
Passing non-<type>callable</type> strings to the
<function>xml_set_<replaceable>*</replaceable></function>
functions is now deprecated.
</simpara>
</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
-->
|