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

PHP Notices detected in web server logs (mod_lti)

    XMLWordPrintable

Details

    • MOODLE_311_STABLE, MOODLE_400_STABLE
    • MOODLE_311_STABLE
    • MDL-72988-311
    • Hide

      Pre-requisities

      1. Site using PHP8.0

      Test

      1. Init and run the following Behat scenarios in your favorite environment (moodle-docker, terminal...) :

        --feature=/var/www/html/mod/lti/tests/behat/lti_activity_completion.feature
        

      2. Confirm they pass
      3. Visually confirm in the browser that there are no exceptions in the tool page
      4. Tail the webserver logs, e.g. for moodle-docker

        $ docker logs docker_webserver_1 -f
        

        or for terminal

        tail -f /path/to/your/web/server/error.log
        

      5. Confirm there are no exceptions similar to the following:

        Default exception handler: Exception - Warning: Trying to access array offset on value of type bool in [dirroot]/mod/lti/OAuth.php on line 455
        

      Show
      Pre-requisities Site using PHP8.0 Test Init and run the following Behat scenarios in your favorite environment (moodle-docker, terminal...) : --feature=/var/www/html/mod/lti/tests/behat/lti_activity_completion.feature Confirm they pass Visually confirm in the browser that there are no exceptions in the tool page Tail the webserver logs, e.g. for moodle-docker $ docker logs docker_webserver_1 -f or for terminal tail -f /path/to/your/web/server/error.log Confirm there are no exceptions similar to the following: Default exception handler: Exception - Warning: Trying to access array offset on value of type bool in [dirroot]/mod/lti/OAuth.php on line 455

    Description

      This has been detected while checking the error logs as part of the 4.0 release process @ MDL-72815.

      To reproduce:

      • Set web server and CLI to use PHP 8.0.x.
      • Init Behat
      • Run Behat with --tags '@mod_lti&&@core_completion'

      Expected behavior:

      No notices or warnings happen

      Current behavior:

      Some PHP Notices (10 times, 2 per scenario, it seems) happen (maybe visible in the browser, maybe only in web server logs). With content:

      22:378831:[Sat Oct 30 06:56:32.393254 2021] [php:notice] [pid 3779] [client 172.29.0.5:42592] Default exception handler: Exception - Warning: Trying to access array offset on value of type bool in [dirroot]/mod/lti/OAuth.php on line 455 Debug:
      Error code: generalexceptionmessage
      * line 157 of /lib/behat/lib.php: Exception thrown
      * line 455 of /mod/lti/OAuth.php: call to behat_error_handler()
      * line 431 of /mod/lti/OAuth.php: call to moodle\\mod\\lti\\OAuthRequest->get_normalized_http_url()
      * line 149 of /mod/lti/OAuth.php: call to moodle\\mod\\lti\\OAuthRequest->get_signature_base_string()
      * line 519 of /mod/lti/OAuth.php: call to moodle\\mod\\lti\\OAuthSignatureMethod_HMAC->build_signature()
      * line 514 of /mod/lti/OAuth.php: call to moodle\\mod\\lti\\OAuthRequest->build_signature()
      * line 3224 of /mod/lti/locallib.php: call to moodle\\mod\\lti\\OAuthRequest->sign_request()
      * line 680 of /mod/lti/locallib.php: call to lti_sign_parameters()
      * line 714 of /mod/lti/locallib.php: call to lti_get_launch_data()
      * line 88 of /mod/lti/launch.php: call to lti_launch_tool()
      , referer: http://webserver768231fe5b483824/behatrun3/mod/lti/view.php?id=188000
      

      Note that, while this has been detected only for 4.0dev (with PHP 8.0), it may apply to older (stable) branches too.

      Attachments

        Issue Links

          Activity

            People

              pholden Paul Holden
              stronk7 Eloy Lafuente (stronk7)
              Jake Dallimore Jake Dallimore
              Eloy Lafuente (stronk7) Eloy Lafuente (stronk7)
              Angelia Dela Cruz Angelia Dela Cruz
              David Woloszyn, Huong Nguyen, Jake Dallimore, Meirza, Michael Hawkins, Raquel Ortega, Safat Shahin, Stevani Andolo, Jake Dallimore, Ilya Tregubov, Kevin Percy, Mathew May, Mihail Geshoski, Shamim Rezaie
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:
                17/Jan/22

                Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0 minutes
                  0m
                  Logged:
                  Time Spent - 1 hour, 40 minutes
                  1h 40m