Support » Fixing WordPress » Call to a member function getDocNamespaces() on bool

  • I’ve got a plugin that downloads an XML file and saves it to the WP Uploads folder. The plugin runs just fine when triggered manually, but it throws an error into the log when run via wp_cron. I’m getting this error:

    PHP Fatal error: Uncaught Error: Call to a member function getDocNamespaces() on bool

    The line it’s throwing the error about is the last line of this block:

           $buffer = file_get_contents($url);
            $buffer = str_replace(array("\n", "\r", "\t"), '', $buffer);
            $xml = simplexml_load_string($buffer, null, LIBXML_NOCDATA);
            $namespaces = $xml->getDocNamespaces(true);
    

    Any idea why I’d get an error via the scheduled run but not via a manual run? I’m not sure how to troubleshoot since I can’t reproduce the error manually.

Viewing 4 replies - 1 through 4 (of 4 total)
  • Ask in the plugin’s support forum.

    Thread Starter arothmanmusic

    (@arothmanmusic)

    I’m the plugin author. 🙂 I just don’t know enough about wp_cron and such to figure out why I’m getting this issue.

    Ah, I see.
    Perhaps the loading of dependencies is different when invoked from wp_cron.
    I would turn on DEBUG and put some calls to error_log (that write to a file) in to see that what you need is there.

    Thread Starter arothmanmusic

    (@arothmanmusic)

    Yeah, I’ll have to see if I can figure that out. It’s a client getting the error, so I’ll have to start by seeing if I can set up a cron setup on my own server.

Viewing 4 replies - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.