2016-07-21 7 views
3

Ich arbeite an einer Website mit Word drücken und es ist mein erstes Mal, dieses Problem zu begegnen, nachdem ich meine Word Press-Version und alle Plugins und die Datenbank aktualisiert, das ist, was ich angetroffen habe.Schwerwiegender Fehler: Funktionswiedergabewert kann nicht im Schreibkontext in **** verwendet werden. Com httpdocs wp-content plugins popup-builder popup-builder.php in Zeile 335

Dies ist der Fehler

Fatal error: Can't use function return value in write context in ****.com\httpdocs\wp-content\plugins\popup-builder\popup-builder.php on line 335

Linie 335

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

Jeder weiß, wie dieses Problem beheben? – Teapetetose

Antwort

1

Sie benötigen PHP Version 5.5 oder höher zu aktualisieren.

Dies ist im Grunde ein Duplikat von Can't use method return value in write context, aber da dies nicht Ihr Code ist, werde ich es nicht als ein Betrüger markieren. Es geht nicht darum, Code zu bearbeiten, um den Fehler zu beheben. Es geht darum, die Serverumgebung so einzurichten, dass der Code problemlos ausgeführt werden kann. Die Wurzel des Problems ist, dass empty() in PHP keine echte Funktion ist. Es ist eine in die Sprache integrierte Funktion. empty() möchte eine Variable, die an sie übergeben wird, und die normalen Variablenregeln gelten nicht. Normalerweise könnten Sie das Ergebnis eines Funktionsaufrufs übergeben und PHP würde eine temporäre Variable erstellen, aber empty() kann nur echte Variablen sehen.

PHP 5.5 geändert, so dass empty() auch mit temporären Variablen funktioniert.

0

dies ist der Funktionscode

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; 
}