Last night out of the blue our site stopped functioning correctly. I traced the issue to the following function in ActiveQuery:
public function one($db = null)
{
$row = parent::one($db);
if ($row !== false) {
$models = $this->populate([$row]);
return reset($models) ?: null;
} else {
return null;
}
}
To confirm what is being returned from this function, if I add the following line before the first return statement I get NULL:
var_dump(reset($models) ?: null);
However, if I add the following line before the first return statement I get the anticipated row:
var_dump(reset($models));
The code works on my local machine (php 5.4.3) and used to work on the hosting server (php 5.4.41). I am in the process of seeing if they upgraded PHP overnight.
Any idea what is causing this syntax to fail on our hosting server?