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
|
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<sect1 xml:id="migration74.deprecated">
<title>Deprecated Features</title>
<sect2 xml:id="migration74.deprecated.core">
<title>PHP Core</title>
<sect3 xml:id="migration74.deprecated.core.nested-ternary">
<title>Nested ternary operators without explicit parentheses</title>
<para>
Nested ternary operations must explicitly use parentheses
to dictate the order of the operations. Previously, when used
without parentheses, the left-associativity would not result
in the expected behaviour in most cases.
<informalexample>
<programlisting role="php">
<![CDATA[
<?php
1 ? 2 : 3 ? 4 : 5; // deprecated
(1 ? 2 : 3) ? 4 : 5; // ok
1 ? 2 : (3 ? 4 : 5); // ok
?>
]]>
</programlisting>
</informalexample>
</para>
<para>
Parentheses are <emphasis>not</emphasis> required when nesting into the middle operand,
as this is always unambiguous and not affected by associativity:
<informalexample>
<programlisting role="php">
<![CDATA[
1 ? 2 ? 3 : 4 : 5 // ok
]]>
</programlisting>
</informalexample>
</para>
</sect3>
<sect3 xml:id="migration74.deprecated.core.array-string-access-curly-brace">
<title>Array and string offset access using curly braces</title>
<para>
The array and string offset access syntax using curly braces is
deprecated. Use <literal>$var[$idx]</literal> instead of
<literal>$var{$idx}</literal>.
</para>
</sect3>
<sect3 xml:id="migration74.deprecated.core.real">
<title>(real) cast and <function>is_real</function> function</title>
<para>
The <literal>(real)</literal> cast is deprecated,
use <literal>(float)</literal> instead.
</para>
<para>
The <function>is_real</function> function is also deprecated,
use <function>is_float</function> instead.
</para>
</sect3>
<sect3 xml:id="migration74.deprecated.core.unbind-this">
<title>Unbinding <literal>$this</literal> when <literal>$this</literal> is used</title>
<para>
Unbinding <literal>$this</literal> of a non-static closure
that uses <literal>$this</literal> is deprecated.
</para>
</sect3>
<sect3 xml:id="migration74.deprecated.core.parent">
<title><literal>parent</literal> keyword without parent class</title>
<para>
Using <literal>parent</literal> inside a class without a parent
is deprecated, and will throw a compile-time error in the future.
Currently an error will only be generated if/when the parent is
accessed at run-time.
</para>
</sect3>
<sect3 xml:id="migration74.deprecated.core.allow-url-include">
<title>allow_url_include INI option</title>
<para>
The <link linkend="ini.allow-url-include">allow_url_include</link>
ini directive is deprecated. Enabling it will generate
a deprecation notice at startup.
</para>
</sect3>
<sect3 xml:id="migration74.deprecated.core.invalid-base-characters">
<title>Invalid characters in base conversion functions</title>
<para>
Passing invalid characters to <function>base_convert</function>,
<function>bindec</function>, <function>octdec</function> and
<function>hexdec</function> will now generate a deprecation notice.
The result will still be computed as if the invalid characters did not exist.
Leading and trailing whitespace, as well as prefixes of type 0x (depending on base)
continue to be allowed.
</para>
</sect3>
<sect3 xml:id="migration74.deprecated.core.array-key-exists-objects">
<title>Using <function>array_key_exists</function> on objects</title>
<para>
Using <function>array_key_exists</function> on objects is deprecated.
Instead either <function>isset</function> or <function>property_exists</function>
should be used.
</para>
</sect3>
<sect3 xml:id="migration74.deprecated.core.magic-quotes-functions">
<title>Magic quotes functions</title>
<para>
The <function>get_magic_quotes_gpc</function> and <function>get_magic_quotes_runtime</function>
functions are deprecated. They always return &false;.
</para>
</sect3>
<sect3 xml:id="migration74.deprecated.core.hebrevc">
<title><function>hebrevc</function> function</title>
<para>
The <function>hebrevc</function> function is deprecated.
It can be replaced with <literal>nl2br(hebrev($str))</literal> or,
preferably, the use of Unicode RTL support.
</para>
</sect3>
<sect3 xml:id="migration74.deprecated.core.convert-cyr-string">
<title><function>convert_cyr_string</function> function</title>
<para>
The <function>convert_cyr_string</function> function is deprecated.
It can be replaced by one of <function>mb_convert_string</function>,
<function>iconv</function> or <classname>UConverter</classname>.
</para>
</sect3>
<sect3 xml:id="migration74.deprecated.core.money-format">
<title><function>money_format</function> function</title>
<para>
The <function>money_format</function> function is deprecated.
It can be replaced by the intl <classname>NumberFormatter</classname> functionality.
</para>
</sect3>
<sect3 xml:id="migration74.deprecated.core.ezmlm-hash">
<title><function>ezmlm_hash</function> function</title>
<para>
The <function>ezmlm_hash</function> function is deprecated.
</para>
</sect3>
<sect3 xml:id="migration74.deprecated.core.restore-include-path">
<title><function>restore_include_path</function> function</title>
<para>
The <function>restore_include_path</function> function is deprecated.
It can be replaced by <literal>ini_restore('include_path')</literal>.
</para>
</sect3>
<sect3 xml:id="migration74.deprecated.core.implode-reverse-parameters">
<title>Implode with historical parameter order</title>
<para>
Passing parameters to <function>implode</function> in reverse order
is deprecated, use <literal>implode($glue, $parts)</literal>
instead of <literal>implode($parts, $glue)</literal>.
</para>
</sect3>
</sect2>
<sect2 xml:id="migration74.deprecated.com">
<title>COM</title>
<para>
Importing type libraries with case-insensitive constant
registering has been deprecated.
</para>
</sect2>
<sect2 xml:id="migration74.deprecated.filter">
<title>Filter</title>
<para>
<constant>FILTER_SANITIZE_MAGIC_QUOTES</constant> is deprecated,
use <constant>FILTER_SANITIZE_ADD_SLASHES</constant> instead.
</para>
</sect2>
<sect2 xml:id="migration74.deprecated.mbstring">
<title>Multibyte String</title>
<para>
Passing a non-string pattern to <function>mb_ereg_replace</function>
is deprecated. Currently, non-string patterns are interpreted as
ASCII codepoints. In PHP 8, the pattern will be interpreted as a
string instead.
</para>
<para>
Passing the encoding as 3rd parameter to <function>mb_strrpos</function>
is deprecated. Instead pass a 0 offset, and encoding as 4th parameter.
</para>
</sect2>
<sect2 xml:id="migration74.deprecated.ldap">
<title>Lightweight Directory Access Protocol</title>
<para>
<function>ldap_control_paged_result_response</function> and
<function>ldap_control_paged_result</function> are deprecated.
Pagination controls can be sent along with
<function>ldap_search</function> instead.
</para>
</sect2>
<sect2 xml:id="migration74.deprecated.reflection">
<title>Reflection</title>
<para>
Calls to <methodname>ReflectionType::__toString</methodname> now generate
a deprecation notice. This method has been deprecated in favor of
<methodname>ReflectionNamedType::getName</methodname> in the documentation
since PHP 7.1, but did not throw a deprecation notice for technical reasons.
</para>
<para>
The <literal>export()</literal> methods on all <classname>Reflection</classname>
classes are deprecated. Construct a <classname>Reflection</classname> object and
convert it to string instead:
<informalexample>
<programlisting role="php">
<![CDATA[
<?php
// ReflectionClass::export(Foo::class, false) is:
echo new ReflectionClass(Foo::class), "\n";
// $str = ReflectionClass::export(Foo::class, true) is:
$str = (string) new ReflectionClass(Foo::class);
?>
]]>
</programlisting>
</informalexample>
</para>
</sect2>
<sect2 xml:id="migration74.deprecated.socket">
<title>Socket</title>
<para>
The <constant>AI_IDN_ALLOW_UNASSIGNED</constant> and
<constant>AI_IDN_USE_STD3_ASCII_RULES</constant> flags for
<function>socket_addrinfo_lookup</function> are deprecated,
due to an upstream deprecation in glibc.
</para>
</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
-->
|