I have the following PHP5 code:
$request = NULL;
$request->{"header"}->{"sessionid"} = $_SESSION['testSession'];
$request->{"header"}->{"type"} = "request";
Lines 2 and 3 are producing the following error:
PHP Strict standards: Creating default object from empty value
How can I fix this error?
Null isn’t an object, so you can’t assign values to it. From what you are doing it looks like you need an associative array. If you are dead set on using objects, you could use the stdClass
I would recommend using arrays, as it is a neater syntax with (probably) the same underlying implementation.