ErrorException Trying to access array offset on value of type null |
I just upgraded XAMPP and PHP version 7.49 and opened a project under development getting an error "ErrorException
Trying to access array offset on value of type null" but previously there was no such error. Can anyone solve the problem?
You just missed the parameter, the correct function should be:
public function getAccess($menu) { $queryMenu = $this->getIdMenu($menu); $id_menu = $queryMenu['id_user_menu']; } Also check 1 more thing: Be sure that you are returning a valid value from getIdMenu($menu) function. For this sake, you have exceptions or a more simple way, a condition. Something like this: public function getIdMenu($menu){ Here goes the code before this part $variable = this->db->get(); $result = $variable->row_array(); if(!empty($result['id_user_menu'])) return $result; return FALSE; }
Hi,
I am getting the same Error as below, while receiving the Json API Response; "title": "ErrorException", "type": "ErrorException", "code": 500, "message": "Trying to access array offset on value of type null", And the Controller code is as below; <?php namespace App\Controllers; use CodeIgniter\Controller; class Rupiso_callback extends BaseController { public function __construct(){ } public function index(){ $cryptedText = file_get_contents('php://input'); $responce = json_decode($cryptedText, true); $type = $responce['type']; $field1 = $responce['field1']; if($type == "COLLOCTION"){ $agent_id = substr($field1, 4, 15); } else{ $agent_id = substr($field1, 4, 15); } $tnxid = $responce['tnxid']; $amount = $responce['amount']; $payer_via = $responce['field2']; $rupiso_log = [ 'agent_id' => $agent_id, 'tnxid' => $tnxid, 'responce' => $cryptedText ]; $rupisoModel = new \App\Models\RupisoModel(); $query = $rupisoModel->insert($rupiso_log); } } ?> Please help to clear the issue.. |
Welcome Guest, Not a member yet? Register Sign In |