Fixed Can't upload image without error

Affected version
2.0.0 Beta 1
This error appears:

Code:
ErrorException: array_keys() expects parameter 1 to be array, null given in src/addons/XFMG/Notifier/Media/CategoryWatch.php at line 70
XF::handlePhpError()
array_keys() in src/addons/XFMG/Notifier/Media/CategoryWatch.php at line 70
XFMG\Notifier\Media\CategoryWatch->getDefaultNotifyData() in src/XF/Service/AbstractNotifier.php at line 258
XF\Service\AbstractNotifier->ensureDataLoaded() in src/XF/Service/AbstractNotifier.php at line 31
XF\Service\AbstractNotifier->notify() in src/XF/Service/AbstractNotifier.php at line 56
XF\Service\AbstractNotifier->notifyAndEnqueue() in src/addons/XFMG/Service/Media/Creator.php at line 282
XFMG\Service\Media\Creator->sendNotifications() in src/addons/XFMG/Pub/Controller/Media.php at line 664
XFMG\Pub\Controller\Media->finalizeMediaItemCreate() in src/addons/XFMG/Pub/Controller/Media.php at line 741
XFMG\Pub\Controller\Media->actionSaveMedia() in src/XF/Mvc/Dispatcher.php at line 232
XF\Mvc\Dispatcher->dispatchClass() in src/XF/Mvc/Dispatcher.php at line 85
XF\Mvc\Dispatcher->dispatchLoop() in src/XF/Mvc/Dispatcher.php at line 41
XF\Mvc\Dispatcher->run() in src/XF/App.php at line 1771
XF\App->run() in src/XF.php at line 319
XF::runApp() in index.php at line 13
 

Attachments

  • Bildschirmfoto 2017-09-06 um 11.05.13.webp
    Bildschirmfoto 2017-09-06 um 11.05.13.webp
    81.6 KB · Views: 9
Are you uploading to an album or a category?

There was an incomplete fix for this issue yesterday before release.

To fix, edit the file src/addons/XFMG/Notifier/Media/CategoryWatch.php

Line 68 is:
PHP:
$category = $mediaItem->Category;

Below that add:
PHP:
if (!$category)
{
    return [];
}
 
Back
Top Bottom