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

replace deprecated php_errormsg with error_get_last()

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Major Major
    • 3.11.6
    • 4.0
    • General
    • MOODLE_400_STABLE
    • MOODLE_311_STABLE
    • MDL-73520_replace-deprecated-php_errormsg-with-error_get_last
    • Hide

      AdoDB changes are covered by phpunit tests. Tests should pass for all supported drivers.

      To partially test the ims-blti changes (only one, but that should be enough as far as the changeset is the same):

      Setup

      1. Download test.php to your moodle instance's root folder

      Test

      1. With php73 or php74, run php test.php
      2. Verify that you get the following (without any Notice or Warning)

        OK: sendOAuthParamsPOST() returns expected message
        

      3. With php80, run php test.php
      4. Verify that you get the following (without any Notice or Warning)

        OK: sendOAuthParamsPOST() returns expected message
        

      Show
      AdoDB changes are covered by phpunit tests. Tests should pass for all supported drivers. To partially test the ims-blti changes (only one, but that should be enough as far as the changeset is the same): Setup Download test.php to your moodle instance's root folder Test With php73 or php74, run php test.php Verify that you get the following (without any Notice or Warning) OK: sendOAuthParamsPOST() returns expected message With php80, run php test.php Verify that you get the following (without any Notice or Warning) OK: sendOAuthParamsPOST() returns expected message

      From the PHP 8.0 migration guide:

      The track_errors ini directive has been removed. This means that php_errormsg is no longer available. The error_get_last() function may be used instead. 

      Also the documentation on $php_errormsg says:

      This feature has been DEPRECATED as of PHP 7.2.0. Relying on this feature is highly discouraged. Use error_get_last() instead. 

       

      FILE: enrol/lti/ims-blti/blti_util.php
      ---------------------------------------------------------------------------------------------------------
      FOUND 0 ERRORS AND 2 WARNINGS AFFECTING 2 LINES
      ---------------------------------------------------------------------------------------------------------
      211 | WARNING | The variable '$php_errormsg' is deprecated since PHP 7.2; Use error_get_last() instead
      215 | WARNING | The variable '$php_errormsg' is deprecated since PHP 7.2; Use error_get_last() instead
      ---------------------------------------------------------------------------------------------------------

      FILE: enrol/lti/ims-blti/OAuthBody.php
      ---------------------------------------------------------------------------------------------------------
      FOUND 0 ERRORS AND 2 WARNINGS AFFECTING 2 LINES
      ---------------------------------------------------------------------------------------------------------
      137 | WARNING | The variable '$php_errormsg' is deprecated since PHP 7.2; Use error_get_last() instead
      141 | WARNING | The variable '$php_errormsg' is deprecated since PHP 7.2; Use error_get_last() instead
      ---------------------------------------------------------------------------------------------------------

      FILE: lib/adodb/drivers/adodb-db2.inc.php
      ---------------------------------------------------------------------------------------------------------
      FOUND 0 ERRORS AND 4 WARNINGS AFFECTING 4 LINES
      ---------------------------------------------------------------------------------------------------------
      112 | WARNING | The variable '$php_errormsg' is deprecated since PHP 7.2; Use error_get_last() instead
      208 | WARNING | The variable '$php_errormsg' is deprecated since PHP 7.2; Use error_get_last() instead
      1582 | WARNING | The variable '$php_errormsg' is deprecated since PHP 7.2; Use error_get_last() instead
      1584 | WARNING | The variable '$php_errormsg' is deprecated since PHP 7.2; Use error_get_last() instead
      ---------------------------------------------------------------------------------------------------------

      FILE: lib/horde/framework/Horde/String.php
      --------------------------------------------------------------------------------------------------------
      FOUND 0 ERRORS AND 11 WARNINGS AFFECTING 11 LINES
      --------------------------------------------------------------------------------------------------------
      148 | WARNING | The variable '$php_errormsg' is deprecated since PHP 7.2; Use error_get_last() instead
      149 | WARNING | INI directive 'track_errors' is deprecated since PHP 7.2
      151 | WARNING | The variable '$php_errormsg' is deprecated since PHP 7.2; Use error_get_last() instead
      487 | WARNING | The variable '$php_errormsg' is deprecated since PHP 7.2; Use error_get_last() instead
      488 | WARNING | INI directive 'track_errors' is deprecated since PHP 7.2
      490 | WARNING | INI directive 'track_errors' is deprecated since PHP 7.2
      491 | WARNING | The variable '$php_errormsg' is deprecated since PHP 7.2; Use error_get_last() instead
      497 | WARNING | The variable '$php_errormsg' is deprecated since PHP 7.2; Use error_get_last() instead
      498 | WARNING | INI directive 'track_errors' is deprecated since PHP 7.2
      509 | WARNING | INI directive 'track_errors' is deprecated since PHP 7.2
      510 | WARNING | The variable '$php_errormsg' is deprecated since PHP 7.2; Use error_get_last() instead
      --------------------------------------------------------------------------------------------------------

      As the ims-blti library is no longer supported, the fixes have been applied to the source directly. For the Horde and ADOdb libraries some issues and/or pull requests have been filed:

      Horde:

      ADOdb:

       

        1. 311_Screenshot.PNG
          311_Screenshot.PNG
          87 kB
        2. Master_Screenshot.PNG
          Master_Screenshot.PNG
          90 kB
        3. test.php
          0.6 kB

            Daniel Ziegenberg Daniel Ziegenberg
            Daniel Ziegenberg Daniel Ziegenberg
            Eloy Lafuente (stronk7) Eloy Lafuente (stronk7)
            Jun Pataleta Jun Pataleta
            Gladys Basiana Gladys Basiana
            Votes:
            1 Vote for this issue
            Watchers:
            8 Start watching this issue

              Created:
              Updated:
              Resolved:

                Estimated:
                Original Estimate - 0 minutes
                0m
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 3 hours, 25 minutes
                3h 25m

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