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

Webdavlib throws warnings in PHP 8.0

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: Minor Minor
    • None
    • 4.0.5, 4.1
    • Repositories
    • MOODLE_400_STABLE, MOODLE_401_STABLE
    • MDL-76472-master
    • Hide

      Prerequisite for testing

      1. Docker
      2. ngrok
        For instance, use this ngrok for nextcloud:
        ngrok http --region=in 8081

      Setup nextcloud instance

      1. Run the command below:
        docker run -d -p 8081:80 --name nextcloud nextcloud:stable

        You should get the latest version of nextcloud installed on your machine. Access it using URL generated by ngrok say, https://23ba1b00d3fa.in.ngrok.io/.

      2. Create the admin user and login to the nextcloud instance. Accessing via the ngrok url helps nextcloud set trusted domain as the same url and overwrite.cli.url automatically.
      3. Now access the config/config.php file of your Nextcloud instance from the terminal using:
        docker exec -it nextcloud bash

        After this open config/config.php and update it with line below (you may need to install something like vim in the container)

        'overwriteprotocol' => 'https',
      4. Navigate to Settings -> Security page
      5. Under OAuth 2.0 clients fill up the details like:
        1. Name: Moodle
        2. Redirection URI: http://localhost/m/pg_stable_master/admin/oauth2callback.php
          The redirection URL is your moodle URL + admin/oauth2callback.php
      6. Click on "Add" button, which generates a Client ID and secret. Keep this window open, since you will need those.

      Configure moodle instance

      1. Log in to moodle as admin.
      2. Navigate to Site Administration -> Server -> OAuth 2 services
      3. In the "Create new service" section select Nextcloud.
      4. Now fill in the Client ID (copy it from step 6 of Nextcloud setup instance)
      5. Fill in the Client secret (copy it from step 6 of Nextcloud setup instance)
      6. Fill in the "Service base URL". This has to be https address. Kindly refer to the ngrok https address which you executed in the prerequisite section.
      7. Click on the button "Save changes"
      8. Click on "System account connected" section of Nextcloud. And login as an admin account of Nextcloud.
      9. Navigate to: Site administration -> Plugins -> Repositories -> Manage repositories
      10. Select Nextcloud as "Enabled and visible".
      11. Click on the "Settings" link right next to "Enable and visible" option.
      12. Click the button "Create a repository instance".
      13. Give a name to your repo: "Nextcloud" and Save.

      View the PHP error log.

      1. Tail your PHP error log. e.g.

        tail -f /var/log/path/to/php/error.log

      Steps to test

      1. Click on the user menu in the upper right corner.
      2. Click on private files.
      3. Click on the 'Add file' button in the upper left corner in the file picker.
      4. Click on 'Nextcloud'.
      5. Login as nextcloud admin.
      6. Verify that you see the contents of your nextcloud directory in the filepicker.
      7. Verify that there are no warnings concerning the webdavlib in the php error log.
      Show
      Prerequisite for testing Docker ngrok For instance, use this ngrok for nextcloud: ngrok http --region=in 8081 Setup nextcloud instance Run the command below: docker run -d -p 8081:80 --name nextcloud nextcloud:stable You should get the latest version of nextcloud installed on your machine. Access it using URL generated by ngrok say, https://23ba1b00d3fa.in.ngrok.io/ . Create the admin user and login to the nextcloud instance. Accessing via the ngrok url helps nextcloud set trusted domain as the same url and overwrite.cli.url automatically. Now access the config/config.php file of your Nextcloud instance from the terminal using: docker exec -it nextcloud bash After this open config/config.php and update it with line below (you may need to install something like vim in the container) 'overwriteprotocol' => 'https', Navigate to Settings -> Security page Under OAuth 2.0 clients fill up the details like: Name: Moodle Redirection URI: http://localhost/m/pg_stable_master/admin/oauth2callback.php The redirection URL is your moodle URL + admin/oauth2callback.php Click on "Add" button, which generates a Client ID and secret. Keep this window open, since you will need those. Configure moodle instance Log in to moodle as admin. Navigate to Site Administration -> Server -> OAuth 2 services In the "Create new service" section select Nextcloud. Now fill in the Client ID (copy it from step 6 of Nextcloud setup instance) Fill in the Client secret (copy it from step 6 of Nextcloud setup instance) Fill in the "Service base URL". This has to be https address. Kindly refer to the ngrok https address which you executed in the prerequisite section. Click on the button "Save changes" Click on "System account connected" section of Nextcloud. And login as an admin account of Nextcloud. Navigate to: Site administration -> Plugins -> Repositories -> Manage repositories Select Nextcloud as "Enabled and visible". Click on the "Settings" link right next to "Enable and visible" option. Click the button "Create a repository instance". Give a name to your repo: "Nextcloud" and Save. View the PHP error log. Tail your PHP error log. e.g. tail -f /var/log/path/to/php/error.log Steps to test Click on the user menu in the upper right corner. Click on private files. Click on the 'Add file' button in the upper left corner in the file picker. Click on 'Nextcloud'. Login as nextcloud admin. Verify that you see the contents of your nextcloud directory in the filepicker. Verify that there are no warnings concerning the webdavlib in the php error log.

      The warning is:
      PHP Warning:  Object of class XMLParser could not be converted to int in /var/www/public/moodle401/lib/webdavlib.php on line 1072
      It occurs in a few other lines as well. When using the nextcloud repository, it happens during a AJAX Request, so is only visible in the php error.log. But for example in the plugin mod_collaborativefolders it also happens in the foreground and the warnings get printed normally.

      The warning is caused by PHP 8 representing a XML Parser as a class instead of a resource (int). Fortunately, nothing else changed and the xml_ methods work exactly the same.

            justusdieckmann Justus Dieckmann
            justusdieckmann Justus Dieckmann
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved:

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