• Resolved Brandon Yap

    (@byap00)


    I’m seeing an error thrown when using the plugin with ACLs. Really hoping it’s not just me. I can’t click on the Diagnostics tab to get more detailed info but here’s what WordPress spits out in Debug mode:

    PHP Fatal error:  Uncaught TypeError: strlen(): Argument #1 ($string) must be of type string, array given in /<docroot>/wp-content/plugins/redis-cache/dependencies/predis/predis/src/Connection/Factory.php:167

    I’ve replaced part of the path with <docroot> but that shouldn’t matter.

    In wp-config.php, the line that seems to kill it is the WP_REDIS_PASSWORD setting.

    define(‘WP_REDIS_PASSWORD’, [‘myusername’, ‘mypassword’]);

    If I remove that line all is good.

    The plugin has worked fine for many months until I upgraded it to the latest version. Apologies but I don’t remember the previous version.

    Hoping this is just an ACL related bug that was introduced in the latest version?

    • This topic was modified 1 year, 6 months ago by Brandon Yap.
    • This topic was modified 1 year, 6 months ago by Brandon Yap.
Viewing 15 replies - 1 through 15 (of 20 total)
  • Plugin Author Till Krüss

    (@tillkruess)

    Hey!

    Do you mean Redis ACL?

    If you remove WP_REDIS_PASSWORD does do you see a connection under Settings > Redis?

    Thread Starter Brandon Yap

    (@byap00)

    Yes Redis ACLs is what i’m referring to.

    When I remove WP_REDIS_PASSWORD, the Settings page throws the error “NOAUTH Authentication required” as expected. Which to me means it can talk to the redis server, but not authenticate. The Metrics and Diagnostics tabs also become clickable.

    By the way a detail I forgot to include yesterday is that I can use redis-cli no problem. The server is up, and the ACL itself works. I can AUTH as the user being used and write keys without problem. So no matter what user I use, the plugin does the same thing, even with the “default” user (i’m using Redis 7).

    • This reply was modified 1 year, 6 months ago by Brandon Yap.
    • This reply was modified 1 year, 6 months ago by Brandon Yap.
    Plugin Author Till Krüss

    (@tillkruess)

    Can you post your full diagnostics from the settings screen?

    Thread Starter Brandon Yap

    (@byap00)

    Sure thing.

    Status: Not enabled
    Client:
    Drop-in: Not installed
    Disabled: No
    PhpRedis: 5.3.7
    Relay: Not loaded
    Predis: 2.1.2
    Credis: Not loaded
    PHP Version: 8.2.5
    Plugin Version: 2.4.1
    Redis Version: Unknown
    Multisite: No
    Metrics: Disabled
    Metrics recorded: 0
    Filesystem: Working
    WP_REDIS_PLUGIN_PATH: “/<docroot>/wp-content/plugins/redis-cache”
    Drop-ins: [
    “advanced-cache.php v by “,
    “maintenance.php v by “
    ]

    Again <docroot> replaces the actual path.

    Plugin Author Till Krüss

    (@tillkruess)

    What error does Settings > Redis show?

    Thread Starter Brandon Yap

    (@byap00)

    Status: Not enabled
    Filesystem: Writable
    Redis: Unreachable

    And the full error above is as follows:

    Redis is unreachable: SELECT failed: NOAUTH Authentication required. [tcp://127.0.0.1:6379]

    • This reply was modified 1 year, 6 months ago by Brandon Yap.
    Plugin Author Till Krüss

    (@tillkruess)

    What happens when you add WP_REDIS_PASSWORD with the correct configuration?

    Thread Starter Brandon Yap

    (@byap00)

    The settings screen then displays this error:

    There has been a critical error on this website. Please check your site admin email inbox for instructions.

    And the PHP error I quoted in my initial post is outputted by WordPress in Debug mode. The Metrics and Diagnostics tab also become unclickable so I can’t get Diagnostics while in that state. That error is also in the mail that comes through.

    And this is the error in the mail:

    Error Details
    =============
    An error of type E_ERROR was caused in line 167 of the file /<docroot>/wp-content/plugins/redis-cache/dependencies/predis/predis/src/Connection/Factory.php. Error message: Uncaught TypeError: strlen(): Argument #1 ($string) must be of type string, array given in /<docroot>/wp-content/plugins/redis-cache/dependencies/predis/predis/src/Connection/Factory.php:167
    Stack trace:
    #0 /<docroot>/wp-content/plugins/redis-cache/dependencies/predis/predis/src/Connection/Factory.php(167): strlen()
    #1 /<docroot>/wp-content/plugins/redis-cache/dependencies/predis/predis/src/Connection/Factory.php(100): Predis\Connection\Factory->prepareConnection()
    #2 /<docroot>/wp-content/plugins/redis-cache/dependencies/predis/predis/src/Client.php(127): Predis\Connection\Factory->create()
    #3 /<docroot>/wp-content/plugins/redis-cache/dependencies/predis/predis/src/Client.php(68): Predis\Client::createConnection()
    #4 /<docroot>/wp-content/plugins/redis-cache/includes/class-predis.php(119): Predis\Client->__construct()
    #5 /<docroot>/wp-content/plugins/redis-cache/includes/class-plugin.php(592): Rhubarb\RedisCache\Predis->connect()
    #6 /<docroot>/wp-content/plugins/redis-cache/includes/ui/tabs/overview.php(16): Rhubarb\RedisCache\Plugin->check_redis_connection()
    #7 /<docroot>/wp-content/plugins/redis-cache/includes/ui/class-tab.php(167): include('...')
    #8 /<docroot>/wp-content/plugins/redis-cache/includes/ui/settings.php(59): Rhubarb\RedisCache\UI\Tab->display()
    #9 /<docroot>/wp-content/plugins/redis-cache/includes/class-plugin.php(202): require_once('...')
    #10 /<docroot>/wp-includes/class-wp-hook.php(308): Rhubarb\RedisCache\Plugin->show_admin_page()
    #11 /<docroot>/wp-includes/class-wp-hook.php(332): WP_Hook->apply_filters()
    #12 /<docroot>/wp-includes/plugin.php(517): WP_Hook->do_action()
    #13 /<docroot>/wp-admin/admin.php(259): do_action()
    #14 /<docroot>/wp-admin/options-general.php(10): require_once('...')
    #15 {main}
     thrown
    • This reply was modified 1 year, 6 months ago by Brandon Yap.
    • This reply was modified 1 year, 6 months ago by Brandon Yap.
    • This reply was modified 1 year, 6 months ago by Brandon Yap.
    Plugin Author Till Krüss

    (@tillkruess)

    Can you post the exact configuration you’re using to trigger:

    There has been a critical error on this website. Please check your site admin email inbox for instructions.

    Thread Starter Brandon Yap

    (@byap00)

    It’s just the two line configuration below:

    define('WP_REDIS_PREFIX', 'www.<domainname>:');
    define('WP_REDIS_PASSWORD', ['<username>', '<password>']);

    Bits in <> replaced with the actual values. The config is at the top of wp-config.php above everything else.

    • This reply was modified 1 year, 6 months ago by Brandon Yap.
    Plugin Author Till Krüss

    (@tillkruess)

    Is Redis running at 127.0.0.1 on port 6379 for sure?

    How are you connecting via redis-cli, I’ll try to replicate this locally.

    Thread Starter Brandon Yap

    (@byap00)

    Yep it’s 100% listening to localhost. Here’s proof:

    redis-cli -h 127.0.0.1
    127.0.0.1:6379> AUTH <user> <password>
    OK
    127.0.0.1:6379> SET www.<domainname>:test testvalue
    OK
    127.0.0.1:6379> GET www.<domainname>:test
    "testvalue"
    Plugin Author Till Krüss

    (@tillkruess)

    Did you try adding WP_REDIS_HOST/PORT explicitly as well as WP_REDIS_PASSWORD to the very top of your wp-config.php file?

    Thread Starter Brandon Yap

    (@byap00)

    Same thing happens.

    define( 'WP_REDIS_HOST', '127.0.0.1' );
    define( 'WP_REDIS_PORT', 6379 );
    define( 'WP_REDIS_PREFIX', 'www.<domainname>:' );

    With those three lines in there the plugin seems happy, with the exception of needing authentication. But as soon as I add WP_REDIS_PASSWORD, the critical error shows up.

    • This reply was modified 1 year, 6 months ago by Brandon Yap.
    Thread Starter Brandon Yap

    (@byap00)

    Do ACLs work for you? If it does then it’s got to be something in my setup, which I don’t expect you to fix of course.

Viewing 15 replies - 1 through 15 (of 20 total)
  • The topic ‘Error thrown when ACLs are used’ is closed to new replies.