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

Fixed cannot save in admin options

Discussion in 'Resolved Bug Reports' started by jgas, Oct 19, 2011.

  1. jgas

    jgas Active Member

    Ho. I have no mods installed.
    When i try to save on performance options i get this error and the options are not saved :

    What can i do? Thanks
    Invalid argument supplied for foreach()
    * *XenForo_Application::handlePhpError()* in *XenForo/Template/FileHandler.php* at line *119*
    * *XenForo_Template_FileHandler->_deleteTemplate()* in *XenForo/Template/FileHandler.php* at line *67*
    * *XenForo_Template_FileHandler::delete()* in *XenForo/Model/Template.php* at line *1424*
    * *XenForo_Model_Template->deleteTemplateFiles()* in *XenForo/Option/TemplateFiles.php* at line *27*
    * *XenForo_Option_TemplateFiles::verifyOption()*
    * *call_user_func_array()* in *XenForo/DataWriter/Option.php* at line *345*
    * *XenForo_DataWriter_Option->_validateOptionValuePreSave()* in *XenForo/DataWriter/Option.php* at line *211*
    * *XenForo_DataWriter_Option->_preSave()* in *XenForo/DataWriter.php* at line *1414*
    * *XenForo_DataWriter->preSave()* in *XenForo/DataWriter.php* at line *1354*
    * *XenForo_DataWriter->save()* in *XenForo/Model/Option.php* at line *568*
    * *XenForo_Model_Option->updateOptions()* in *XenForo/ControllerAdmin/Option.php* at line *174*
    * *XenForo_ControllerAdmin_Option->actionSave()* in *XenForo/FrontController.php* at line *310*
    * *XenForo_FrontController->dispatch()* in *XenForo/FrontController.php* at line *132*
    * *XenForo_FrontController->run()* in */var/www/vhosts/musicadigitale.net/httpdocs/xenforo/admin.php* at line *13*
     
  2. Robbo

    Robbo Well-Known Member

    A temp fix (not one that fixes the underlying problem, that's what Kier and Mike are for) would be to replace this...

    Line 119.
    PHP:
    foreach (glob($wildcard) AS $file)
    {
        @
    unlink($file);
    }
    With this
    PHP:
    if (($files glob($wildcard) !== false))
    {
        foreach (
    $files AS $file)
        {
            @
    unlink($file);
        }
    }
     
    Veer and jgas like this.
  3. Kier

    Kier XenForo Developer Staff Member

    This is what I've put in:
    PHP:
    foreach ($languageId AS $_languageId)
    {
        
    $files glob($this->_getFileName($_title$_styleId$_languageId));

        if (
    is_array($files))
        {
            foreach (
    $files AS $file)
            {
                @
    unlink($file);
            }
        }
    }
     
    Veer, Marcus, jgas and 2 others like this.
  4. Marcus

    Marcus Well-Known Member

    I put this in library/XenForo/Template/FileHandler.php instead of
    Code:
    foreach (glob($wildcard) AS $file)
    {
        @unlink($file);
    }
    ... and it works.
     
    jgas likes this.

Share This Page