Moodle
  1. Moodle
  2. MDL-16780

JSON class needs moving to pear directory

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Critical Critical
    • Resolution: Fixed
    • Affects Version/s: 1.8.6, 1.9.2
    • Fix Version/s: 1.8.7, 1.9.3, 2.0
    • Component/s: AJAX and JavaScript
    • Labels:
      None
    • Affected Branches:
      MOODLE_18_STABLE, MOODLE_19_STABLE
    • Fixed Branches:
      MOODLE_18_STABLE, MOODLE_19_STABLE, MOODLE_20_STABLE
    • Rank:
      24266

      Description

      As suggested by Eloy, the class in lib/json/JSON.php is a pear class (now residing in HTML/AJAX) and needs to be moved to the right directory, and properly credited in the lib/pear/README.txt file. All files in core and contrib using this class also need updating.

        Issue Links

          Activity

          Hide
          Paul Taylor added a comment -

          I'm not sure if this is related, but I noticed on the latest update to 1.8.6 (October 8th) that when you tried to go to groups, there was an error message (with debug on):

          Warning: require_once(HTML/AJAX.php) [function.require-once]: failed to open stream: No such file or directory in /var/www/moodle-18/lib/pear/HTML/AJAX/JSON.php on line 14

          I remarked out line 14 and then 776-801 in JSON.php, and groups worked. I'm not sure why it is asking for AJAX.php, but no such file exists. I assume it means just the directory HTML/AJAX?

          I found this on a few client machines and my test server.

          Show
          Paul Taylor added a comment - I'm not sure if this is related, but I noticed on the latest update to 1.8.6 (October 8th) that when you tried to go to groups, there was an error message (with debug on): Warning: require_once(HTML/AJAX.php) [function.require-once] : failed to open stream: No such file or directory in /var/www/moodle-18/lib/pear/HTML/AJAX/JSON.php on line 14 I remarked out line 14 and then 776-801 in JSON.php, and groups worked. I'm not sure why it is asking for AJAX.php, but no such file exists. I assume it means just the directory HTML/AJAX? I found this on a few client machines and my test server.
          Hide
          Shane Elliott added a comment - - edited

          Confirming that this is a problem on 1.8 sites. Reopening issue.

          Show
          Shane Elliott added a comment - - edited Confirming that this is a problem on 1.8 sites. Reopening issue.
          Hide
          Nicolas Connault added a comment -

          Bug fixed, thanks for the report

          Show
          Nicolas Connault added a comment - Bug fixed, thanks for the report
          Hide
          Dongsheng Cai added a comment -

          Closing, Thanks.

          Show
          Dongsheng Cai added a comment - Closing, Thanks.
          Hide
          Sunner Sun added a comment -

          Warning: main(HTML/AJAX/JSON.php) [function.main]: failed to open stream: No such file or directory in /var/www/moodle/group/index.php on line 14

          in MOODLE_18_WEEKLY

          I just "cvs up" and got this error

          Show
          Sunner Sun added a comment - Warning: main(HTML/AJAX/JSON.php) [function.main] : failed to open stream: No such file or directory in /var/www/moodle/group/index.php on line 14 in MOODLE_18_WEEKLY I just "cvs up" and got this error
          Hide
          Erik Ordway added a comment -

          /lib/pear/HTML/AJAX/*

          is missing from 1_9_WEEKLY and causes blank page when loading groups page

          Show
          Erik Ordway added a comment - /lib/pear/HTML/AJAX/* is missing from 1_9_WEEKLY and causes blank page when loading groups page
          Show
          Nicolas Connault added a comment - - edited As you can see, the files are there: http://cvs.moodle.org/moodle/lib/pear/HTML/AJAX/?pathrev=MOODLE_19_WEEKLY They are also in 18_WEEKLY: http://cvs.moodle.org/moodle/lib/pear/HTML/AJAX/?pathrev=MOODLE_18_WEEKLY
          Hide
          Eloy Lafuente (stronk7) added a comment -

          Thanks for the quick fix, Nicolas! B-)
          (just thinking that we don't need it in 19_STABLE nor HEAD, where the include is done centrally in setup.php)

          Just raising to Critical, reopening and adding Martin as watcher in order to decide if this require repackaging of STABLE_18 release (released today, some hours before fixing this - so the release contains the bug).

          Show
          Eloy Lafuente (stronk7) added a comment - Thanks for the quick fix, Nicolas! B-) (just thinking that we don't need it in 19_STABLE nor HEAD, where the include is done centrally in setup.php) Just raising to Critical, reopening and adding Martin as watcher in order to decide if this require repackaging of STABLE_18 release (released today, some hours before fixing this - so the release contains the bug).
          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.

          So... reclosing this after some more tests of current generated packages... ciao

          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. So... reclosing this after some more tests of current generated packages... ciao
          Hide
          Eloy Lafuente (stronk7) added a comment -

          Closing this. I've tested 18_WEEKLY, and 1.8.7 downloads and everything seems to be in place.

          Thanks all!

          Show
          Eloy Lafuente (stronk7) added a comment - Closing this. I've tested 18_WEEKLY, and 1.8.7 downloads and everything seems to be in place. Thanks all!
          Hide
          Daren Chandisingh added a comment -

          This appears to have re-emerged in the current cvshead (git branch).

          i.e.

          Warning: require_once(HTML/AJAX.php) [unction.require-once]: failed to open stream: No such file or directory in /home/daren/projects/moodle/lib/pear/HTML/AJAX/JSON.php on line14

          Show
          Daren Chandisingh added a comment - This appears to have re-emerged in the current cvshead (git branch). i.e. Warning: require_once(HTML/AJAX.php) [unction.require-once] : failed to open stream: No such file or directory in /home/daren/projects/moodle/lib/pear/HTML/AJAX/JSON.php on line14
          Hide
          Eloy Lafuente (stronk7) added a comment -

          Reopening, the file (lib/pear/HTML/AJAX.php) is in 18_STABLE and 19_STABLE but not on HEAD (since 2 years ago).

          Do we really need that stuff in HEAD, formslib perhaps? I haven't seen that warning in my dev servers but... for your consideration.

          Ciao

          Show
          Eloy Lafuente (stronk7) added a comment - Reopening, the file (lib/pear/HTML/AJAX.php) is in 18_STABLE and 19_STABLE but not on HEAD (since 2 years ago). 1.8: http://cvs.moodle.org/moodle/lib/pear/HTML/?hideattic=0&pathrev=MOODLE_18_STABLE 1.9: http://cvs.moodle.org/moodle/lib/pear/HTML/?hideattic=0&pathrev=MOODLE_19_STABLE HEAD: http://cvs.moodle.org/moodle/lib/pear/HTML/?hideattic=0&pathrev= Do we really need that stuff in HEAD, formslib perhaps? I haven't seen that warning in my dev servers but... for your consideration. Ciao
          Hide
          Daren Chandisingh added a comment -

          Sorry, I think this is a mistake on my part.

          I am trying to convert a local plugin from Moodle 1.9 to Moodle 2. One of the scripts includes "/pear/HTML/AJAX/JSON.php", which in turn tries to load the missing file.

          I'm told that Moodle 2 is PHP5 only, so the built in jason_encode() function should be available for all Moodle2 users. In turn, that means I don't need to include "/pear/HTML/AJAX/JSON.php" – thus the missing file doesn't matter. Indeed, I since commented out the require_once line for that file, and it's working fine with PHP's built-in json_encode.

          However, it does beg the question as to why the old PHP4 JSON compatibility file is still there if it shouldn't be used. I suppose it should be removed, as well as the other file that's already gone, thus breaking it anyway.

          Show
          Daren Chandisingh added a comment - Sorry, I think this is a mistake on my part. I am trying to convert a local plugin from Moodle 1.9 to Moodle 2. One of the scripts includes "/pear/HTML/AJAX/JSON.php", which in turn tries to load the missing file. I'm told that Moodle 2 is PHP5 only, so the built in jason_encode() function should be available for all Moodle2 users. In turn, that means I don't need to include "/pear/HTML/AJAX/JSON.php" – thus the missing file doesn't matter. Indeed, I since commented out the require_once line for that file, and it's working fine with PHP's built-in json_encode. However, it does beg the question as to why the old PHP4 JSON compatibility file is still there if it shouldn't be used. I suppose it should be removed, as well as the other file that's already gone, thus breaking it anyway.
          Hide
          Petr Škoda added a comment -

          done, I have removed it from HEAD, the main reason was that the AJAX pear lib was using addslashes() incorrectly.
          Thanks everybody.

          Petr Skoda

          Show
          Petr Škoda added a comment - done, I have removed it from HEAD, the main reason was that the AJAX pear lib was using addslashes() incorrectly. Thanks everybody. Petr Skoda

            People

            • Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: