Make WordPress Core


Ignore:
Timestamp:
06/28/2015 03:26:41 PM (9 years ago)
Author:
jorbin
Message:

Deprecate php4 style constructors

PHP7 is deprecating PHP4 style constructors, so we need to modify our code to have _construct methods that fire before the named PHP4 style constructors. The PHP4 style constructors will call the PHP5 style constructor in case it is being called directly (usually via parent::METHOD).

This modifies external libraries to add PHP5 style constructors, but doesn't add a notice for when they are used. In WordPress core code, PHP4 style constructors are being given a call to _deprecated_constructor. To the PHP4 style constructor I say "I know that I can't take no more | It ain't no lie | I wanna see you out that door | Baby, bye, bye, bye..."

Upstream: https://wiki.php.net/rfc/remove_php4_constructors

Props jdgrimes, netweb, jorbin
See #31982

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/includes/utils.php

    r31046 r32990  
    2626    var $debug;
    2727
    28     function MockAction($debug=0) {
     28    /**
     29     * PHP5 constructor.
     30     */
     31    function __construct( $debug = 0 ) {
    2932        $this->reset();
    3033        $this->debug = $debug;
     34    }
     35
     36    /**
     37     * PHP4 constructor.
     38     */
     39    public function MockAction( $debug = 0 ) {
     40        self::__construct( $debug );
    3141    }
    3242
     
    130140    var $data = array();
    131141
    132     function testXMLParser($in) {
     142    /**
     143     * PHP5 constructor.
     144     */
     145    function __construct( $in ) {
    133146        $this->xml = xml_parser_create();
    134147        xml_set_object($this->xml, $this);
     
    137150        xml_set_character_data_handler($this->xml, array($this, 'dataHandler'));
    138151        $this->parse($in);
     152    }
     153
     154    /**
     155     * PHP4 constructor.
     156     */
     157    public function testXMLParser( $in ) {
     158        self::__construct( $in );
    139159    }
    140160
Note: See TracChangeset for help on using the changeset viewer.