CodeIgniter Forums
$this->request variable type error using strpos - Printable Version

+- CodeIgniter Forums (
+-- Forum: CodeIgniter 4 (
+--- Forum: CodeIgniter 4 Support (
+--- Thread: $this->request variable type error using strpos (/showthread.php?tid=86115)

$this->request variable type error using strpos - serialkiller - 01-11-2023

After upgrading to version 4.3.0 VsCode gives me a type error

PHP Code:
if (=== strpos($this->request->getGet('todo'), 'modifica_')) 

VsCode (intelephense), gives me an error in $this->request->getGet('todo') - Expected type 'string' Found array|null

I did a test by checking the type with

PHP Code:
echo gettype($this->request->getGet('todo')); 

It correctly returns me string

The only way to make the error go away is to cast to string

PHP Code:
if (=== strpos((string)$this->request->getGet('todo'), 'modifica_')) 

The application works in all three ways, but I would like to understand what it depends on