
Inline adoc files when they are included exactly once. Also fix language tags because this inlining gives us better information on what language the code is written in.
96 lines
4.4 KiB
Plaintext
96 lines
4.4 KiB
Plaintext
== Why is this an issue?
|
|
|
|
Deprecated language features are those that have been retained temporarily for backward compatibility, but which will eventually be removed from the language. In effect, deprecation announces a grace period to allow the smooth transition from the old features to the new ones. In that period, no use of the deprecated features should be added to the code, and all existing uses should be gradually removed.
|
|
|
|
|
|
The following functions were deprecated in PHP 5:
|
|
|
|
[frame=all]
|
|
[cols="^1,^1"]
|
|
|===
|
|
|Deprecated|Use Instead
|
|
|
|
|``++call_user_method()++``|``++call_user_func()++``
|
|
|``++call_user_method_array()++``|``++call_user_func_array()++``
|
|
|``++define_syslog_variables()++``|
|
|
|``++dl()++``|
|
|
|``++ereg()++``|``++preg_match()++``
|
|
|``++ereg_replace()++``|``++preg_replace()++`` (note that this is deprecated in PHP 5.5)
|
|
|``++eregi()++``|``++preg_match()++`` with 'i' modifier
|
|
|``++eregi_replace()++``|``++preg_replace()++`` with 'i' modifier
|
|
|``++set_magic_quotes_runtime()++`` and its alias, ``++magic_quotes_runtime()++``|
|
|
|``++session_register()++``|``++$_SESSION++`` superglobal
|
|
|``++session_unregister()++``|``++$_SESSION++`` superglobal
|
|
|``++session_is_registered()++``|``++$_SESSION++`` superglobal
|
|
|``++set_socket_blocking()++``|``++stream_set_blocking()++``
|
|
|``++split()++``|``++preg_split()++``
|
|
|``++spliti()++``|``++preg_split()++`` with 'i' modifier
|
|
|``++sql_regcase()++``|
|
|
|``++mysql_db_query()++``|``++mysql_select_db()++`` and ``++mysql_query()++``
|
|
|``++mysql_escape_string()++``|``++mysql_real_escape_string()++``
|
|
|Passing locale category names as strings|Use the LC_* family of constants
|
|
|===
|
|
|
|
The following functions were deprecated in PHP 7:
|
|
|
|
[frame=all]
|
|
[cols="^1,^1"]
|
|
|===
|
|
|Deprecated|Use Instead
|
|
|
|
|``++__autoload()++``|``++spl_autoload_register()++``
|
|
|``++create_function()++``|anonymous function
|
|
|``++parse_str()++`` without second argument|``++parse_str()++`` with second argument
|
|
|``++gmp_random()++``|``++gmp_random_bits()++`` or ``++gmp_random_range()++``
|
|
|``++each()++``|``++foreach++``
|
|
|``++assert()++`` with string argument|
|
|
|Defining case-insensitive constants by calling ``++define()++`` with ``++true++`` as third parameter|``++define("myconst", $value)++`` or ``++define("myconst", $value, false)++``
|
|
|``++FILTER_FLAG_SCHEME_REQUIRED++`` and ``++FILTER_FLAG_HOST_REQUIRED++`` flags|``++FILTER_VALIDATE_URL++`` flag
|
|
|``++fgetss()++`` function, ``++"string.strip_tags"++`` stream filter name, ``++SplFileObject::fgetss()++`` method and ``++gzgetss()++`` function|
|
|
|``++mbregex_encoding()++``, ``++mbereg()++``, ``++mberegi()++``, ``++mbereg_replace()++``, ``++mberegi_replace()++``, ``++mbsplit()++``, ``++mbereg_match()++``, ``++mbereg_search()++``, ``++mbereg_search_pos()++``, ``++mbereg_search_regs()++``, ``++mbereg_search_init()++``, ``++mbereg_search_getregs()++``, ``++mbereg_search_getpos()++``, ``++mbereg_search_setpos()++``|Use the
|
|
|
|
corresponding ``++mb_ereg_*()++`` variants instead
|
|
|string search functions with integer needle (``++stristr++``, ``++strrchr++``, ``++strstr++``, ``++strripos++``, ``++stripos++``, ``++strrpos++``, ``++strpos++``, ``++strchr++``) |use a string needle instead
|
|
|``++image2wbmp()++``|``++imagewbmp()++``
|
|
|``++Normalizer::NONE++``|
|
|
|Defining an ``++assert()++`` function inside a namespace|use the standard ``++assert()++`` function
|
|
|===
|
|
|
|
== Resources
|
|
|
|
* https://wiki.php.net/rfc/deprecations_php_7_3[PHP RFC: Deprecations for PHP 7.3]
|
|
* https://wiki.php.net/rfc/case_insensitive_constant_deprecation[PHP RFC: Deprecate and Remove Case-Insensitive Constants]
|
|
|
|
|
|
|
|
ifdef::env-github,rspecator-view[]
|
|
|
|
'''
|
|
== Implementation Specification
|
|
(visible only on this page)
|
|
|
|
=== Message
|
|
|
|
* Remove this "xxx" call.
|
|
* Replace this "xxx" call with a call to "yyy".
|
|
* Use the "LC_xxx" constant instead of a string literal.
|
|
|
|
|
|
'''
|
|
== Comments And Links
|
|
(visible only on this page)
|
|
|
|
=== on 19 Sep 2014, 14:25:45 Freddy Mallet wrote:
|
|
@Ann, I would mention PHP 5 in the title of this rule: "Deprecated functions in PHP 5 should not be used"
|
|
|
|
|
|
And would set the default severity to "Major" as there isn't any operational risk.
|
|
|
|
=== on 27 Jul 2015, 15:30:28 Ann Campbell wrote:
|
|
\[~linda.martin], I've added a note on ``++ereg_replace()++``/``++preg_replace()++`` based on [~alexandre.gigleux]'s comment. Note that I didn't do the research to see which later replacement is available in which later versions
|
|
|
|
=== on 13 Nov 2015, 15:10:25 Linda Martin wrote:
|
|
OK!
|
|
|
|
endif::env-github,rspecator-view[]
|