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

\core\session\utility\cookie_helper class uses str_contains which requires PHP 8.0

XMLWordPrintable

      This issue is the exact same problem that was already patched once in MDL-81353. The class cookie_helper in the \core\session\utility namespace uses `str_contains` in Moodle 4.1 which supports PHP 7.4, as it can be seen here:

      https://github.com/moodle/moodle/blob/MOODLE_401_STABLE/lib/classes/session/utility/cookie_helper.php

      This breaks our Moodle based LTI app on launches from iPhone on LTI 1.3. The error issues the following stack trace:

      line 152 of /lib/classes/session/utility/cookie_helper.php: Error thrown
      line 79 of /lib/classes/session/utility/cookie_helper.php: call to core\session\utility\cookie_helper::cookie_response_header_contains_attribute()
      line ? of unknownfile: call to core\session\utility\cookie_helper::core\session\utility\{closure}()
      line 74 of /lib/classes/session/utility/cookie_helper.php: call to array_map()
      line 49 of /lib/classes/session/utility/cookie_helper.php: call to core\session\utility\cookie_helper::cookie_response_headers_add_attributes()
      line 38 of /lib/lti1p3/src/ImsStorage/ImsCookie.php: call to core\session\utility\cookie_helper::add_attributes_to_cookie_response_header()
      line 71 of /lib/lti1p3/src/LtiOidcLogin.php: call to Packback\Lti1p3\ImsStorage\ImsCookie->setCookie()
      line 82 of /enrol/quizzeslti/classes/lti1p3/tool1p3.php: call to Packback\Lti1p3\LtiOidcLogin->doOidcLoginRedirect()
      line 31 of /enrol/quizzeslti/login.php: call to enrol_quizzeslti\lti1p3\tool1p3->onLogin() 

      The problem is that MDL-81405 moved the cookie_helper code and must have backported to 4.1 instead of moving the existing 4.1 code, meaning we lost the fix.

            poltorrentisoler Pol Torrent i Soler
            poltorrentisoler Pol Torrent i Soler
            Jake Dallimore Jake Dallimore
            Sara Arjona (@sarjona) Sara Arjona (@sarjona)
            CiBoT CiBoT
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved:

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 10 minutes
                10m

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