oliviervalentin/moodle-mod_stickynotes

Error when adding a sticky note

Closed this issue · 4 comments

Logged in as site admin on Moodle [3.11.5 (Build: 20220117)]

Created a stickynote activity, added three columns. Adding sticky notes into the third column.

Error message -

Notice: Trying to access array offset on value of type null in /home/gnghxfqr/public_html/mod/stickynotes/note.php on line 96
This page should automatically redirect. If nothing is happening please use the continue link below.
[Continue]
Error output, so disabling automatic redirect.

Clicking Continue shows the sticky note in the correct location and working from that point onwards.

Tested with Boost, and Lambda themes.

Persistant and replicable error.

Hope this helps as it's a great idea for a plugin. Happy to answer any other questions.

Best Regards

Dave Emsley

Hi Dave, and thanks for your message !

I tried to replicate this bug, without success... :(
I tried on my Moodle 3.11.5+ (20220211), with last version of Sticky Notes.
I added 3 columns as soon as the activity is created, and tried to add a note directly in last column, but I didn't get any error message ! tested with Boost and Adaptable.

I checked code on line 96 : this one simply defines the page title. It gets the column title to show "Add a note in column... (+ column name)".
The problem could come from the function that is retrieving the title... I will try to rewrite it with a few advices I saw on internet, maybe it could solve your problem. Too bad I'm unable to replicate this problem to be more efficient ! :(

At worst, if it really causes problem, lines 95 and 96 of note.php can be commented : their only goal is to display a title !

A last question, if you can answer it : can you check your PHP version ?

Best regards
Olivier

Hi Olivier, Wasn't expecting such a quick response. PHP version is 7.4

Cheers

Dave

Thank you ! I keep this information in mind, for it is the only difference : we are under PHP 7.3 ! Could it come from this ? I read on forums that 7.4 is less permissive with some codes... Maybe my function calling column title is the source ! I will try to rewrite it, and see if it changes something for you.
Cheers !
Olivier

Closing issue.