XF\Mvc\Entity\Manager::getFinder can frequently throw exceptions

Xon

Well-known member
Licensed customer
Affected version
2.3.9
getFinder() support Entity/Finder class references, but it does this by calling \XF::classToString() twice.

The problem is the 1st call throws an InvalidArgumentException exception, this is an issue for two reasons;
  • When a debugger is attached via xdebug (aka phpstorm) this pauses execution, InvalidArgumentException is used elsewhere so just ignoring this exception type isn't great.
    • Depend on the page, this can cause a lot of exceptions which makes debugging painful.
  • Exceptions are significantly more expensive than a simple string check as they capture the entire stack and any argument, which in php means a pile of work
Perhaps a classToString version which takes a regex so the formatter %s\(Entity|Finder)\%s could be used?
 
Last edited:
Back
Top Bottom