this is the error
A PHP Error was encountered Severity: 8192
Message: ctype_digit(): Argument of type null will be interpreted as string in the future
Filename: libraries/Pagination.php
Line Number: 526
Backtrace:
File: C:\xampp\htdocs\ci_pagination\application\controllers\country.php Line: 25 Function: create_links
File: C:\xampp\htdocs\ci_pagination\index.php Line: 315 Function: require_once
controller country.php
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
class country extends CI_Controller {
public function __construct() {
parent::__construct();
$this->load->library('pagination');
$this->load->database();
$this->load->model('country_model');
}
public function index() {
$config = array();
$config["base_url"] = site_url("country/index");
$config["total_rows"] = $this->country_model->record_count();
$config["per_page"] = 3;
$config["uri_segment"] = 3;
$this->pagination->initialize($config);
$page = ($this->uri->segment(3)) ? $this->uri->segment(3) : 0;
$data["countries"] = $this->country_model->fetch_countries($config["per_page"], $page);
$data["links"] = $this->pagination->create_links();
$this->load->view('country_list', $data);
}
}
It is a known issue with PHP 8+ versions.
Someone mentioned a possible solution until the official staff solves it in the next release:
Change the 518 line of code in system/libraries/Pagination.php, make a type casting on the $this->cur_page
variable to string:
From:
if ( ! ctype_digit($this->cur_page) OR ($this->use_page_numbers && (int) $this->cur_page === 0))
to:
if ( ! ctype_digit((string) $this->cur_page) OR ($this->use_page_numbers && (int) $this->cur_page === 0))
https://github.com/bcit-ci/CodeIgniter/commit/3e5d10956b0b34c248b388a98b9cf41739dc5c2c