• Hello,

    With PHP7 just around the corner, I wanted to notify you that class constructors may not be named the same as their class anymore.

    This will output the following deprecation notice:

    Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; AP_Search_Widget has a deprecated constructor in /.../wp-content/plugins/anspress-question-answer/widgets/search.php on line 18

    This is also the case for:

    AnsPress_Subscribe_Widget
    AnsPress_Stats_Widget
    AP_Related_questions
    AP_Questions_Widget
    AnsPress_Breadcrumbs_Widget
    AP_followers_Widget
    AP_User_Widget

    The alternative and solution would be – and is supported by PHP5 and up:
    public function __construct() { }

    More information: http://php.net/manual/en/migration70.deprecated.php
    Even more: http://php.net/manual/en/language.oop5.decon.php (note the big red Warning)

    PHP4 style constructors will also cause PHP conflicts between 5.3.2 and below and 5.3.3 and up.

    Thanks and have a great day! 🙂

    https://ww.wp.xz.cn/plugins/anspress-question-answer/

Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘PHP7 compatibility’ is closed to new replies.