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

readfile_accel() error handler may cause Object of class stored_file could not be converted to string

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Minor Minor
    • None
    • 3.11.3
    • Files API
    • MOODLE_311_STABLE
    • Hide

      These instructions assume command-line access to working Moodle install.

      1. Place the testing script, test_readfile_accel.php, in the root of your Moodle install (e.g. /var/www/html)
      2. Run this command to execute the testing script, and discarding STDOUT: php test_readfile_accel.php 1>/dev/null
      3. Inspect the output (actually STDERR)
      4. Verify both lines of output are of the form: "Non-empty default output handler buffer detected..."
      Show
      These instructions assume command-line access to working Moodle install. Place the testing script, test_readfile_accel.php, in the root of your Moodle install (e.g. /var/www/html) Run this command to execute the testing script, and discarding STDOUT: php test_readfile_accel.php 1>/dev/null Inspect the output (actually STDERR) Verify both lines of output are of the form: "Non-empty default output handler buffer detected..."
    • Hide

      Code verified against automated checks.

      Checked MDL-72582 using repository: https://github.com/tsmilan/moodle

      More information about this report

      Built on: Tue Jun 10 07:16:24 UTC 2025

      Show
      Code verified against automated checks. Checked MDL-72582 using repository: https://github.com/tsmilan/moodle main (0 errors / 0 warnings) [branch: MDL-72582 | CI Job ] More information about this report Built on: Tue Jun 10 07:16:24 UTC 2025

      MDL-69355 introduced error handling to lib/filelib.php:readfile_accel():

       

                  if ($buffercontents !== '') {
                      error_log('Non-empty default output handler buffer detected while serving the file ' . $file);
                  }
      

       

      But $file can be either a string or a stored_file instance. If it's the latter then you'll get Object of class stored_file could not be converted to string.

            trishamilan Trisha Milan
            leonstr Leon Stringer
            cameron1729 cameron1729
            Votes:
            7 Vote for this issue
            Watchers:
            11 Start watching this issue

              Created:
              Updated:

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

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