Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-78004

Deprecation warning when using Redis cache store with UNIX socket in PHP 8.1 runtime environment

XMLWordPrintable

    • PostgreSQL
    • MOODLE_401_STABLE, MOODLE_402_STABLE
    • MOODLE_401_STABLE, MOODLE_402_STABLE
    •  MDL-78004_401
    • MDL-78004_master
    • Hide

      Note: This issue needs to be tested for PHP versions:

      • 7.4 (4.1 only)
      • 8.0 (all branches)
      • 8.1 (all branches)

      Initial setup

      1. Install Redis server.
      2. Open redis.conf file.
      3. Add unixsocket /var/run/redis/redis.sock to the end of the file to enable unixsocket mode.
      4. Save the file.
      5. Restart Redis server to make it run with the new config.
      6. Install PHPRedis
      7. Restart your webserver.
      8. Login as admin.
      9. Navigate to Site Administration -> Development -> Debugging.
      10. Make sure to turn on all the debugging messages.

      Testing 1

      1. Navigate to Site Administration -> Plugin -> Caching -> Cache stores -> Redis.
      2. Fill the Test server with: /var/run/redis/redis.sock
      3. Save changes.
      4. Navigate to Site Administration -> Plugin -> Caching -> Test performance
      5. Verify that the Result column of Redis row is Tested.
      6. Verify that the page will be displayed normally.
      7. For PHP 8.1: Verify that there is no warning related to Deprecated: Redis::connect(): Passing null to parameter #2 ($port).
      8. To test other PHP versions, switch PHP version and refresh the page (no need to run the entire setup each time)

      Testing 2

      1. Navigate to Site Administration -> Plugin -> Caching -> Configuration.
      2. Click Add instance on Redis row.
      3. Set the Store name to: Redis cache.
      4. Set the Server to: /var/run/redis/redis.sock
      5. Save changes.
      6. Verify that you can add the instance.
      7. For PHP 8.1: Verify that there is no warning related to Deprecated: Redis::connect(): Passing null to parameter #2 ($port).
      8. Click Edit mappings in the Stores used when no mapping is present section.
      9. Set the Application to Redis cache.
      10. Save changes.
      11. Try to navigate to other pages or any course.
      12. Verify that they will be displayed correctly.
      13. For PHP 8.1: Verify that there is no warning related to Deprecated: Redis::connect(): Passing null to parameter #2 ($port).
      14. To test other PHP versions, switch PHP version and refresh the page (no need to run the entire setup each time)

      Teardown

      1. Delete the cache store
      2. Unset the configuration you set in both tests
      Show
      Note : This issue needs to be tested for PHP versions: 7.4 (4.1 only) 8.0 (all branches) 8.1 (all branches) Initial setup Install Redis server. Open redis.conf file. Add unixsocket /var/run/redis/redis.sock to the end of the file to enable unixsocket mode. Save the file. Restart Redis server to make it run with the new config. Install PHPRedis Restart your webserver. Login as admin. Navigate to Site Administration -> Development -> Debugging. Make sure to turn on all the debugging messages. Testing 1 Navigate to Site Administration -> Plugin -> Caching -> Cache stores -> Redis. Fill the Test server with: /var/run/redis/redis.sock Save changes. Navigate to Site Administration -> Plugin -> Caching -> Test performance Verify that the Result column of Redis row is Tested . Verify that the page will be displayed normally. For PHP 8.1 : Verify that there is no warning related to Deprecated: Redis::connect(): Passing null to parameter #2 ($port). To test other PHP versions, switch PHP version and refresh the page (no need to run the entire setup each time) Testing 2 Navigate to Site Administration -> Plugin -> Caching -> Configuration. Click Add instance on Redis row. Set the Store name to: Redis cache . Set the Server to: /var/run/redis/redis.sock Save changes. Verify that you can add the instance. For PHP 8.1 : Verify that there is no warning related to Deprecated: Redis::connect(): Passing null to parameter #2 ($port). Click Edit mappings in the Stores used when no mapping is present section. Set the Application to Redis cache . Save changes. Try to navigate to other pages or any course. Verify that they will be displayed correctly. For PHP 8.1 : Verify that there is no warning related to Deprecated: Redis::connect(): Passing null to parameter #2 ($port). To test other PHP versions, switch PHP version and refresh the page (no need to run the entire setup each time) Teardown Delete the cache store Unset the configuration you set in both tests
    • 1
    • Team Hedgehog 2023 Sprint 2.1, Team Hedgehog 2023 Sprint 2.2

      In /cache/stores/redis/lib.php #208 the "new_redis" function is testing whether the connection string starts with "/".  
      In case of "/" the "$port" variable is set to "null" which is later used in $redis->connect($server, $port).
      Using "null" for the 2tn parameter in "connect" is deprecated.
      Log:
      PHP message: PHP Deprecated:  Redis::connect(): Passing null to parameter #2 ($port) of type int is deprecated
      https://www.php.net/manual/en/migration81.deprecated.php#migration81.deprecated.core.null-not-nullable-internal

            mwehr Mario Wehr
            mwehr Mario Wehr
            Huong Nguyen Huong Nguyen
            Andrew Lyons Andrew Lyons
            Glyn (Mathew) May Glyn (Mathew) May
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved:

                Estimated:
                Original Estimate - 0 minutes
                0m
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 6 hours
                6h

                  Error rendering 'clockify-timesheets-time-tracking-reports:timer-sidebar'. Please contact your Jira administrators.