devgeniem / wp-sanitize-accented-uploads

Replaces accents from future uploads and includes wp-cli command which you can use to sanitize current content.
MIT License
26 stars 6 forks source link

use isset for $assoc_args['verbose'] #2

Closed rhurling closed 8 years ago

rhurling commented 8 years ago

This change prevents a LOT of PHP Notices when not using the --verbose flag

There is another PHP Notice Notice: Undefined variable: ascii_file in [...]/wp-content/plugins/wp-sanitize-accented-uploads/wp-cli-integration.php on line 160 But I'm not sure which variable it's supposed to use. I think it might be $ascii_full_path, but I'm not sure whether thats correct.

onnimonni commented 8 years ago

Thanks, I guess the the output is horribly verbose eitherway! Which php version did you use? I guess I had warnings turned off because I didn't see them.

rhurling commented 8 years ago

I'm using PHP 5.5.9. The second Notice (missing $ascii_file variable) will break the conversion in some places, which is (arguably) more important. Any idea for that one?

rhurling commented 8 years ago

See: https://github.com/devgeniem/wp-sanitize-accented-uploads/blob/master/wp-cli-integration.php#L199 If there's no variable the value will be set to an empty string or NULL, which may or may not break something (not sure how those 2 meta keys are handled/used in WordPress)

onnimonni commented 8 years ago

I guess i had changed this accidentally will look into this, thanks for reporting!

onnimonni commented 8 years ago

I think this one fixes the problem: 74791a8aa75ca670b9f1e499f4a4c61a674fd80e

onnimonni commented 8 years ago

Thanks for reporting about this!

rhurling commented 8 years ago

I'm not sure whether that fixes it, because on my site the meta_value for _wp_attachment_metadata includes the year/date bit (2016/03/Arbeitunfähigkeitsbescheinigung.jpg). So only the filename wouldn't work when using date based upload sorting.

onnimonni commented 8 years ago

We can continue this over here: https://github.com/devgeniem/wp-sanitize-accented-uploads/issues/3