WordPress.org

Ready to get started?Download WordPress

Forums

podPress
[resolved] Warning: uasort() (14 posts)

  1. sensifreak
    Member
    Posted 3 years ago #

    On this page: wp-admin/admin.php?page=podpress/podpress_stats.php
    the following error occures.
    Warning: uasort() [function.uasort]: Invalid comparison function. in /kunden/159634_15831/wp-content/plugins/podpress/podpress_admin_stats_class.php on line 674

    I upgraded from an older podpress version (8.8)

  2. ntm
    Member
    Plugin Author

    Posted 3 years ago #

    Thanks for the report!

    This is maybe an issue which is related to the PHP version. I have not had this problem before. But the error message and the problem is clear.

    If one uses for uasort() a member function of an object and uasort is also in this object, it possible to use different syntaxes to call the callback function.
    So far it was this:
    uasort($stats, array(self, 'sort_downloads_per_media_desc'));

    But this works for me too:
    uasort($stats, array('podPressAdmin_class', 'sort_downloads_per_media_desc'));
    and seems to be right. The uasort() call is in a function which part of the class podPressAdmin_class which extends podPress_class.

    The modification is in the current Development Version and I would appreciate it if you would test this version and tell me whether the changes are helpful. If the problem still occurs, I will modify this again. (There are two further possibilities.)

    Regards,
    Tim

  3. sensifreak
    Member
    Posted 3 years ago #

    The Problem still occures.
    I uploaded the latest Dev version. Another effect ist that the /podcast/ feed is broken
    FEHLER: podcast ist kein g├╝ltiges Feed-Template
    Means: ERROR: podcast isnt a valid feed template
    So i reuploaded the older version

  4. ntm
    Member
    Plugin Author

    Posted 3 years ago #

    I have made some further changes. Please, try the current Dev. Version.

    About the missing feed template:
    One solution for this problem is to save the Permalink settings after the plugin activation.

    If this does not help, check the settings at the Feed/iTunes Settings page. Since 8.8.8 this version has a new section called podPress Feeds. This section should contain a feed with the slug name "podcast". This feed needs to be marked as active. Save always the Permalinks after you have changed the status or the slug name of one of these feeds.
    (Since 8.8.8, the settings for the main feeds of the blog and the additional feeds of podPress like "podcast" are separated.)

  5. sensifreak
    Member
    Posted 3 years ago #

    Okay dev version running...
    But i cant changed the Podpress feed url anymore.
    I had domian.tld/podcast as feed
    but there isnt a text field to change that.
    podpress makes it to domain.tld/feed/podcastname

  6. ntm
    Member
    Plugin Author

    Posted 3 years ago #

    Thanks for doing these tests!

    podPress adds the additional feeds with the WP function add_feed(). That is why these feeds like the one with the slug "podcast" are reachable via the scheme which WP uses for feeds. Usually it is "www.example.com/?feed=podcast" or with a non-default Permalink setting "www.example.com/feed/podcast".
    That is how it has worked since WP 2.1 (and at least podPress 8.8).

    If want to have a scheme like "www.example.com/podcast" for your podcast feed URL then you can do that by defining a special rewrite rule maybe in WP, maybe with another plugin or directly in the .htaccess file. But podPress does not alter the Permalink scheme and there is no such text field in podPress to make such modifications.

    If you had defined such rule manually in the .htaccess file then please control this file. Because saving the Permalink settings may have altered that file.
    If you are using a plugin to modify the URL schemes of your blog then maybe you need to refresh the settings of this plugin.

  7. sensifreak
    Member
    Posted 3 years ago #

    thank you for developing that plugin!
    But the stats uasort error still excists.
    The database is kind of large (136mb the podpress_stats) and it takes a long time to load that site . (Maby the error occures because of this?)

  8. ntm
    Member
    Plugin Author

    Posted 3 years ago #

    it takes a long time to load that site

    Do you get a table with stats in the end?

    When the error with uasort(); occurs, the db request has already ended and the result is of it is an array of data and not is not the value false.

    This uasort sorts the array which is made of the db query result. It uses a callback function for that purpose and as the error message says the function seems to be an "Invalid comparison function.". But this message means often that there is a misspelling in the name of the callback function or that this function does eventually not exists.
    But all the variations of calling this function are working in my test blogs. That is why I think that this problem is somehow related to the PHP installation on your server. But I can not rule out a problem in your data.

    I have no further ideas on how-to call this sorting function differently. But I have implemented a test which checks whether the function is available or not and if the function is not available then it simply bypasses it. This way the error will not occur any more. But the data does not get sorted by they "Total" values.

    I have added also a little debug section which should help find the cause of the error. You should see something like that:

    sort_downloads_per_media_desc is a method of $this
    bool(true)
    sort_downloads_per_media_desc is a method of "podPressAdmin_class"
    bool(true)
    $stats is an array"
    bool(true)
    there is "total" value for each media file in $stats"
    bool(true)

    Please, tell whether one of these four value is not "true" in your blog. Which one is it?

  9. sensifreak
    Member
    Posted 3 years ago #

    yes there is a table with the stats at the end.
    Do i have to upload the new dev version or manually put this code somewhere?
    and where?
    Regads Julian

  10. ntm
    Member
    Plugin Author

    Posted 3 years ago #

    Julian, please, download the dev version and upload at least the file with the name podpress_admin_stats_class.php to your blog. Afterwards open the stats page again and you will see these lines above the table.

    Tim

  11. sensifreak
    Member
    Posted 3 years ago #

    Okay, it prints

    sort_downloads_per_media_desc is a method of $this
    bool(true)
    sort_downloads_per_media_desc is a method of "podPressAdmin_class"
    bool(false)
    $stats is an array"
    bool(true)
    there is "total" value for each media file in $stats"
    bool(true)

    and the error is gone :)

    Julian

  12. ntm
    Member
    Plugin Author

    Posted 3 years ago #

    Julian, that are good news. But I have one last question: Are the media files (or the rows) sorted by the "Total" values?

  13. sensifreak
    Member
    Posted 3 years ago #

    yes sir!

  14. ntm
    Member
    Plugin Author

    Posted 3 years ago #

    That is nice.

    I'm going to remove these debug output lines in the next stable release.

    Thank you for making all these tests!

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags