Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Warning Error with json_encode() #1176

Open
katmoody opened this issue May 10, 2017 · 2 comments
Open

Warning Error with json_encode() #1176

katmoody opened this issue May 10, 2017 · 2 comments
Labels

Comments

@katmoody
Copy link
Contributor

katmoody commented May 10, 2017

User in forums reported the following error:
[10-May-2017 04:20:57 UTC] PHP Warning: json_encode() [function.json-encode]: Invalid UTF-8 sequence in argument in /home/www/…./wp-content/plugins/backupwordpress/classes/class-site-size.php on line 156

Which traces back to this part of the plugin code: https://github.com/humanmade/backupwordpress/blob/master/classes/class-site-size.php#L156

It looks like the json_encode() value has to be UTF-8 encoded per the PHP manual:
http://php.net/manual/en/function.json-encode.php

And further discussed in this Stack Overflow post:
http://stackoverflow.com/questions/10205722/json-encode-invalid-utf-8-sequence-in-argument

Link to forum post: https://wordpress.org/support/topic/utf-warning-on-utf-8/#post-9117239

@katmoody katmoody added the Bug label May 10, 2017
@katmoody
Copy link
Contributor Author

It looks like one solution might be to add the UTF-8 encoding where other parts of the function are defined: https://github.com/humanmade/backupwordpress/blob/46df3a749cc8a77d3de724f0f63c44b6e5d2c5eb/classes/backup/class-backup-engine-database-imysqldump.php#L27

I think it's only happening when using the PDO option that is part of the IMySQLDump (the php version) so resolving this should solve this warning? Unless I misunderstood where the value could be added?

@roborourke
Copy link
Contributor

Not sure the mysql dump classes are related here as the offending warning comes from a line in the directory file size calculation methods.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants