Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-17169

Protect XML-RPC responses from loose PHP libraries and debug modes

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 1.9.3
    • Fix Version/s: 1.9.8, 2.0
    • Component/s: MNet
    • Labels:
      None
    • Database:
      Any
    • Affected Branches:
      MOODLE_19_STABLE
    • Fixed Branches:
      MOODLE_19_STABLE, MOODLE_20_STABLE

      Description

      In some case (tried using backup/restore libraries server side) loose library generate spaces and endlines in XML-RPC before preparing XMLENC response. This harms a lot XML-RPC debugging because producing a very strange error :

      Reserved XML Name

      in parsing the payload.

      Solution : clean up the incoming raw response from any forward blanck chars :

      §196 in mnet/client.php

      if ($this->rawresponse === false)

      { $this->error[] = curl_errno($ch) .':'. curl_error($ch); return false; }

      // eliminates all primary spaces and endlines from unchecked
      // php scripts server side.
      $this->rawresponse = preg_replace("/^\\s\\n+/m", '', $this->rawresponse);

      $mnet_peer->touch();

      This helps understand why error helpers appear as empty when being displayed in error message.

        Gliffy Diagrams

          Issue Links

            Activity

            Hide
            nigel Nigel McNie added a comment -

            We solved this on the Mahara side by simply trim()ing the raw response - that would work here yes?

            Show
            nigel Nigel McNie added a comment - We solved this on the Mahara side by simply trim()ing the raw response - that would work here yes?
            Hide
            vf Valery Fremaux added a comment -

            Yes, sure, its simpler indeed. !!

            Show
            vf Valery Fremaux added a comment - Yes, sure, its simpler indeed. !!
            Hide
            mjollnir Penny Leach added a comment -

            committed to head and stable

            Show
            mjollnir Penny Leach added a comment - committed to head and stable

              People

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

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Fix Release Date:
                  25/Mar/10