Error PHP 7.4 Trying to access array offset on value of type bool in

6k views Asked by At

enter image description here

enter image description here

linea 25

if($respuesta["usuario"] == $_POST["ingUsuario"] && $respuesta["password"]== $encriptar){
1

There are 1 answers

0
FlavioS On

Since PHP 7.4 it will generate a notice when trying to use values of type null, bool, int, float or resource as an array.

https://www.php.net/manual/en/migration74.incompatible.php#migration74.incompatible.core.non-array-access

Array-style access of non-arrays

Trying to use values of type null, bool, int, float or resource as an array (such as $null["key"]) will now generate a notice.

To avoid notice you could check first if $respuesta is an array:

if(is_array($respuesta) && $respuesta["usuario"] == $_POST["ingUsuario"] && $respuesta["password"]== $encriptar){