Giter VIP home page Giter VIP logo

Comments (14)

YahnisElsts avatar YahnisElsts commented on September 24, 2024

Try downloading the update manually and see what error message (if any) you get.

While the download URL can be truncated in the plugin update log, you can get it another way:

  1. Install Debug Bar.
  2. Click the "Debug" link in the admin bar and open the "PUC (your-plugin-slug)" panel.
  3. You should see a bunch of debugging information about the update checker. Just scroll down to the "Download Url" field.

from wp-update-server.

wpcdn avatar wpcdn commented on September 24, 2024

Hi,

Thanks for the reply. When I download the update manually, the file does download without error.

I am installing the debug components and will let you know those results as soon as I have them. Thanks!

Mark

from wp-update-server.

wpcdn avatar wpcdn commented on September 24, 2024

The "Download URL" in the debug information only shows up as:

http://plugins.mydomain.com/updates/?

(My domain redacted.)

Note: I am using WordPress 3.6 in case it's relevant.

from wp-update-server.

YahnisElsts avatar YahnisElsts commented on September 24, 2024

That URL is definitely wrong. There should be at least two parameters after the question mark.

Some ideas:

  • Find the "download_url" key in the update JSON. Does it contain the same incorrect URL, or something else?
  • The download URL is generated by the Wpup_UpdateServer::generateDownloadUrl() method in wp-update-server/includes/Wpup/UpdateServer.php. Try adding some diagnostic output to see where it goes wrong, or step through it with a debugger.
  • Check your PHP error log for messages relating to this library.

from wp-update-server.

wpcdn avatar wpcdn commented on September 24, 2024

Thanks.

The "download_url" key in the JSON is the same incorrect URL:

"download_url":"http://plugins.mydomain.com/updates/?"

There are no PHP error logs at all.

I'll take a look at the code you mentioned which generates the download URL, and add anything else I find.

Thanks!

Mark

from wp-update-server.

wpcdn avatar wpcdn commented on September 24, 2024

Strange, I can't find any reason that the entire URL isn't generated. However I probably don't know a fraction of what you do about how to diagnose and debug it, sorry. :-(

from wp-update-server.

wpcdn avatar wpcdn commented on September 24, 2024

Sorry, I'm not sure what else to do in terms of diagnosing and debugging. Could this be an issue caused by something new in WP 3.6?

from wp-update-server.

YahnisElsts avatar YahnisElsts commented on September 24, 2024

Probably not 3.6-related, no. I have a commercial plugin that relies on this library, and it runs fine on my WP 3.6 site.

Did you try adding some debug output to the function I mentioned? Even something as simple as this could help:

protected function generateDownloadUrl(Wpup_Package $package) {
    $query = array(
        'action' => 'download',
        'slug' => $package->slug,
    );
    $result = self::addQueryArg($query, $this->serverUrl);
    var_dump($query, $this->serverUrl, $result);
    return $result;
}

This modified version will dump the values of the three main variables involved in download URL generation into the JSON output. You can then view the metadata URL in the browser and see if the values make sense. If it turns out that, for example, the $query array has the correct values for your plugin but addQueryArg() fails to properly append them to $this->serverUrl, the bug probably lies somewhere in addQueryArg() and that's the function we should investigate next.

from wp-update-server.

wpcdn avatar wpcdn commented on September 24, 2024

Hi,

Okay, I've found something relevant. We're running PHP 5.4 on this server. Just to see if it was an issue with that version, I reverted to PHP 5.3. And the problem went away. (Well, I didn't test completely but the JSON data shows the proper URL in PHP 5.3.

So I'd assume that all your code is fine but there is some function or other element that is incompatible with PHP 5.4. I'm wondering what would be necessary to make it work in 5.4, as we'll need to keep current on PHP versions.

I hope this helps!

Thanks,

Mark

from wp-update-server.

wpcdn avatar wpcdn commented on September 24, 2024

I also tested in PHP 5.5, and it seems to work there. So, to recap:

  • 5.3 works
  • 5.4 does not work
  • 5.5 works

In each case the PHP configurations are identical in terms of modules (except for any that aren't supported in the particular version).

Again, hope this helps.

from wp-update-server.

YahnisElsts avatar YahnisElsts commented on September 24, 2024

Interesting. Which minor version of PHP 5.4 are you using? I just tested it in PHP 5.4.3 and it output the correct download URL. This was when running the update server as a stand-alone script, not a WP plugin. The only issue I noticed was a bunch of unrelated E_STRICT warnings.

There doesn't seem to be any code that would be obviously incompatible with PHP 5.4, but it's possible that one of the functions or syntax features that it uses has a subtly different behaviour in your PHP version and that is what trips it up. I would still recommend adding some debugging code to the relevant method(s). Also, in case the problem is somehow related to closures, try commenting out these lines in UpdateServer.php:

//Remove null/false arguments.
$query = array_filter($query, function($value) {
    return ($value !== null) && ($value !== false);
});

from wp-update-server.

wpcdn avatar wpcdn commented on September 24, 2024

It is 5.4.19.

We can use PHP 5.5 as a workaround, however I'll follow your debugging suggestions and continue working on this in case we can help someone else using 5.4. I'll post any relevant results ASAP.

from wp-update-server.

wpcdn avatar wpcdn commented on September 24, 2024

The problem seems to be solved by commenting out the lines you suggested:

//Remove null/false arguments.
$query = array_filter($query, function($value) {
    return ($value !== null) && ($value !== false);
});

from wp-update-server.

YahnisElsts avatar YahnisElsts commented on September 24, 2024

Hmm, are you completely sure it is PHP 5.4.19 and not something older? The only reason I can think of that would cause those lines to fail is if the PHP version used did not support closures. Closures were introduced in PHP 5.3.

By the way, I just tested it with PHP 5.4.19 (on Windows) and still could not reproduce the problem.

from wp-update-server.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.