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
  
     | 
    
      <?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<sect1 xml:id="migration72.deprecated">
 <title>Deprecated features in PHP 7.2.x</title>
 <sect2 xml:id="migration72.deprecated.unquoted-strings">
  <title>Unquoted strings</title>
  <para>
   Unquoted strings that are non-existent global constants are taken to be
   strings of themselves. This behaviour used to emit an
   <constant>E_NOTICE</constant>, but will now emit an
   <constant>E_WARNING</constant>. In the next major version of PHP, an
   <classname>Error</classname> exception will be thrown instead.
  </para>
  <informalexample>
   <programlisting role="php">
<![CDATA[
<?php
var_dump(NONEXISTENT);
/* Output:
Warning: Use of undefined constant NONEXISTENT - assumed 'NONEXISTENT' (this will throw an Error in a future version of PHP) in %s on line %d
string(11) "NONEXISTENT"
*/
]]>
   </programlisting>
  </informalexample>
 </sect2>
 <sect2 xml:id="migration72.deprecated.png2wbmp-jpeg2wbmp">
  <title><function>png2wbmp</function> and <function>jpeg2wbmp</function></title>
  <para>
   The <function>png2wbmp</function> and <function>jpeg2wbmp</function>
   functions from the GD extension have now been deprecated and will be removed
   in the next major version of PHP.
  </para>
 </sect2>
 <sect2 xml:id="migration72.deprecated.INTL_IDNA_VARIANT_2003-variant">
  <title><constant>INTL_IDNA_VARIANT_2003</constant> variant</title>
  <para>
   The Intl extension has deprecated the
   <constant>INTL_IDNA_VARIANT_2003</constant> variant, which is currently
   being used as the default for <function>idn_to_ascii</function> and
   <function>idn_to_utf8</function>. PHP 7.4 will see these defaults changed to
   <constant>INTL_IDNA_VARIANT_UTS46</constant>, and the next major version of
   PHP will remove <constant>INTL_IDNA_VARIANT_2003</constant> altogether.
  </para>
 </sect2>
 <sect2 xml:id="migration72.deprecated.__autoload-method">
  <title><function>__autoload</function> method</title>
  <para>
   The <function>__autoload</function> method has been deprecated because it is
   inferior to <function>spl_autoload_register</function> (due to it not being
   able to chain autoloaders), and there is no interoperability between the two
   autoloading styles.
  </para>
 </sect2>
 <sect2 xml:id="migration72.deprecated.track_errors-and-php_errormsg">
  <title><parameter>track_errors</parameter> ini setting and <literal>$php_errormsg</literal> variable</title>
  <para>
   When the <parameter>track_errors</parameter> ini setting is enabled, a
   <literal>$php_errormsg</literal> variable is created in the local scope when
   a non-fatal error occurs. Given that the preferred way of retrieving such
   error information is by using <function>error_get_last</function>, this
   feature has been deprecated.
  </para>
 </sect2>
 <sect2 xml:id="migration72.deprecated.create_function-function">
  <title><function>create_function</function> function</title>
  <para>
   Given the security issues of this function (being a thin wrapper around
   <function>eval</function>), this dated function has now been deprecated.
   The preferred alternative is to use <link linkend="functions.anonymous">anonymous functions</link>.
  </para>
 </sect2>
 <sect2 xml:id="migration72.deprecated.mbstringfunc_overload-ini-setting">
  <title><parameter>mbstring.func_overload</parameter> ini setting</title>
  <para>
   Given the interoperability problems of string-based functions being used in
   environments with this setting enabled, it has now been deprecated.
  </para>
 </sect2>
 <sect2 xml:id="migration72.deprecated.unset-cast">
  <title><literal>(unset)</literal> cast</title>
  <para>
   Casting any expression to this type will always result in &null;, and so
   this superfluous casting type has now been deprecated.
  </para>
 </sect2>
 <sect2 xml:id="migration72.deprecated.parse_str-no-second-arg">
  <title><function>parse_str</function> without a second argument</title>
  <para>
   Without the second argument to <function>parse_str</function>, the query
   string parameters would populate the local symbol table.
   Given the security implications of this, using
   <function>parse_str</function> without a second argument has now been
   deprecated. The function should always be used with two arguments, as the
   second argument causes the query string to be parsed into an array.
  </para>
 </sect2>
 <sect2 xml:id="migration72.deprecated.gmp_random-function">
  <title><function>gmp_random</function> function</title>
  <para>
   This function generates a random number based upon a range that is
   calculated by an unexposed, platform-specific limb size. Because of this,
   the function has now been deprecated. The preferred way of generating a
   random number using the GMP extension is by
   <function>gmp_random_bits</function> and
   <function>gmp_random_range</function>.
  </para>
 </sect2>
 <sect2 xml:id="migration72.deprecated.each-function">
  <title><function>each</function> function</title>
  <para>
   This function is far slower at iteration than a normal
   <literal>foreach</literal>, and causes implementation issues for some
   language changes. It has therefore been deprecated.
  </para>
 </sect2>
 <sect2 xml:id="migration72.deprecated.assert-string-arg">
  <title><function>assert</function> with a string argument</title>
  <para>
   Using <function>assert</function> with a string argument required the string
   to be <function>eval</function>'ed. Given the potential for remote code
   execution, using <function>assert</function> with a string argument has now
   been deprecated in favour of using boolean expressions.
  </para>
 </sect2>
 <sect2 xml:id="migration72.deprecated.errcontext-arg-of-error-handlers">
  <title><literal>$errcontext</literal> argument of error handlers</title>
  <para>
   The <literal>$errcontext</literal> argument contains all local variables of
   the error site. Given its rare usage, and the problems it causes with
   internal optimisations, it has now been deprecated.
   Instead, a debugger should be used to retrieve
   information on local variables at the error site.
  </para>
 </sect2>
 <sect2 xml:id="migration72.deprecated.read_exif_data-function">
  <title><function>read_exif_data</function> function</title>
  <para>
   The <function>read_exif_data</function> alias has been deprecated.
   The <function>exif_read_data</function> function should be used instead.
  </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
-->
 
     |