Uploaded image for project: 'eZ Publish / Platform'
  1. eZ Publish / Platform
  2. EZP-27804

Avoid PHP7 deprecation errors when running legacy

    XMLWordPrintable

Details

    • Icon: Improvement Improvement
    • Resolution: Fixed
    • Icon: Medium Medium
    • 2017.10
    • 2017.08
    • Legacy stack

    Description

      Due to eZ Publish's history, most of the classes use PHP4 style constructors in the form

      class MyClass
      {
          function MyClass()
          {
              // Constructor
              $this->MyParentClass();
              // More code
          }
      }
      

      instead of

      class MyClass
      {
          public function __construct()
          {
              // Constructor
              parent::__construct();
              // More code
          }
      }
      

      This is problematic due to the following reasons:

      • If you want to use the parent's constructor, you have to call it explicitely
      • Derived classes call the parent constructor by its name instead of parent::__construct() which makes the refactoring of class names cumbersome
      • We don't know if and when a future version of PHP will stop supporting the PHP4 constructor methods
      • PHP 7 logs deprecation errors unless they are turned off

      Attachments

        Activity

          People

            Unassigned Unassigned
            jgamez jgamez
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: