2012-01-04 13 views
10

Ho spostato un'applicazione da un server Ubuntu 11.04 (Natty Narwhal) a un server Red Hat Enterprise Linux (RHEL) durante il fine settimana. Il mio registro errori è pieno di errori PHP nella riga dell'oggetto fanno riferimento alla seguente funzione:T_PAAMAYIM_NEKUDOTAYIM inatteso, in attesa di T_NS_Separator

function wfTalkHereArticleFromTitle(&$title, &$article) { 
    global $wgRequest, $wgTalkHereNamespaces; 

    if (isset($title->noTalkHere)) 
     return true; //Stop recursion 

    $action = $wgRequest->getVal('action' ); 
    $oldid  = $wgRequest->getVal('oldid' ); 
    $diff  = $wgRequest->getVal('diff'  ); 

    if ($action == 'purge') 
     $action = NULL; //"purge" is not considered an action in this context 

    if ($action || $oldid || $diff) 
     return true; 

    $ns = $title->getNamespace(); 

    if (!Namespace::isTalk($ns) && Namespace::canTalk($ns) && $title->exists() 
     && (!$wgTalkHereNamespaces || in_array($ns, $wgTalkHereNamespaces))) { 

     $tns = Namespace::getTalk($ns); 
     $talk = Title::makeTitle($tns, $title->getDBKey()); 

     if ($talk && $talk->userCan('read')) { 
      $t = clone $title; 
      $t->noTalkHere = true; //Stop recursion 

      $a = MediaWiki::articleFromTitle($t); 
      $article = new TalkHereArticle($a, $talk); 
     } 
    } 
    return true; 
} 

L'errore è gettato nella dichiarazione

If (!Namespace::isTalk($ns) 

. Questo errore è nuovo per me. Come potrei risolverlo?

ho cambiato il codice incriminato per:

if (!Ns::isTalk($ns) && Ns::canTalk($ns) && $title->exists() 
    && (!$wgTalkHereNamespaces || in_array($ns, $wgTalkHereNamespaces))) { 

    $tns = Ns::getTalk($ns); 
    $talk = Title::makeTitle($tns, $title->getDBKey()); 

    if ($talk && $talk->userCan('read')) { 
     $t = clone $title; 
     $t->noTalkHere = true; //Stop recursion 

     $a = MediaWiki::articleFromTitle($t); 
     $article = new TalkHereArticle($a, $talk); 
    } 
} 
return true; 

Vorrei che sufficiente per correggere l'errore, almeno in questo file?

+1

@Charles hehe l'errore non sia stato digitato correttamente :-P – Neal

+1

Tra l'altro, l'errore è in realtà scritto "PAAMAYIM NEKUDOTAYIM" (utile per quando su Google). Come Neal menziona, "PAAMAYIM NEKUDOTAYIM" è in ebraico per doppio colon (gli autori originali di PHP erano israeliani). –

+1

Pfft, sono un tag facist, non un nazionalista. – Charles

risposta

23

Sembra che il nuovo server stia eseguendo PHP 5.3, mentre quello precedente stava eseguendo una versione precedente.

In PHP 5.3, namespace è una parola chiave, grazie allo new namespace feature.

La classe esistente Namespace deve essere rinominata. L'errore di analisi si verifica quando il codice tenta di risolvere Namespace::isTalk() in un nome di spazio dei nomi. (La sintassi per farlo sarebbe qualcosa di simile a namespace Foo, diventa confuso nel vedere l'operatore :: risoluzione.)

+1

Buona una '+ 42'^_ ^ – Neal