moodle-mod_simplecertificate icon indicating copy to clipboard operation
moodle-mod_simplecertificate copied to clipboard

3.9 version ( 2020041239 ) cannot write files

Open goose2000 opened this issue 2 years ago • 2 comments

Describe the bug I would really like to continue using Simple Certificate with Moodle 4.0 so I tried to install and knew it would probably have problems but I want to report - hoping I might get some insight on fixing it for M4.x

In essence, it all installs and is configurable, but it has trouble writing files or temp file I believe: Error code: storedfilenotcreated

Moodle Version(s) Moodle 4.0 (Build: 20220419) - PHP 7.4 - MySQL 8.0

To Reproduce Steps to reproduce the behavior:

  1. Install version for moodle 3.9 from github branch - on a fresh Moodle 4.0 instance
  2. Create example Simple Certificate activity
  3. Try to view from "Issue a test certificate" tab - click Get Certificate
  4. Here is the debug info from Moodle :

Coding error detected, it must be fixed by a programmer: PHP catchable fatal error

More information about this error

×Debug info: Object of class stored_file could not be converted to string Error code: codingerror ×Stack trace: line 427 of \lib\setuplib.php: coding_exception thrown line 2315 of \lib\filelib.php: call to default_error_handler() line 2602 of \lib\filelib.php: call to readfile_accel() line 2756 of \lib\filelib.php: call to send_file() line 1325 of \mod\simplecertificate\locallib.php: call to send_stored_file() line 1911 of \mod\simplecertificate\locallib.php: call to simplecertificate->output_pdf() line 122 of \mod\simplecertificate\view.php: call to simplecertificate->view_default()

Expected behavior Open a PDF certificate in a pop-up window.

Screenshots If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

  • Windows
  • Chrome

Additional context Add any other context about the problem here.

goose2000 avatar Jun 03 '22 13:06 goose2000

Tracing back the error stack, it seems that moodle's debbugger is throwing an error 'cause is not possible to generate a file and show it in the same call (buffer error).

Disabling the debug messages in "/admin/settings.php?section=debugging" seems to avoid this problem.

dankonobre avatar Dec 15 '22 14:12 dankonobre

This issue is complicated by the code to the handle errors in readfile_accel() containing an error, see MDL-72582. The Object of class stored_file could not be converted to string message is this second error within Moodle, not the error causing the problem.

leonstr avatar Jan 26 '23 14:01 leonstr