In PHP8 this has been changed
https://www.php.net/manual/en/migration80.incompatible.php
A number of warnings have been converted into Error exceptions:
Attempting to write to a property of a non-object. Previously this implicitly created an stdClass object for null, false and empty strings.
So if you add properties to a $var, you first need to make it a stdClass()
$var = new stdClass();
$var->propp1 = "nice";
$var->propp2 = 1234;