WordPress / wordpress-importer

The WordPress Importer
https://wordpress.org/plugins/wordpress-importer/
GNU General Public License v2.0
80 stars 81 forks source link

Update plugin to call `wp_slash` on wp5.5+ and `wp_slash_strings_only` on older versions #83

Open garretthyder opened 4 years ago

garretthyder commented 4 years ago

Coming from core#50635 "the plugin could probably be updated to call wp_slash() on WP 5.5+, and wp_slash_strings_only() on older versions."

Relevant thread;

Should references of wp_slash_strings_only be removed from the WordPress Importer phpunit data? When you install from svn the wordpress-importer dir is installed to the tests/phpunit/data/plugins and the wordpress-importer/class-wp-import.php contains references to wp_slash_strings_only, as well there's a pluggable wp_slash_strings_only function in the wordpress-importer/compat.php. Good catch, thanks! I think the plugin can be left as is for now, as it aims to be compatible with WP 3.7+, and the fix for wp_slash() to handle non-string values is only available since WP 5.5. That said, the plugin could probably be updated to call wp_slash() on WP 5.5+, and wp_slash_strings_only() on older versions.

Opening this ticket to look into addressing the deprecation.

Ayesh commented 4 years ago

If WP core were to ever remove this function, the compat should still kick in. As of now, the @deprecated attribute is solely for the human and documentation tool purposes, so it shouldn't trigger any warnings or errors from the PHP engine.

I think a sensible approach would be to call wp_slash within the compat wp_slash_strings_only function if the site is running WP >= 5.5. Given the relatively simpleness of the compat, I'd say that it's OK to leave the compat function declaration as-is as well.