0
votes

Im getting what seems to be a common error in my php log, but cant seem to resolve based on other threads..

Im getting the error: PHP Warning: Creating default object from empty value in

Pointing at the following code:

$status = new \stdClass();

$status->about->requester       = $username;
$status->about->method          = $method;
$status->about->command         = $cmd;

The other posts all say to use ( $status = new \stdClass(); ) or variations of. I've tried them all, but the error persists.

Any thoughts?

Driving me insane as the log is somewhat very big and this is my only error.

1

1 Answers

1
votes

The error is not about $status object, but $status->about. Assign an instance of stdClass to it first and the error will go.

$status = new \stdClass();

$status->about = new \stdClass();

$status->about->requester       = 'username';
$status->about->method          = 'method';
$status->about->command         = 'cmd';