Easy-digital-downloads: EDD Debug Log charset inconsistencies (EDD debug log is blank)

Created on 20 Dec 2017  Â·  11Comments  Â·  Source: easydigitaldownloads/easy-digital-downloads

The problem that prompted this issue:
A customer's EDD debug log is being written to the file. However, when trying to view it in EDD, the debug log is blank.

The likely culprit:
When we are logging the IPN response from Paypal, paypal sends it using "windows-1252" as the charset. This seems to be causing it to fail the esc_textarea function because there are special characters in the paypal IPN response if a person's name has special characters.

See the special character on line 1528:
screen shot 2017-12-20 at 3 35 37 pm

A possible solution:
I spoke with @cklosowski and he mentioned a possible solution might be to convert the carset of each array item to utf-8.

type-bug

All 11 comments

Apparently this is something you can change in your PayPal settings:
https://www.paypal.com/cgi-bin/customerprofileweb?cmd=_profile-language-encoding

You can click 'More Options' and set UTF-8 as your encoding for all requests.

going to punt for now, since there is a work around @mintplugins. I want to be able to do some extensive testing on this before it goes live and I need to try and get 2.9.4 moving along.

I have a proposed PR here, we just need somewhere to replicate it and verify that the conversion works.

I've replicated and I _think_ can confirm that it's fixed. 😣

To replicate:

  1. On a test EDD site where you can test PayPal IPN, go to _Downloads -> Settings -> Misc_ and make sure Debug Mode is enabled. Then go to _Downloads -> Tools -> Debug Log_. (this will be easier to see if you clear your log and start fresh)
  2. If you adjusted your PayPal encoding settings as mentioned here, change them back to the default state. You'll know if you ever adjusted this or not. If not, continue.
  3. Visit PayPal's IPN simulator tool. Here, you'll need to set your IPN Handler URL http://testsite.co/?edd-listener=IPN, I used Cart Checkout as my Transaction Type, and down in the first_name field, adjust it from John to Johnö. Notice that extra ö character on the name... that's what we'll be tracking.
  4. Send your IPN using the simulator.
  5. Go back to your test site's Debug Log. It _should_ be empty... even if you did not clear it previously.
  6. Via FTP, navigate to the actual location of your debug log on the server /wp-content/uploads/123blah123-edd-debug.log and open it up. For the simulated payment you sent with the IPN simulator, you should see all instances of the first_name key with a value of John�.

The fact that EDD's Debug Log displays blank while the actual log has data is replicating the issue.


To test issue6243:

  1. Change you EDD test site to issue/6243.
  2. Go to _Downloads -> Tools -> Debug Log_ and click the Clear Log button. You have to clear the log because even though you switched branches, the � character is still present and I guess that's what breaks the display.
  3. Now go back to the IPN simulator and just send another simulated payment without adjusting the configuration. You should see all instances of the first_name key with a value of John?

I believe the fact that EDD's Debug Log now properly displays the log entries is what this issue set out to fix. However, I do not know if the character changing from � to ? is exactly what was desired.

If so, :+1:

Bug and fix both check out, merged!

This has triggered a fatal error on one of my local hosts:

Fatal error: Uncaught Error: Call to undefined function mb_convert_encoding() in /var/www/html/wp/wp-content/plugins/easy-digital-downloads/includes/class-edd-logging.php:528

We need to account for that safely.

Additional PR submitted.

@pippinsplugins Tested. Everything still works, as expected. :+1:

Any idea how that caused a fatal? I'm sure you're not running PHP 3 lol.

No clue. I'm running PHP 7.2 locally . . .

Usually it means you haven't installed the php_mbstring package (which is commonly installed, but not part of a default LAMP install)

mbstring being` MultiByte Strings

Was this page helpful?
0 / 5 - 0 ratings

Related issues

DrewAPicture picture DrewAPicture  Â·  5Comments

scottbuscemi picture scottbuscemi  Â·  5Comments

julien731 picture julien731  Â·  5Comments

zackkatz picture zackkatz  Â·  5Comments

JeroenSormani picture JeroenSormani  Â·  5Comments