WordPress / WordPress/wordpress-importer

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

Open
#83 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

[Type] Enhancement
Dominant language
PHP
Stars
89
Forks
96
Avg merge
1h 13m
Merged PRs (30d)
2

Description

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.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with wordpress-importer/class-wp-import.php and compat.php, then inspect the WordPress Importer PHPUnit data references mentioned in the thread. Compare the available slash functions across WordPress versions, and consider the core#50635 discussion first. Done means the importer uses the appropriate function for WordPress 5.5+ and older supported versions without the deprecated reference.

Written by the indexing model from the issue text.

Assessment

Tech stack
php, wordpress
Domain
backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.