rfc:remove_php4_constructors

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
Next revision Both sides next revision
rfc:remove_php4_constructors [2015/02/17 21:04]
levim Some clarifications.
rfc:remove_php4_constructors [2015/03/10 19:20]
levim Close voting.
Line 4: Line 4:
   * Author: Levi Morrison <levim@php.net>   * Author: Levi Morrison <levim@php.net>
   * Contributors: Andrea Faulds <ajf@ajf.me>   * Contributors: Andrea Faulds <ajf@ajf.me>
-  * Status: Under Discussion+  * Status: Accepted
   * First Published at: http://wiki.php.net/rfc/remove_php4_constructors   * First Published at: http://wiki.php.net/rfc/remove_php4_constructors
  
Line 54: Line 54:
 PHP 7 will also stop emitting ''E_STRICT'' when a method with the same name as the class is present as well as ''<nowiki>__construct</nowiki>''. PHP 7 will also stop emitting ''E_STRICT'' when a method with the same name as the class is present as well as ''<nowiki>__construct</nowiki>''.
  
-Some code samples in the [[#examples|Examples]] section show how code is impacted.+Refer to the [[#examples|Examples]] section to see how code is impacted.
  
 ==== Backward Incompatible Changes ==== ==== Backward Incompatible Changes ====
 Since an ''E_DEPRECATED'' will be emitted in PHP 7 there may be some backwards compatibility breaks when people use custom error handlers. Since an ''E_DEPRECATED'' will be emitted in PHP 7 there may be some backwards compatibility breaks when people use custom error handlers.
  
-In PHP 8 recognition for old constructors will be outright removed, meaning that anything without a ''<nowiki>__construct</nowiki>'' will not work. The fix is to rename the constructor to ''<nowiki>__construct</nowiki>''.+In PHP 8 recognition for old constructors will be outright removed, meaning that anything without a ''<nowiki>__construct</nowiki>'' will not work the same way it used to. The old-style constructor will be considered a normal method and will not be called when the object is constructed. The fix is to rename the constructor to ''<nowiki>__construct</nowiki>''.
  
 ==== Examples ==== ==== Examples ====
Line 104: Line 104:
  
 <PHP> <PHP>
-class Filter { +class Filter { 
 +    // PHP 5: filter is a constructor 
 +    // PHP 7: filter is a constructor and E_DEPRECATED is raised 
 +    // PHP 8: filter is a normal method and is not a constructor; no E_DEPRECATED is raised
     function filter() {}     function filter() {}
 } }
Line 126: Line 129:
  
 This RFC requires 2/3 vote in favor of deprecating and removing PHP 4 style constructors to pass. This RFC requires 2/3 vote in favor of deprecating and removing PHP 4 style constructors to pass.
 +
 +Do you vote to remove PHP 4 constructors as outlined in this RFC?
 +
 +<doodle title="remove_php4_constructors" auth="levim" voteType="single" closed="true">
 +   * Yes
 +   * No
 +</doodle>
 +
 +Voting will close on the evening (UTC-7) of March 6th.
  
 ===== Patches and Tests ===== ===== Patches and Tests =====
 An implementation based on the master branch can be found here: https://github.com/php/php-src/pull/1061 An implementation based on the master branch can be found here: https://github.com/php/php-src/pull/1061
  
rfc/remove_php4_constructors.txt · Last modified: 2017/09/22 13:28 (external edit)