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

Deprecated: strpos(): Passing null to parameter #1 ($haystack) in /lib/classes/component.php

XMLWordPrintable

    • MOODLE_402_STABLE, MOODLE_403_STABLE
    • MOODLE_402_STABLE
    • MDL-78937-402
    • MDL-78937-master
    • Hide
      1. Run PHP 8.0 on your machine.
      2. Install Moodle 4.0
      3. Apply the patch
      4. Switch to PHP 8.1 or 8.2
      5. Upgrade the Moodle instance to 4.2
      6. During the process of the plugin check page. Verify that you don't see any errors like the below:

        Deprecated: strpos(): Passing null to parameter #1 ($haystack) of type string is deprecated in /lib/classes/component.php on line 1056

      Show
      Run PHP 8.0 on your machine. Install Moodle 4.0 Apply the patch Switch to PHP 8.1 or 8.2 Upgrade the Moodle instance to 4.2 During the process of the plugin check page. Verify that you don't see any errors like the below: Deprecated: strpos(): Passing null to parameter # 1 ($haystack) of type string is deprecated in /lib/classes/component.php on line 1056
    • 2
    • Team Hedgehog 2023 Sprint 3.3

      Error in PHP 8.1:

      Deprecated:  strpos(): Passing null to parameter #1 ($haystack) of type string is deprecated in /Users/huongnv/Work/stable_master/moodle/lib/classes/component.php on line 1056 

      Steps to replicate

      1. Create a new LMS instance (if needed).
      2. Make sure that you're running on PHP 8.1 or 8.2.
      3. Make sure to turn on the Debugging mode.
      4. Install the tool_mfa from MDL-78509 or https://github.com/catalyst/moodle-tool_mfa (I'd suggest to install it from MDL-78509).
      5. Navigate to Site Administration and finish the upgrade process.
      6. Run this command in the command line: rm -rf admin/tool/mfa
      7. Run this command in the command line: php admin/cli/purge_caches.php
      8. Navigate to Site Administration.
      9. Verify the content of the page.

      Expected result:

      The user will see the Plugins check page saying that tool_mfa and factors are missing from disk.

      Actual result:

      A lot of deprecation warnings at the top of the page.

        1. error.png
          error.png
          679 kB
        2. image-2023-09-23-15-47-33-930.png
          image-2023-09-23-15-47-33-930.png
          103 kB
        3. MDL-78937.png
          MDL-78937.png
          731 kB

            meirza.arson@moodle.com Meirza
            huongn@moodle.com Huong Nguyen
            Huong Nguyen Huong Nguyen
            Jun Pataleta Jun Pataleta
            Ron Carl Alfon Yu Ron Carl Alfon Yu
            Votes:
            0 Vote for this issue
            Watchers:
            7 Start watching this issue

              Created:
              Updated:
              Resolved:

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 6 hours, 21 minutes
                6h 21m

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