rfc:deprecate-bareword-strings

Differences

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

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
rfc:deprecate-bareword-strings [2017/03/05 22:03]
imsop flesh out important points, add links to implementation
rfc:deprecate-bareword-strings [2018/03/01 23:25] (current)
carusogabriel RFC was implemented in PHP 7.2
Line 3: Line 3:
   * Date: 2017-03-05   * Date: 2017-03-05
   * Author: Rowan Collins rowan.collins@gmail.com   * Author: Rowan Collins rowan.collins@gmail.com
-  * Status: In Discussion+  * Status: Implemented (in PHP 7.2)
   * First Published at: http://wiki.php.net/rfc/deprecate-bareword-strings   * First Published at: http://wiki.php.net/rfc/deprecate-bareword-strings
  
Line 65: Line 65:
   - In PHP 8.0, remove the fallback, and replace the ''E_WARNING'' with a thrown ''Error'' with message ''Use of undefined constant %s''   - In PHP 8.0, remove the fallback, and replace the ''E_WARNING'' with a thrown ''Error'' with message ''Use of undefined constant %s''
  
-It might seem surprising to raise an ''E_WARNING'' with text suggesting deprecation, rather than an ''E_DEPRECATED''However, we need to balance two aims:+===== E_WARNING vs E_DEPRECATED ===== 
 + 
 +It might seem surprising to raise an ''E_WARNING'' with text suggesting deprecation, rather than an ''E_DEPRECATED''This was chosen because we need to balance two aims:
  
   * If a user is relying on the fallback to string, we should communicate that this feature is officially deprecated and slated for removal.   * If a user is relying on the fallback to string, we should communicate that this feature is officially deprecated and slated for removal.
Line 72: Line 74:
 To make the message visible, we want to use an error level likely to be enabled both in development and production configurations. Since ''E_DEPRECATED'' is actually //less// likely to be enabled than ''E_NOTICE'', switching to ''E_DEPRECATED'' would effectively "downgrade" the visibility of the message. Our two aims are therefore in direct conflict. To make the message visible, we want to use an error level likely to be enabled both in development and production configurations. Since ''E_DEPRECATED'' is actually //less// likely to be enabled than ''E_NOTICE'', switching to ''E_DEPRECATED'' would effectively "downgrade" the visibility of the message. Our two aims are therefore in direct conflict.
  
-This RFC therefore takes the position that it is more likely that people will trigger this behaviour by mistake, so the priority is to make such a mistake obvious, so ''E_WARNING'' is the correct severity.+This RFC takes the position that it is more likely that people will trigger this behaviour by mistake, so the priority is to make such a mistake obvious; thus ''E_WARNING'' is the correct severity. 
 + 
 +The proposed wording is also an attempt to balance these two possibilities. The use of parentheses is to avoid the awkward phrasing "in a future version of PHP in..." which would otherwise appear in the full output: 
 + 
 +<blockquote>Warning: Use of undefined constant FOO - assumed 'FOO' (this will throw an error in a future version of PHP) in foo.php on line 1</blockquote>
  
 ===== Backward Incompatible Changes ===== ===== Backward Incompatible Changes =====
Line 113: Line 119:
  
  
-===== Proposed Voting Choices =====+===== Voting =====
  
-A single yes/no vote requiring a 2/3 majority.+Voting opened on 2017-03-08, and will close on 2017-03-22 at 22:00 UTC
  
-In PHP 7.2, replace the "Undefined constant" ''E_NOTICE'' with an ''E_WARNING'' stating that the fallback is deprecated; and in PHP 8.0, remove the fallback and replace the ''E_WARNING'' with an ''Error''.+The vote requires a 2/3 majority to accept the proposal.
  
 +Voting is on the following proposal:
 +
 +  - In PHP 7.2, raise the severity of the message "Use of undefined constant" from E_NOTICE to E_WARNING, and change the text of the message to ''Use of undefined constant %s; assumed '%s' (this will throw an error in a future version of PHP)''
 +  - In PHP 8.0, remove the fallback, and replace the ''E_WARNING'' with a thrown ''Error'' with message ''Use of undefined constant %s''
  
-===== Patches and Tests =====+<doodle title="Raise severity of undefined constants to E_WARNING in 7.2, and Error in 8.0?" auth="imsop" voteType="single" closed="true"> 
 +   * Yes 
 +   * No 
 +</doodle>
  
-None yet. 
  
 ===== Implementation ===== ===== Implementation =====
  
-  * Pull Request implementing the change itself: https://github.com/php/php-src/pull/2404+  * Pull Request implementing the change itself: https://github.com/php/php-src/pull/2404  
 +  * Merged into master: https://github.com/php/php-src/commit/1b565f1393f82e0ce0c94806cc7f52c6d9c5e87d
   * Pull Request to the Language Spec documenting the new behaviour: https://github.com/php/php-langspec/pull/193   * Pull Request to the Language Spec documenting the new behaviour: https://github.com/php/php-langspec/pull/193
  
rfc/deprecate-bareword-strings.1488751384.txt.gz · Last modified: 2017/09/22 13:28 (external edit)