Confirmed Unexpected behavior from \XF::getClassForAlias

Xon

Well-known member
Affected version
2.3.0
\XF::getClassForAlias will sometimes suggest incorrect replacements for some View handlers;

XF\Pub\View\Reaction\React => XF\Pub\View\Reaction\ReactHandler
XF\Pub\View\Attachment\View => XF\Pub\View\Attachment\ViewHandler
XF\Pub\View\Like\Like => XF\Pub\View\Like\LikeHandler
XF\Api\View\Attachment\View => XF\Api\View\Attachment\ViewHandler
XF\Admin\View\Attachment\View => XF\Admin\View\Attachment\ViewHandler
 
getClassForAlias also suggests bad aliases for these classes:

Code:
XF\ModeratorLog\Logger
XF\Poll\ResponseEditor
XF\Tag\RenderWrapper
XF\ChangeLog\DisplayEntry
XF\Attachment\Manipulator
XF\AdminSearch\TypeResultSet
XF\AdminSearch\Searcher
XF\ActivitySummary\Instance
XF\Sitemap\Entry
XF\Sitemap\BuildState
XF\Sitemap\Builder
XF\Sitemap\Renderer

These namespaces aren't renamed, so should not return aliases:
Code:
XF\Install
XF\Template\Compiler
XF\InlineMod
XF\Stats\Grouper

It probably should skip classes which start with Abstract or end with Trait/Interface

Aka when generating the class_alias list for https://xenforo.com/community/resources/xf2-2-xf2-3-rename-aliases.9498/ I made a script to call getClassForAlias on every XF2.2 file and then checked the resulting list to see if it pointed to a non-existent class.
 
Back
Top Bottom