PHP - Std :: Class error

1

I have the following code:

case 'operator-autentication':
    global $decoded;
    $array = array();
    $user = $decoded->user;
    $pass = $decoded->pass;
    $opr = new opr_func();
    $arrResp = $opr->loginFunc($user, $pass);
    if(empty($arrResp) == true) {
        $array[] = array('id' => '0');
    } else {
        foreach($opr->loginOperator($decoded->code, $decoded->pass) as $ip) {
            $array[] = array('id' => $ip->id, 'name' => $ip->name, 'clientId' => $ip->clientId);
        }
    }        
    echo json_encode($array);
    break;

When I test a send of parameters it happens the error:

  


Notice : Undefined property: stdClass :: $ user in /Applications/XAMPP/xamppfiles/htdocs/bullGreenPanel/assets/php/client/AppCollect.php online 94

If you do not use the var $decoded->code (which is the one that comes in the application) it works, what would be the reason and solution?

Ps: at the beginning of the code you have:

$postdata = file_get_contents("php://input");
$decoded = json_decode($postdata);
    
asked by anonymous 23.06.2017 / 14:56

0 answers