Fixed XF\Mvc\Entity\Finder is not compatible with ?? operator

Xon

Well-known member
Affected version
2.2.8 Patch 1
XF\Mvc\Entity\Finder implements __get but not __isset this interacts unexpectedly with the ?? operator.

For objects, the ?? operator calls __isset() first before calling __get. This results in LogicException being thrown instead of the ?? operator working as expected.

Something like this would preserve standard property testing and the relationship behavior (which doesn't appear to be used);

PHP:
public function __isset(string $key): bool
{
    return property_exists($this, $key) || isset($this->structure->relations[$key]);
}

I ran into this when having add-on A extend a finder, that add-on B needs to interact with.
 
Last edited:

XF Bug Bot

XenForo bug fixer bot
Staff member
Thank you for reporting this issue, it has now been resolved. We are aiming to include any changes that have been made in a future XF release (2.2.9).

Change log:
Implement __isset() in the Finder class
There may be a delay before changes are rolled out to the XenForo Community.
 
Top