• This is minor, but I noticed that WP_REDIS_MAXTTL allows setting of non-integer values. In the example below, I set it to a constant that is not yet defined and it rolled with it. This is probably purely cosmetic in WP Admin, since I see $max = (int) WP_REDIS_MAXTTL in object-cache.php, but you may wish to change return defined( 'WP_REDIS_MAXTTL' ) ? WP_REDIS_MAXTTL : null; to return defined( 'WP_REDIS_MAXTTL' ) ? intval( WP_REDIS_MAXTTL ) : null; or similar…

    Redis Object Cache admin page

    (also yes, I realize that this site is using an ancient version of PhpRedis – PHP 5.6, sadly, and I have no control over it)

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Till Krüss

    (@tillkruess)

    Hi Daniel, the content you’re using is probably not defined that early in your wp-config.php file.

    Can you post your diagnostics to confirm?

    Thread Starter Daniel Hendricks

    (@hendridm)

    the content you’re using is probably not defined that early in your wp-config.php file.

    Agree and I understand that – “I set it to a constant that is not yet defined.”

    It was quite easy to change it to an integer, of course – the constant is unimportant and the issue was obvious (to me, but I’m a developer). My point was that the admin page could possible display an invalid value differently. It makes it look like an invalid value is, indeed, acceptable and is being used by the plugin/drop-in. If you intval() the displayed value, it would show a zero if it is non-integer, which might make a little more sense to the user as it would trigger a, “Hmm, I set it to X but it is showing zero,” and this might encourage them to look into it/dig further.

    Alternatively, you could display a “Invalid value defined” value or something, but I figured that simply adding the intval() to the displayed value was easier and didn’t require translation.

    This is non-critical, obviously – I was just sharing a possible idea for giving feedback to users when an invalid value for WP_REDIS_MAXTTL (or other, similar constants) has been defined.

    Thank you for your wonderful work. This plugin is a must have for any WordPress site where Redis is an option. ??

    Thread Starter Daniel Hendricks

    (@hendridm)

    Unrelated note/FYI, I tried to sponsor you on GitHub, but it is always giving me the error:

    GitHub Sponsor Error

    I tried three different payment methods that are all in good standing – two credit cards, plus PayPal ACH – and also tried updating my profile payment method as recommended here:
    https://help.github.com/en/github/setting-up-and-managing-billing-and-payments-on-github/adding-or-editing-a-payment-method

    …but I still get the error. I am 100% confident that it is a GitHub issue and I created a support ticket for it there, but I thought that I would let you know in case you also wanted to contact them. You might be missing out on donations.

    For reference, GitHub ticket ID: 642491

    • This reply was modified 4 years, 7 months ago by Daniel Hendricks. Reason: Added GitHub ticket ID
    Plugin Author Till Krüss

    (@tillkruess)

    Yeah, that seems related to your GH account. Thanks, tho!

    The constant is casted to an integer, but I’ll make sure it’s reflected in the UI, thanks for the tip!

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘[minor] WP_REDIS_MAXTTL displays non-integer values in WP Admin’ is closed to new replies.