Change WordPress user roles and capabilities Forums Bug Reports Import Failure: Wrong characters in the capability ID

Tagged: 

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #4551
    jpgalapon
    Participant

    I did an export from our development server and I’m trying to import the file into another test server (to test how the import will work), but I keep getting the following error message: Import failure: Wrong characters in the capability ID – sanitized version: 1

    Not sure what I’m doing wrong and I can’t find anything about this error.

    #4554
    Vladimir
    Keymaster

    Alphanumeric characters, dashes, underscores, spaces and slashes are allowed by default in user capability ID by default. This PHP regular expression is used: /[^a-zA-Z0-9_\-\s\/]/

    Look if you have capability with 1 inside but containing not allowed characters. Let me know what it is.

    I work on the export/import procedure upgrade. I will add the same filter to the export code in order do not generate this error if some existing capability does not go via this check.

    #4557
    jpgalapon
    Participant

    Hi, Vladimir. Thanks for responding. All of our capabilities contain letters, numbers, underscores, and/or dashes.

    #4558
    Vladimir
    Keymaster

    Send exported .dat file which you can not import to support [at-sign] role-editor.com
    I will test it and try to understand what is going wrong.

    #4559
    Vladimir
    Keymaster

    I got the file and isolated the issue. The error message is returned for the ‘1’ capability.
    There is a strict type checking at the URE code:

    
     if ($key!==$sanitized_key) {
    

    But $key contains an integer 1, but $sanitized_key contains string ‘1’. So check is failed and returns error.

    I see ‘1’ capability from time to time at different client sites, but still did not have information what plugin can add it. Try to revoke it from all roles to which it is granted. Then delete this capability as unused. Export roles again. This problem with import should gone away.

    Thanks for pointing me on this issue. I will enhance a code here.

    #4562
    jpgalapon
    Participant

    Hey, Vladimir. I figured out that it is the “FooEvents for WooCommerce” plugin by Grenade creating the “1” capability. After deactivating the plugin, deleting the erroneous capability, and re-exporting, everything worked fine with importing to another site. Thank you so much for all your help!

Viewing 6 posts - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.