Not a bug Argument 1 passed to XenGallery_Model_Media::canViewUnapprovedMedia()

truonglv

Well-known member
Hi @Chris D , Im using latest version and I got it :)

Code:
ErrorException: Argument 1 passed to XenGallery_Model_Media::canViewUnapprovedMedia() must be of the type array, null given, called in /***/library/XenGallery/ControllerHelper/Media.php on line 198 and defined - library/XenGallery/Model/Media.php:2007
Generated By: Nobita, Today at 6:04 PM


Code:
#0 /***/library/XenGallery/Model/Media.php(2007): XenForo_Application::handlePhpError(4096, 'Argument 1 pass...', '/usr/local/ngin...', 2007, Array)
#1 /***/library/XenGallery/ControllerHelper/Media.php(198): XenGallery_Model_Media->canViewUnapprovedMedia(NULL)
#2 /***/library/XenGallery/ControllerPublic/Media.php(1310): XenGallery_ControllerHelper_Media->assertMediaValidAndViewable(9)
#3 /***/library/XenForo/FrontController.php(347): XenGallery_ControllerPublic_Media->actionFull()
#4 /***/library/XenForo/FrontController.php(134): XenForo_FrontController->dispatch(Object(XenForo_RouteMatch))
#5 /***/public_html/index.php(13): XenForo_FrontController->run()
#6 {main}
 
Pretty sure you're either not running the latest version, or at some point XenGallery/Model/Media.php hasn't updated.

Line 2007 is:
PHP:
public function canViewUnapprovedMedia(&$errorPhraseKey = '', array $viewingUser = null)

As you can see, there's no assertion there that the first argument should be an array.

I suggest re-uploading all files just to be sure.
 
I dont think so. Just look about code. And It is:
Code:
public function canViewUnapprovedMedia(&$errorPhraseKey = '', array $viewingUser = null)
    {
        $this->standardizeViewingUserReference($viewingUser);
       
        if (!$viewingUser['user_id'])
        {
            return false;
        }       
       
        return XenForo_Permission::hasPermission($viewingUser['permissions'], 'xengallery', 'approveUnapproveMedia');
    }

Also checked File Health Check. All files is OK
 
Do you have any add-ons that extend XenForo Media Gallery? Can you reproduce the problem now? That error was logged specifically as a result of loading a full image, e.g. http://yoursite.com/media/media-title.123/full

If it is not happening now, then it's likely some sort of caching. If it is happening now, clear/disable any caching and try again. Also disable all add-ons and try again.

I'm sure you can see from the code that basically that error is impossible, so there must be some other factors.
 


Write your reply...
Back
Top Bottom