united states of america usa  linkedinfacebook   Call Us Today: (786) 646-6461

PHP Error: "Trying to get property of non-object"

php logoThis is a common PHP error, which means that you are trying to access object property on a null/non-existing object. To avoid this, you need to check if the property is defined. So instead of doing something like this, which produces an error:

 $source_type = $t->idItem->idReport->idSource;

Check to see if the property is defined:

if(isset($t->idItem->idReport->idSource)){
      $source_type = $t->idItem->idReport->idSource;
}

 ALT is a full-service IT consulting, support and development company. Contact us for any projects that you may have.