Support » Plugin: Simple URLs » Receiving a PHP Warning

  • Our site is throwing this warning.

    PHP Warning: A non-numeric value encountered in /home/benefacto/public_html/wp-content/plugins/simple-urls/plugin.php on line 203

    Which is related to this line:

    update_post_meta( $wp_query->post->ID, ‘_surl_count’, $count + 1 );

    I think this is because $count is probably a string, not an integer.

    Please fix.

Viewing 12 replies - 1 through 12 (of 12 total)
  • Plugin Support Andrea Rennick

    (@andrea_r)

    Customer Care at Copyblogger Media and Studiopress

    Thanks, we’ll pass this on to the devs.

    Ta

    Plugin Support Nick Cernis

    (@modernnerd)

    I’ve filed an issue and pull request for this:

    https://github.com/copyblogger/simple-urls/issues/10
    https://github.com/copyblogger/simple-urls/pull/11

    I don’t have a timeline for any plugin updates, but if you’d like to test a version with the fix it’s available here.

    Thank you again for the report, linzD.

    chrispking

    (@chrispking)

    Hi

    I was getting the same intermittent error outlined by linzD.

    I’ve uploaded the version provided by Nick. When I activated it, I got a Fatal Error warning. I proceeded to go into Settings > Permalinks and save. It seems to be working.

    Do you know when you’ll push a new tested version of the plug-in?

    Thanks in advance.

    Plugin Support Nick Cernis

    (@modernnerd)

    Hi, @chrispking. I don’t have a release date for this yet. Thank you for testing and confirming the fix worked, though!

    Hi @modernnerd & @andrea_r

    I’m getting the php warnings again while using the version 0.9.7 which I downloaded from above. It’s happened twice in the space of a few hours while I’ve been working on one of my sites. Both times I’ve gone into Settings > Permalinks and saved.

    Using Simple URLs on three sites built with Studiopress. No doubt losing revenue now.

    Is there a proper fix coming soon? Or should I find an alternative? Will it be supported going forward with the change of Studiopress ownership?

    I’m using WordPress 4.9.7. Full text of the warning message:

    Warning: A non-numeric value encountered in /home/[mysite]/public_html/wp-content/plugins/simple-urls/plugin.php on line 203

    Warning: Cannot modify header information – headers already sent by (output started at /home/[my site]/public_html/wp-content/plugins/simple-urls/plugin.php:203) in /home/[mysite]/public_html/wp-content/plugins/simple-urls/pluggable.php on line 1219

    Thanks

    Plugin Support Nick Cernis

    (@modernnerd)

    Hi, @chrispking.

    Sorry that you’re still encountering this. Please could you confirm that line 202 of simple-urls/plugin.php looks like this?

    $count = isset( $wp_query->post->_surl_count ) ? (int) $wp_query->post->_surl_count : 0;

    You should no longer see the above error if that line from the fix is in place.

    You’ll continue to see new themes and plugins from StudioPress, and existing themes and plugins will be supported and updated. I don’t have a timeline for the Simple URLs update just yet.

    Hi Nick

    Thanks for your quick response, much appreciated.

    To answer your question. Yes and No!

    I have two versions of Simple URLs appearing:

    1. Editing simple-urls-fix-non-numeric-warning/plugin.php (inactive)
    Select plugin to edit:

    $count = isset( $wp_query->post->_surl_count ) ? (int) $wp_query->post->_surl_count : 0;

    2. Editing simple-urls/plugin.php (active)

    $count = isset( $wp_query->post->ID ) ? get_post_meta( $wp_query->post->ID, ‘_surl_count’, true ) : 0;

    I assume the patched version did not overwrite the previous version and it’s inactive.

    Help! What should I do?

    Thanks!

    Chris

    To clarify, I have two versions appearing in the Plug-Ins > Editor (drop down).

    But only one version in the standard back-end of WP which is showing 0.9.7.

    Thanks

    Plugin Support Nick Cernis

    (@modernnerd)

    Thanks for your research, @chrispking!

    The active version is missing the patch, just as you suggested.

    You could:

    1. Take a full site backup.
    2. Deactivate the plugin.
    3. Delete the wp-content/plugins/simple-urls folder using an FTP application or your web host’s file manager.
    4. With FTP, rename the folder at wp-content/plugins/simple-urls-fix-non-numeric-warning to simple-urls.
    5. Reactivate the plugin.

    That will make the folder containing the fix the active version.

    Hi @modernnerd

    Thanks.

    Have you received many other reports from publishers experiencing similar issues?

    I’ve recently moved hosts to SiteGround and my folder structure looks similar to the one outlined by linzD. Would hosting configuration cause something like this to occur?

    If I can do the above quickly (I’m not technical) I’ll do that, otherwise I’ll look for an alternative.

    Thanks for your help.

    Chris

    Plugin Support Nick Cernis

    (@modernnerd)

    We’ve not seen many reports of this so far, but it can occur on sites running PHP 7.1 or higher for links with a visit count of 0.

    If your host updated to PHP 7.1+, that would explain why the error’s appearing now when it was not present before.

    SiteGround offers a file manager in their control panel if you did not want to use FTP to delete/rename the plugin folders: https://www.siteground.com/tutorials/cpanel/file-manager/

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