[OOP] DOMDocument::load() should not be called statically

Einklappen
X
 
  • Filter
  • Zeit
  • Anzeigen
Alles löschen
neue Beiträge

  • [OOP] DOMDocument::load() should not be called statically

    PHP-Code:
    $this->dom DOMDocument::load($fileName);
    $this->xpath = new domxpath($this->dom); 
    Erzeugt folgenden (E_STRICT) Fehler:

    Code:
    Strict Standards: Non-static method DOMDocument::load() should not be called statically,
    assuming $this from incompatible context in [...] on line 26
    Ich habe gerade irgendwo gelesen, dass das ein Bug ist, denn im Manual steht, dass man sie statisch aufrufen darf.

    Nun habe ich mir überlegt, egal, schreibe ich das halt um.

    PHP-Code:
    $this->domDoc = new DOMDocument();
    $this->dom $this->domDoc->load($fileName);
    $this->xpath = new domxpath($this->dom); 
    Tja, pech gehabt. DOMDocument->load gibt nämlich bei nicht-statischem Aufruf nur true oder false zurück.
    Wie gebe ich XPath jetzt das DomDocument?

    Danke schonmal.
    Zuletzt geändert von DarkRoot; 08.05.2007, 08:22.

  • #2
    Sorry, hab's schon.
    Hilft aber vielleicht trotzdem jemanden weiter.
    PHP-Code:
    $this->domDoc = new DOMDocument();
    $this->dom $this->domDoc->load($fileName);
    $this->xpath = new domxpath($this->domDoc); 
    Man übergibt einfach die Instanz der ganzen Klasse an XPath, anstatt des Rückgabewerts von load.

    Kommentar


    • #3
      Re: [OOP] DOMDocument::load() should not be called statically

      Original geschrieben von DarkRoot
      Wie gebe ich XPath jetzt das DomDocument?
      Du übergibst ihm die Eigenschaft, in der du die Referenz auf dein DOMDocument abgelegt hast ...
      I don't believe in rebirth. Actually, I never did in my whole lives.

      Kommentar


      • #4
        OffTopic:
        Du kommst zu spät

        Kommentar


        • #5
          OffTopic:
          Du fragst zu früh ...
          I don't believe in rebirth. Actually, I never did in my whole lives.

          Kommentar


          • #6
            Original geschrieben von wahsaga
            OffTopic:
            Du fragst zu früh ...
            Ja, ich hatte irgendwie 'ne Denkblockade. Whatever. Nun is ja alles gelöst

            Kommentar

            Lädt...
            X