Как исправить ошибку пхп связаную с разными версиями пхп в курсе codeigniter и в коде пхп 7.4.6?
A PHP Error was encountered
Severity: Notice
Message: Trying to access array offset on value of type null
Filename: controllers/News.php
Line Number: 68, 69, 70
Backtrace:
File: C:\xampp\htdocs\kinomonster\application\controllers\News.php
Line: 70
Function: _error_handler
File: C:\xampp\htdocs\kinomonster\index.php
Line: 315
Function: require_once
public function edit($slug = NULL) {
$this->data['title'] = "редактировать новость";
$this->data['news_item'] = $this->news_model->getNews($slug);
/*if(empty($this->data['news_item'])) {
show_404();
}*/
$this->data['title_news'] = $this->data['news_item']['title'];
$this->data['content_news'] = $this->data['news_item']['text'];
$this->data['slug_news'] = $this->data['news_item']['slug'];
if($this->input->post('slug') && $this->input->post('title') && $this->input->post('text')) {
$slug = $this->input->post('slug');
$title = $this->input->post('title');
$text = $this->input->post('text');
if($this->news_model->updateNews($slug, $title, $text)) {
echo "Новость успешно отредактирована";
}
}
$this->load->view('templates/header', $this->data);
$this->load->view('news/edit', $this->data);
$this->load->view('templates/footer');
}