rfc:deprecations_php_8_5

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
rfc:deprecations_php_8_5 [2024/11/06 15:29] nicolasgrekasrfc:deprecations_php_8_5 [2024/11/28 17:47] (current) – Add exclude_disabled param deprecation girgias
Line 18: Line 18:
   * Make ''$filter'' parameter mandatory for <php>filter_*()</php> functions   * Make ''$filter'' parameter mandatory for <php>filter_*()</php> functions
   * Deprecate FILTER_CALLBACK filter   * Deprecate FILTER_CALLBACK filter
-  * Deprecate <php>filter_input()</php> and <php>filter_input_array()</php>+  * Deprecate <php>filter_input()</php><php>filter_input_array()</php>, and <php>filter_has_var()</php>
   * Deprecate the ''docref_root'' and ''docref_ext'' INI directives   * Deprecate the ''docref_root'' and ''docref_ext'' INI directives
   * Deprecate the ''error_prepend_string'' and ''error_append_string'' INI directives   * Deprecate the ''error_prepend_string'' and ''error_append_string'' INI directives
Line 24: Line 24:
   * Deprecate the ''register_argc_argv'' INI directive   * Deprecate the ''register_argc_argv'' INI directive
   * Formally deprecate mysqli_execute   * Formally deprecate mysqli_execute
 +  * Deprecate <php>__construct()</php> and <php>__destruct()</php> in interfaces
 +  * Deprecate semicolon after ''case'' in switch statement
 +  * Deprecate the <php>$exclude_disabled</php> parameter of <php>get_defined_functions()</php>
  
 ===== Proposal ===== ===== Proposal =====
Line 79: Line 82:
  
  
-==== Deprecate filter_input() and filter_input_array() ====+==== Deprecate filter_input()filter_input_array(), and filter_has_var() ====
  
 Author: Gina Peter Banyard <girgias@php.net> Author: Gina Peter Banyard <girgias@php.net>
Line 130: Line 133:
 and <php>filter_var_array($_GET, /* other params */)</php>, and <php>filter_var_array($_GET, /* other params */)</php>,
 we propose to deprecate <php>filter_input()</php> and <php>filter_input_array()</php>. we propose to deprecate <php>filter_input()</php> and <php>filter_input_array()</php>.
 +
 +As <php>filter_has_var()</php> is effectively equivalent to <php>array_key_exists()</php>,
 +but has the same caveat as the two previous functions, we propose to also deprecate this function.
  
 ==== Deprecate the docref_root and docref_ext INI directives ==== ==== Deprecate the docref_root and docref_ext INI directives ====
Line 178: Line 184:
  
 TODO: https://www.php.net/manual/en/function.mysqli-execute.php TODO: https://www.php.net/manual/en/function.mysqli-execute.php
 +
 +==== Deprecate __construct() and __destruct() in interfaces ====
 +
 +Author: Tim Düsterhus <timwolla@php.net>
 +
 +TODO: https://phpc.social/@dseguy/113476785631597024 / https://github.com/php/php-src/issues/16077
 +
 +==== Deprecate semicolon after case in switch statement ====
 +
 +Author: Theodore Brown <theodorejb@php.net>
 +
 +It is possible to terminate ''case'' statements with a semicolon instead of the standard colon:
 +
 +<PHP>
 +switch ($value) {
 +    case 'foo';
 +    case 'bar':
 +    case 'baz';
 +        echo 'foo, bar, or baz';
 +        break;
 +    default;
 +        echo 'Other';
 +}
 +</PHP>
 +
 +This syntax is a leftover from PHP/FI 2, where nearly all lines including if conditions and case statements were terminated by a semicolon. [[https://externals.io/message/109350#109363|1]] [[https://www.php.net/manual/phpfi2.php#lang|2]]
 +
 +There isn't a need for this syntax to exist anymore, and very few PHP developers are even aware of its existence. In the top 1000 Composer packages, zero out of 35,777 total case statements are using the alternate syntax (as of 2024-11-27).
 +
 +Case statements followed by a semicolon can cause confusion, as a developer may think they behave differently in some way from regular case statements (e.g. preventing fallthrough), when they do not.
 +
 +Therefore, we propose to deprecate terminating case statements with a semicolon.
 +
 +
 +==== Deprecate the $exclude_disabled parameter of get_defined_functions() ====
 +
 +Author: Gina Peter Banyard <girgias@php.net>
 +
 +As of PHP 8.0.0, functions that are disabled via the ''disable_functions'' INI setting are simply removed from the function table.
 +As such, this parameter has no longer any effect and is pointless.
 +Therefore, we propose to deprecate it.
  
 ===== Backward Incompatible Changes ===== ===== Backward Incompatible Changes =====
rfc/deprecations_php_8_5.1730906969.txt.gz · Last modified: 2024/11/06 15:29 by nicolasgrekas