• Resolved notgoodenough

    (@notgoodenough)


    I have a plugin I made last year that stopped updating MySQL at the beginning of this week. The problem exists when receiving webhooks from Authorize.net. Is there anything on WordPress’s end that would explain this? Like possibly a core version update that might stop some type of update queries from working?

    I ask because the webhook is just one PHP file with an update query that no longer works. The other simply runs updates on records just create to update a string column for storing URLs that had to be broken off from the original insert due to URLs containing emojis not being inserted.

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter notgoodenough

    (@notgoodenough)

    Here is some sample code. When I run it the insert works but the update always fails

    `$wpdb->query(“INSERT INTO orders (post,site,url,status,refid) VALUES (‘”.$postid.”‘, ‘”.$siteid.”‘, ‘update pending’, ‘pending’, ‘”.$refId.”‘)”);
    $newID = $wpdb->insert_id();
    $wpdb->query(“UPDATE orders SET url = ‘”.$removeurlclean.”‘ WHERE orderid = ‘”.$newID.”‘”);

    • This reply was modified 2 years, 6 months ago by notgoodenough.
    Thread Starter notgoodenough

    (@notgoodenough)

    It sees the solution to this is to using PHP’s utf8_encode() function on all strings before trying to insert them using wpdb->query.

    Simply by changing $removeurlclean to utf8_encode($removeurlclean) resulted in all inserts and updates working. The same is true with other queries that inserted strings into the database either by inserting new records or updating existing ones.

    Integers on the other hand seem unaffected. I realized that after noticing other inserts fail. In every case I simply had to use the encoding function to make them work again. This impacted a plugin I use on several sites most of which use different databases. The problem appears to have hit them all at the same time.

    I can’t help but suspect that somebody at WordPress changed something which resulted in inserts failing with no error messages as far as I can tell just because strings are not encoded a certain way.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘WordPress Appears Broken This Week’ is closed to new replies.