We have been experience an intermittent issue with variables of instantiated objects seemingly randomly becoming null within a line or two of code.
For example
class Club {
}
class Foo {
public function Bar(Club $club)
{
// Do something
}
}
$club = new Club();
(new Foo())->Bar($club);
Would through an error Argument 1 passed to Foo::bar() must be an instance of Club, null given
this has been particularly prevalent when running unit tests but have seen it seen it on occasion occur on live requests.
Have even tried using mockery to circumnavigate any possible issues within the Club class
$club = Mockery::mock(Club::class);
(new Foo())->Bar($club);
This is running PHP 7.0.12-1 on Ubuntu 14.04.3 LTS and PHPUnit 5.4.7
Anybody experienced any similar issues? or any ideas on how to debug such an issue (especially given the intermittent nature of it)