rfc:autovivification_false

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
Last revisionBoth sides next revision
rfc:autovivification_false [2021/06/05 19:32] – Reworked RFC to include NULL too dharmanrfc:autovivification_false [2021/06/23 21:11] – Close voting dharman
Line 1: Line 1:
-====== PHP RFC: Deprecate autovivification on false and/or null ======+====== PHP RFC: Deprecate autovivification on false ======
   * Date: 2021-05-25   * Date: 2021-05-25
   * Author: Kamil Tekiela <dharman@php.net>   * Author: Kamil Tekiela <dharman@php.net>
-  * Status: Under Discussion+  * Status: Accepted 
 +  * Draft implementation: https://github.com/php/php-src/pull/7131
   * Target Version: PHP 8.1   * Target Version: PHP 8.1
  
Line 11: Line 12:
 <PHP> <PHP>
 // From undefined // From undefined
-unset($arr)+$arr[] = 'some value'
-$arr[] = 2;+$arr['doesNotExist'][] = 2;
 // From false // From false
 $arr = false; $arr = false;
Line 21: Line 22:
 </PHP> </PHP>
  
-This RFC talks **only about autovivification from %%false%% and %%null%%**. +This RFC talks **only about autovivification from %%false%%**. 
  
 ===== Proposal ===== ===== Proposal =====
  
-The proposal is to disallow autovivification from %%false%% values and/or %%null%%. We will continue to allow autovivification from undefined variable, but in every other case an error message will be shown:+The proposal is to disallow autovivification from %%false%% values. We will continue to allow autovivification from undefined variable and %%null%%, but in every other case an error message will be shown:
  
 > Cannot use a scalar value as an array > Cannot use a scalar value as an array
  
-In PHP 8.1, appending to a variable of type false will throw a deprecation error+In PHP 8.1, appending to a variable of type false will display a deprecation noticeFor example:
  
-In PHP 9.0, this will throw a fatal error. +> Deprecated: Automatic conversion of false to array is deprecated in 
 + 
 +In PHP 9.0, this will throw a fatal error, the same as for other scalar types
  
 ===== Rationale ===== ===== Rationale =====
Line 50: Line 53:
 ===== Backward Incompatible Changes ===== ===== Backward Incompatible Changes =====
  
-Every single usage autovivification on false values will throw a deprecation error in PHP 8.1 and throw a fatal error in PHP 9.0. A secondary vote will decide if autovivification should be forbidden from %%null%% values too.+Every single usage autovivification on false will throw a deprecation error in PHP 8.1 and throw a fatal error in PHP 9.0.
  
 ===== Vote ===== ===== Vote =====
  
 Should we deprecate autovivification from false? Should we deprecate autovivification from false?
 +
 +Started: 2021-06-09T20:00:00Z\\
 +Ends: 2021-06-23T20:00:00Z
  
 <doodle title="Deprecate autovivification from false?" auth="dharman" voteType="single" closed="true">  <doodle title="Deprecate autovivification from false?" auth="dharman" voteType="single" closed="true"> 
Line 61: Line 67:
 </doodle> </doodle>
  
-\\ +===== Discussion on internals ====== 
-Should we deprecate autovivification from null?+ 
 +https://externals.io/message/114595
  
-<doodle title="Deprecate autovivification from null?" auth="dharman" voteType="single" closed="true">  
-   * Yes 
-   * No 
-</doodle> 
rfc/autovivification_false.txt · Last modified: 2021/07/20 16:42 by dharman