1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

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

Discussion in 'Media Gallery Resolved Bugs' started by Nobita.Kun, Jan 17, 2015.

  1. Nobita.Kun

    Nobita.Kun Well-Known Member

    Hi @Chris D , Im using latest version and I got it :)

    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

    #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}
  2. Chris D

    Chris D XenForo Developer Staff Member

    Pretty sure you're either not running the latest version, or at some point XenGallery/Model/Media.php hasn't updated.

    Line 2007 is:
    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.
  3. Nobita.Kun

    Nobita.Kun Well-Known Member

    I dont think so. Just look about code. And It is:
    public function canViewUnapprovedMedia(&$errorPhraseKey = '', array $viewingUser = null)
            if (!$viewingUser['user_id'])
                return false;
            return XenForo_Permission::hasPermission($viewingUser['permissions'], 'xengallery', 'approveUnapproveMedia');
    Also checked File Health Check. All files is OK
  4. Chris D

    Chris D XenForo Developer Staff Member

    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.
  5. Nobita.Kun

    Nobita.Kun Well-Known Member

    I think Its happen while I upgrade addon and I try to view that link. :)

Share This Page