Moodle

Moodle groups index.php not working after upgrade 1.86->1.87 PROBLEM : require_once('HTML/AJAX/JSON.php'). After fix the users area is not updated when viewing groups.

Details

  • Type: Bug Bug
  • Status: Closed Closed
  • Priority: Minor Minor
  • Resolution: Fixed
  • Affects Version/s: 1.8.7
  • Fix Version/s: 1.8.8, 1.9.4
  • Component/s: AJAX, Groups
  • Labels:
    None
  • Database:
    MySQL
  • Affected Branches:
    MOODLE_18_STABLE
  • Fixed Branches:
    MOODLE_18_STABLE, MOODLE_19_STABLE

Description

I upgraded 1.86 version to 1.87 version without any problems.

Now it seems there have been some changes in file locations? on ajax?

The file: groups/index.php has a require_once line which wont work because of the require_once('HTML/AJAX/JSON.php');

I thought Moodle wasnt dependent on pear-modules? because that require_once line tries to find the ajax-module in my pear-directory. Correct me if Im wrong.

My fix was to install pear module HTML_AJAX!

After this I got the groups page working again, but when I try to see the attendants on different groups it wont show them on right side. I have to go "Add/remove users" to get the list.

Issue Links

Activity

Hide
Nicolas Connault added a comment -

Extending PHP's include_path to include Moodle's lib/pear directory. This omission lead to requiring the pear files twice when they were found, and fatal error when they were not found.

Show
Nicolas Connault added a comment - Extending PHP's include_path to include Moodle's lib/pear directory. This omission lead to requiring the pear files twice when they were found, and fatal error when they were not found.
Hide
Nicolas Connault added a comment -

This fix will require a rebuild of 1.8.7

Show
Nicolas Connault added a comment - This fix will require a rebuild of 1.8.7
Hide
Eloy Lafuente (stronk7) added a comment - - edited

Hi,

both the 1.8.7 release and last 1.8 weekly packages have been rebuilt. Also, tags in CVS have been moved accordingly so people updating to MOODLE_18_WEEKLY will get the working version.

Show
Eloy Lafuente (stronk7) added a comment - - edited Hi, both the 1.8.7 release and last 1.8 weekly packages have been rebuilt. Also, tags in CVS have been moved accordingly so people updating to MOODLE_18_WEEKLY will get the working version.
Hide
Eloy Lafuente (stronk7) added a comment -

Tested. Closing.

Show
Eloy Lafuente (stronk7) added a comment - Tested. Closing.
Hide
Paul Ortman added a comment -

I'm seeing the same problems as reported here, but with 1_9_STABLE (currently tested with: Moodle 1.9.3 (Build: 20081021)). With groups/index.php version "1.37.2.4 " clicking on the "Groups" link in the admin block of any course on the site results in a blank page and the following PHP error:

PHP Fatal error: require_once() [<a href='function.require'>function.require</a>]: Failed opening required 'HTML/AJAX/Serializer/JSON.php' (include_path='/var/www/moodle-test/lib/pear:/var/www/moodle-test/lib/pear:.:/usr/share/pear') in /var/www/moodle-test/group/index.php on line 14, referer: https://moodle-test.goshen.edu/course/view.php?id=1002

Commenting out that line gets most of the group functionality to work, but the original error reported above still rears its head.

PHP Fatal error: Call to undefined function json_encode() in /var/www/moodle-test/group/index.php on line 64, referer: https://moodle-test.goshen.edu/group/index.php?id=1002&group=161

Note, we're running PHP 5.1.6 (which I believe should still be supported for version 1.9.x), it does not have a json_encode() function which breaks the viewing of group members.

So, I think for 1.9.4 you need to revert lines 48-65 to an earlier version as well.

Show
Paul Ortman added a comment - I'm seeing the same problems as reported here, but with 1_9_STABLE (currently tested with: Moodle 1.9.3 (Build: 20081021)). With groups/index.php version "1.37.2.4 " clicking on the "Groups" link in the admin block of any course on the site results in a blank page and the following PHP error: PHP Fatal error: require_once() [<a href='function.require'>function.require</a>]: Failed opening required 'HTML/AJAX/Serializer/JSON.php' (include_path='/var/www/moodle-test/lib/pear:/var/www/moodle-test/lib/pear:.:/usr/share/pear') in /var/www/moodle-test/group/index.php on line 14, referer: https://moodle-test.goshen.edu/course/view.php?id=1002 Commenting out that line gets most of the group functionality to work, but the original error reported above still rears its head. PHP Fatal error: Call to undefined function json_encode() in /var/www/moodle-test/group/index.php on line 64, referer: https://moodle-test.goshen.edu/group/index.php?id=1002&group=161 Note, we're running PHP 5.1.6 (which I believe should still be supported for version 1.9.x), it does not have a json_encode() function which breaks the viewing of group members. So, I think for 1.9.4 you need to revert lines 48-65 to an earlier version as well.
Hide
Samuli Karevaara added a comment -

We have PHP 5.2.4 and Moodle 1.9.3+ and the group/index.php page is blank.

Show
Samuli Karevaara added a comment - We have PHP 5.2.4 and Moodle 1.9.3+ and the group/index.php page is blank.
Hide
Nicolas Connault added a comment -

Please tell us if the file lib/pear/HTML/AJAX/Serializer/JSON.php is actually in your working copy. If it is not, then it means your working copy is botched up and you need to check a new one out from scratch.

There is absolutely no reason why this bug should occur considering the state of 1.8.7 and 1.9.3

Show
Nicolas Connault added a comment - Please tell us if the file lib/pear/HTML/AJAX/Serializer/JSON.php is actually in your working copy. If it is not, then it means your working copy is botched up and you need to check a new one out from scratch. There is absolutely no reason why this bug should occur considering the state of 1.8.7 and 1.9.3
Hide
Paul Ortman added a comment -

root@moodle $ ls -lh lib/pear/HTML/AJAX/Serializer/JSON.php
ls: lib/pear/HTML/AJAX/Serializer/JSON.php: No such file or directory

root@moodle $ ls -lh lib/pear/HTML
total 136K
rwxr-x-- 1 root apache 35K Oct 3 03:09 AJAX.php
drwxr-x--- 2 root apache 4.0K Oct 16 16:35 CVS
rw-r---- 1 root apache 12K Sep 24 2006 Common.php
drwxr-x--- 5 root apache 4.0K Dec 19 2007 QuickForm
rw-r---- 1 root apache 75K Sep 24 2006 QuickForm.php

As you can see, in a CVS checkout, we don't even have an AJAX directory, much less the JSON.php file. (CVS 20081016 of 1.9 STABLE)

Show
Paul Ortman added a comment - root@moodle $ ls -lh lib/pear/HTML/AJAX/Serializer/JSON.php ls: lib/pear/HTML/AJAX/Serializer/JSON.php: No such file or directory root@moodle $ ls -lh lib/pear/HTML total 136K rwxr-x-- 1 root apache 35K Oct 3 03:09 AJAX.php drwxr-x--- 2 root apache 4.0K Oct 16 16:35 CVS rw-r---- 1 root apache 12K Sep 24 2006 Common.php drwxr-x--- 5 root apache 4.0K Dec 19 2007 QuickForm rw-r---- 1 root apache 75K Sep 24 2006 QuickForm.php As you can see, in a CVS checkout, we don't even have an AJAX directory, much less the JSON.php file. (CVS 20081016 of 1.9 STABLE)
Hide
Paul Ortman added a comment -

You're correct, a fresh checkout of MOODLE_19_STABLE does have the files present, but a cvs -z3 -d up on an already checked out MOODLE_19_STABLE never adds the directories or files below lib/pear/HTML for AJAX. Is there something I'm somehow missing about using cvs? Does this happen regularly? <snide>Does breakage like this provide a good reason to move to a modern, cross platform, and user friendly VCS like bzr or (on at least one of those points) git?</snide>

Thanks for help debugging this. Now I get the pleasure of moving our custom code to a newly checked out version...

Show
Paul Ortman added a comment - You're correct, a fresh checkout of MOODLE_19_STABLE does have the files present, but a cvs -z3 -d up on an already checked out MOODLE_19_STABLE never adds the directories or files below lib/pear/HTML for AJAX. Is there something I'm somehow missing about using cvs? Does this happen regularly? <snide>Does breakage like this provide a good reason to move to a modern, cross platform, and user friendly VCS like bzr or (on at least one of those points) git?</snide> Thanks for help debugging this. Now I get the pleasure of moving our custom code to a newly checked out version...
Hide
Martin Dougiamas added a comment -

Nicolas, there is something funny going on with the checkin...

http://cvs.moodle.org/moodle/lib/pear/HTML/AJAX/Serializer/JSON.php?view=log&pathrev=

Please don't delete files in CVS and re-add them ... I think it's made CVS confused (it downloaded fine on one site for me but not another).

I found that if I just updated that directory like this:

  1. cvs -q update -dP -r MOODLE_18_STABLE
    U AJAX.php
    P AJAX/Action.php
    P AJAX/Debug.php
    P AJAX/Helper.php
    P AJAX/JSON.php
    P AJAX/Response.php
    P AJAX/Server.php
    P AJAX/Serializer/Error.php
    P AJAX/Serializer/JSON.php
    P AJAX/Serializer/Null.php
    P AJAX/Serializer/PHP.php
    P AJAX/Serializer/Urlencoded.php
    P AJAX/Serializer/XML.php
    U QuickForm/element.php

Then it got the files, and then doing this seemed to bring it all back to normal:

  1. cvs -q update -dP -r MOODLE_19_STABLE
    U AJAX.php
    P AJAX/Action.php
    P AJAX/Debug.php
    P AJAX/Helper.php
    P AJAX/JSON.php
    P AJAX/Response.php
    P AJAX/Server.php
    P AJAX/Serializer/Error.php
    P AJAX/Serializer/JSON.php
    P AJAX/Serializer/Null.php
    P AJAX/Serializer/PHP.php
    P AJAX/Serializer/Urlencoded.php
    P AJAX/Serializer/XML.php
    U QuickForm/element.php
Show
Martin Dougiamas added a comment - Nicolas, there is something funny going on with the checkin... http://cvs.moodle.org/moodle/lib/pear/HTML/AJAX/Serializer/JSON.php?view=log&pathrev= Please don't delete files in CVS and re-add them ... I think it's made CVS confused (it downloaded fine on one site for me but not another). I found that if I just updated that directory like this:
  1. cvs -q update -dP -r MOODLE_18_STABLE U AJAX.php P AJAX/Action.php P AJAX/Debug.php P AJAX/Helper.php P AJAX/JSON.php P AJAX/Response.php P AJAX/Server.php P AJAX/Serializer/Error.php P AJAX/Serializer/JSON.php P AJAX/Serializer/Null.php P AJAX/Serializer/PHP.php P AJAX/Serializer/Urlencoded.php P AJAX/Serializer/XML.php U QuickForm/element.php
Then it got the files, and then doing this seemed to bring it all back to normal:
  1. cvs -q update -dP -r MOODLE_19_STABLE U AJAX.php P AJAX/Action.php P AJAX/Debug.php P AJAX/Helper.php P AJAX/JSON.php P AJAX/Response.php P AJAX/Server.php P AJAX/Serializer/Error.php P AJAX/Serializer/JSON.php P AJAX/Serializer/Null.php P AJAX/Serializer/PHP.php P AJAX/Serializer/Urlencoded.php P AJAX/Serializer/XML.php U QuickForm/element.php
Hide
Martin Dougiamas added a comment -

I'll delete the files and re-add

Show
Martin Dougiamas added a comment - I'll delete the files and re-add
Hide
Samuli Karevaara added a comment -

My issue was unrelated to Moodle: the folder /lib/pear/HTML/AJAX/ and it's contents was missing after a subversion merge.

Show
Samuli Karevaara added a comment - My issue was unrelated to Moodle: the folder /lib/pear/HTML/AJAX/ and it's contents was missing after a subversion merge.
Hide
Petr Škoda (skodak) added a comment -

I suppose we can close this one now - did not see any more complaints recently, thanks

Show
Petr Škoda (skodak) added a comment - I suppose we can close this one now - did not see any more complaints recently, thanks

Dates

  • Created:
    Updated:
    Resolved: