XF 2.3 addon_list_macros :: addon_list_item_icon() error: Call to undefined method

eDaddi

Active member
I started getting this error in my dev environment:

Code:
Server error log
Error: Macro admin:addon_list_macros :: addon_list_item_icon() error: Call to undefined method XF\Util\File::getImageMimeType() src/XF/AddOn/AddOn.php:410
Generated by: Austin Oct 21, 2024 at 4:50 PM
Stack trace
#0 src/XF/Template/Templater.php(1283): XF\AddOn\AddOn->getIconUri()
#1 internal_data/code_cache/templates/l1/s0/admin/addon_list_macros.php(198): XF\Template\Templater->method(Object(XF\AddOn\AddOn), 'getIconUri', Array)
#2 src/XF/Template/Templater.php(922): XF\Template\Templater->{closure}(Object(SV\StandardLib\XF\Template\Templater), Array, NULL)
#3 internal_data/code_cache/templates/l1/s0/admin/addon_list_macros.php(112): XF\Template\Templater->callMacro('addon_list_macr...', 'addon_list_item...', Array, Array)
#4 src/XF/Template/Templater.php(922): XF\Template\Templater->{closure}(Object(SV\StandardLib\XF\Template\Templater), Array, NULL)
#5 internal_data/code_cache/templates/l1/s0/admin/index.php(592): XF\Template\Templater->callMacro('addon_list_macr...', 'addon_list_item', Array, Array)
#6 src/XF/Template/Templater.php(1792): XF\Template\Templater->{closure}(Object(SV\StandardLib\XF\Template\Templater), Array, NULL)
#7 src/addons/MaZ/AUN/XF/Template/Templater.php(39): XF\Template\Templater->renderTemplate('index', Array, true, NULL)
#8 src/XF/Template/Template.php(24): MaZ\AUN\XF\Template\Templater->renderTemplate('admin:index', Array)
#9 src/XF/Mvc/Renderer/Html.php(50): XF\Template\Template->render()
#10 src/XF/Mvc/Dispatcher.php(471): XF\Mvc\Renderer\Html->renderView('XF:Index', 'admin:index', Array)
#11 src/XF/Mvc/Dispatcher.php(453): XF\Mvc\Dispatcher->renderView(Object(XF\Mvc\Renderer\Html), Object(XF\Mvc\Reply\View))
#12 src/XF/Mvc/Dispatcher.php(412): XF\Mvc\Dispatcher->renderReply(Object(XF\Mvc\Renderer\Html), Object(XF\Mvc\Reply\View))
#13 src/XF/Mvc/Dispatcher.php(66): XF\Mvc\Dispatcher->render(Object(XF\Mvc\Reply\View), 'html')
#14 src/XF/App.php(2826): XF\Mvc\Dispatcher->run()
#15 src/XF.php(806): XF\App->run()
#16 admin.php(15): XF::runApp('XF\\Admin\\App')
#17 {main}
Request state
array(4) {
  ["url"] => string(10) "/admin.php"
  ["referrer"] => string(54) "https://{domain}/admin.php?logs/server-errors/"
  ["_GET"] => array(0) {
  }
  ["_POST"] => array(0) {
  }
}

Per usual: "I just left my computer and came back to the error" 😂

What I was doing before wouldn't have affected this. I went into the getIconUri function and printed out $this to see what would be causing it. I get the full add-on object:
Code:
XF\AddOn\AddOn Object
(
    [manager:protected] => SV\StandardLib\XF\AddOn\Manager Object
        (
            [addOnDir:protected] => {redacted}/src/addons
            [jsonInfo:protected] => Array
                ( (arrays of add-on data here)

and I see getIconUri is looking for $this->icon, which will not work with that whole object being returned and the add-on data being in arrays.

So I'm confused what could I have done to cause this?
 
The method \XF\Util\File::getImageMimeType does exist, though the call to it should be on line 404 of src/XF/AddOn/AddOn.php (vs 410 in your stack trace), at least in v2.3.4. It might be worth running a file health check to see if either or both of these files have been modified.

I see getIconUri is looking for $this->icon, which will not work with that whole object being returned and the add-on data being in arrays.
Per the magic methods in the class, property getters will defer to JSON keys or null if they don't exist.
 
Back
Top Bottom