致命错误:无法在第 335 行的 ****.com\httpdocs\wp-content\plugins\popup-builder\popup-builder.php



我正在使用wordpress在网站上工作,这是我在更新wordpress版本以及所有插件和数据库后第一次遇到这个问题,这就是我遇到的。

这是错误

致命错误:无法在写入上下文中使用函数返回值 .com\httpdocs\wp-content\plugins\popup-builder\popup-builder.php 在第 335 行

335路

if(!empty(get_option("SG_ALL_POSTS")) && is_array(get_option("SG_ALL_POSTS")) && !(is_page() || is_home()  || is_front_page())) {

您需要将 PHP 升级到 5.5 或更高版本。

这基本上是不能在写入上下文中使用方法返回值的副本,但由于这不是您的代码,因此我不会将其标记为欺骗。这不是编辑代码以修复错误的问题,而是设置服务器环境以使代码正常运行的问题。

问题的根源在于 PHP 中的 empty() 不是真正的函数。这是语言内置的功能。 empty()希望将变量传递给它,而正常的变量传递规则不适用。通常你可以传递函数调用的结果,PHP 会创建一个临时变量,但empty()只能看到真正的变量。

PHP 5.5 改变了这一点,因此empty()也可以使用临时变量。

这是函数代码

function sgOnloadPopup()
{
    $page = get_queried_object_id();
    $popup = "sg_promotional_popup";
    /* If popup is set on page load */
    $popupId = SGPopup::getPagePopupId($page, $popup);
    /* get all popups id which set in current page by class */
    $popupsIdByClass = getPopupIdInPageByClass($page);
    if(POPUP_BUILDER_PKG > POPUP_BUILDER_PKG_FREE){
        delete_option("SG_MULTIPLE_POPUP");
        /* Retrun all popups id width selected On All Pages */
        $popupsId = SgPopupPro::allowPopupInAllPages($page);
        $data = get_option("SG_ALL_POSTS");
        if(!empty($data) && is_array($data) && !(is_page() || is_home()  || is_front_page())) {
        /*if(!empty(get_option("SG_ALL_POSTS")) && is_array(get_option("SG_ALL_POSTS")) && !(is_page() || is_home()  || is_front_page())) {*/
            /* Add to popups Queue */
            $popupsId = array_merge(get_option("SG_ALL_POSTS"), $popupsId);
        }
        if(!empty(get_option("SG_ALL_PAGES")) && is_array(get_option("SG_ALL_PAGES")) && (is_page() || is_home()  || is_front_page())) {
            /* Add to popups Queue */
            $popupsId = array_merge(get_option("SG_ALL_PAGES"), $popupsId);
        }
        /* $popupsId[0] its last selected popup id */
        if(isset($popupsId[0])) {
            delete_option("SG_MULTIPLE_POPUP");
            if(count($popupsId) > 0) {
                update_option("SG_MULTIPLE_POPUP",$popupsId);
            }
            foreach ($popupsId as $queuePupupId) {
                showPopupInPage($queuePupupId);
            }
            $popupsId = json_encode($popupsId);
        }
        else {
            $popupsId = json_encode(array());
        }
        echo '<script type="text/javascript">
            SG_POPUPS_QUEUE = '.$popupsId.'</script>';
    }
    //If popup is set for all pages
    if($popupId != 0) {
        showPopupInPage($popupId);
    }
    if(!empty($popupsIdByClass)) {
        foreach ($popupsIdByClass as $popupId) {
            sgRenderPopupScript($popupId);
        }
    }
    return false;
}

相关内容

最新更新