New activity: Simple Certificate

Re: New activity: Simple Certificate

by Carlos Alexandre Fonseca -
Number of replies: 4
Picture of Plugin developers

I see some problems raising  about the changes of php5 to 7,  in my tests i can't reproduce this errors, and everything goes right.

as you can see at https://travis-ci.org/bozoh/moodle/builds/412427835

But this errors , after looking for it in source code,  seems yo be related to those lines:

https://github.com/bozoh/moodle-mod_simplecertificate/blob/MOODLE_35/locallib.php#L730-L744


And this error s because it's trying to call a method of a object which don't exist ( $courseitem, in this case),  but i check this if it's exists before i call the method in:

https://github.com/bozoh/moodle-mod_simplecertificate/blob/MOODLE_35/locallib.php#L731

And it's not the first time i get this kind of error for a this type of of check

if  ( $someobj = somefunction) 


which works great in php5, but seems not work very well in php7,  so i create a patch to fix those lines, and you could TEST it


to apply a patch:

  1. download and install v2.2.8
  2. go to pluging folder,  and copy the patch file get_decimal.patch into it
  3. run the command  patch <  get_decimal.patch

patch its a linux command,  common in many distros.


If this patch works i will change all the pluging code with this kind of check. (OMG!!!!!!!!!!)


In reply to Carlos Alexandre Fonseca

Re: New activity: Simple Certificate

by Don DeRespinis -

Any update on this issue?  I am doing a new install.

I am getting this error now.


Exception - Argument 1 passed to file_get_all_files_in_draftarea() must be of the type integer, null given, called in [dirroot]/lib/form/filemanager.php on line 336

In reply to Don DeRespinis

Re: New activity: Simple Certificate

by Carlos Alexandre Fonseca -
Picture of Plugin developers

I could reproduce this error in moodle 3.4, and  could trace it,  and it's not a plugin's bug, looks like a moodle's bug,  it's take me a lot of time to figure it how to overcome this bug, and the solution is very simple.

The bug is  introduced in moodle 3.4,   if  a filemanager (file upload widget) it optional and it could be disabled in forms and it's not set, this bugs occurs,  and it is the case of  certificate's second image attribute.

The fix is not disabling the upload widget in form if this not used, no a big problem.


I create a patch to this, if you want to fix your version without download the new plugins version just download the patch no certificate plugin folder,  and apply the patch

https://raw.githubusercontent.com/bozoh/moodle-mod_simplecertificate/MOODLE_35/tests/other/patchs/bugs-206.patch


cd mod/simplecertificate
wget https://raw.githubusercontent.com/bozoh/moodle-mod_simplecertificate/MOODLE_35/tests/other/patchs/bugs-206.patch
git apply bugs-206.patch
rm -rf bugs-206.patch


i report the bug in moodle's  bug track, so please vote on it

https://tracker.moodle.org/browse/MDL-63180


In reply to Carlos Alexandre Fonseca

Re: New activity: Simple Certificate

by David Markwell -

Thank you Carlos, 

I am pleased to say that the 2.2.8 version appears to work well on our UAT environment. I will install it on our production server later today and unless you hear from me again you can safely assume it also works on the production version.

Greatly appreciate you resolving this and will as requested have voted on the Moodle issue you mention.