• 1

A PHP Error was encountered

Severity: Notice

Message: Undefined index: userid

Filename: views/question.php

Line Number: 191


File: /home/prodcxja/public_html/questions/application/views/question.php
Line: 191
Function: _error_handler

File: /home/prodcxja/public_html/questions/application/controllers/Questions.php
Line: 433
Function: view

File: /home/prodcxja/public_html/questions/index.php
Line: 315
Function: require_once

I've just updated my PHP version to 7.4, and i noticed this error pops up:

Array and string offset access syntax with curly braces is deprecated

here is part of my code which is triggering the above error:

public function getRecordID(string $zoneID, string $type = '', string $name = ''): string { 
    $records = $this->listRecords($zoneID, $type, $name);
    if (isset($records->result{0}->id)) {
        return $records->result{0}->id; 
    return false; 

there are few libraries in my project which is using curly braces like Google_Utils for string length, what's the best possible way to fix this issue?

let's say you have something like this in your code:

$str = "test";

Since PHP 7.4 curly braces method to get individual characters inside a string has been deprecated, so change the above syntax into this one:

$str = "test";
  • 0
Reply Report