Closed XF\Mvc\Entity\Manager\getFinder does not reliably return the same type depending on class extensions

Xon

Well-known member
Licensed customer
Affected version
2.2.13
XenForo's dynamically creates finders of a given base-type if they are extended or otherwise will return a \XF\Mvc\Entity\Finder instance.

The problem is when return and parameter arguments are narrower than the \XF\Mvc\Entity\Finder and will cause a type error violation.
  • XenForo does not define XF\Finder\Warning
  • Add-on A extended XF\Finder\Warning
  • Add-on B has a return type hint of XF\Finder\Warning
  • Add-on B is used without Add-on A, a type error will occur as the finder is no longer of the correct type.

The change to make getFinder to reliably return the expected types is fairly simple with just another class_alias call if the base finder doesn't exist. Note, there is another issue where the output of \XF::stringToClas() can be an Entity instead of a Finder

 
Automated triage: Not a bug

Thank you for reporting this issue. This report is stale. Since 2.3, every core entity has its own finder class, so that finder type now exists and matches whether or not another add-on extends it. If you still see a type mismatch on the current version, please open a new report with reproduction steps.

This is an automated assessment. A member of staff may review and update it.
 
Back
Top Bottom