Severity: 8192 Message: Methods with the same name as their class will not be constructors in a future version of PHP;

Andra Maullana picture Andra Maullana · Oct 29, 2016 · Viewed 27.5k times · Source

Severity: 8192

Message: Methods with the same name as their class will not be constructors in a future version of PHP; CI_Pagination has a deprecated constructor

Filename: libraries/Pagination.php

Line Number: 27

class CI_Pagination {

    var $base_url           = ''; // The page we are linking to
    var $total_rows         = ''; // Total number of items (database results)
    var $per_page           = 10; // Max number of items you want shown per page
    var $num_links          =  2; // Number of "digit" links to show before/after the currently viewed page
    var $cur_page           =  0; // The current page being viewed
    var $first_link         = '‹ First';
    var $next_link          = '>';
    var $prev_link          = '<';
    var $last_link          = 'Last ›';
    var $uri_segment        = 3;
    var $full_tag_open      = '';
    var $full_tag_close     = '';
    var $first_tag_open     = '';
    var $first_tag_close    = ' ';
    var $last_tag_open      = ' ';
    var $last_tag_close     = '';
    var $cur_tag_open       = ' ';
    var $cur_tag_close      = '';
    var $next_tag_open      = ' ';
    var $next_tag_close     = ' ';
    var $prev_tag_open      = ' ';
    var $prev_tag_close     = '';
    var $num_tag_open       = ' ';
    var $num_tag_close      = '';
    var $page_query_string  = FALSE;
    var $query_string_segment = 'per_page';

Answer

Someone Special picture Someone Special · Oct 29, 2016

Previously we used to declare class constructor using the class name itself

Class A
{

public function a(){
}
}

Now you need to change a() to construct, like this

public function __construct(){
}

And the error will disappear.