Exchange-Web-Services-for-PHP
Exchange-Web-Services-for-PHP copied to clipboard
Warning: Creating default object from empty value in ExchangeClient.php on line 94
This only makes sense.. here is the code in the object:
public function get_events($start, $end) {
$this->setup();
$FindItem->Traversal = "Shallow";
$FindItem->ItemShape->BaseShape = "IdOnly";
$FindItem->ParentFolderIds->DistinguishedFolderId->Id = "calendar";
if($this->delegate != NULL) {
$FindItem->ParentFolderIds->DistinguishedFolderId->Mailbox->EmailAddress = $this->delegate;
}
$FindItem->CalendarView->StartDate = $start;
$FindItem->CalendarView->EndDate = $end;
$response = $this->client->FindItem($FindItem);
..................................
$FindItem isn't even defined or anything... so it's throwing the error about creating a default object from an empty value. Is there a better way to go about this? Instead of just doing:
$FindItem = new StdClass;
Because then it throws an error on line 95 ($FindItem->ItemShape->BaseShape) because then it becomes a multi-dimensional object... which would be tedious to make every single level an StdClass..
Thanks for any help.
This happens in /lib/ExchangeClient.php on line 195 as well. The fix for me was to instantiate the Mailbox property as stdClass: $FindItem->ParentFolderIds->DistinguishedFolderId->Mailbox = new stdClass();
This also happens on serveral other locations, like ExchangeClient.php in create_event() function. Everytime an object is referenced which is not instantiated before. I could fix it with the same as seanBlommaert said, create an object and assign it.