Skip to content

application-password create/update strips backslashes #698

Backlog

Description

@vortexopenclaw

Current, buggy behavior

wp user application-password create (and update) drops backslashes from the application name. The command passes its arguments to WP_Application_Passwords::create_new_application_password() / update_application_password() unslashed, but core expects slashed input there. That is documented as "Expected to be slashed" in 7.2, and before 7.2 the metadata API unslashed it anyway. The result is the same on both versions: one level of backslashes is removed.

Steps to reproduce

wp user application-password create 1 'My\App\Test' --porcelain
wp user application-password list 1 --fields=uuid,name

Expected

The name is stored as My\App\Test.

Actual: it is stored as MyAppTest, on WordPress 7.1.5 and on 7.2-RC4.

Calling core directly with slashed input keeps the backslash on both versions:

wp eval '$r = WP_Application_Passwords::create_new_application_password( 1, wp_slash( array( "name" => "Slashed\\App" ) ) ); echo WP_Application_Passwords::get_user_application_password( 1, $r[1]["uuid"] )["name"];'
# Slashed\App

Environment

  • WP-CLI 3.0.1
  • PHP 8.6.0
  • WordPress 7.1.5 and 7.2-RC4, clean installs, no plugins

Possible fix

Wrap the arguments in wp_slash() before calling core in User_Application_Password_Command::create() (around line 356) and update() (around line 400).

Activity

  1. added
    command:user-application-password-create
    command:user-application-password-update
    on Dec 2, 2026
  2. changed the title [-]user application-password create/update strips backslashes from the name[/-] [+]application-password create/update strips backslashes[/+] on Dec 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugcommand:user-application-password-createcommand:user-application-password-update

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions