Issue Details (XML | Word | Printable)

Key: MDL-17169
Type: Improvement Improvement
Status: Open Open
Priority: Major Major
Assignee: Nobody
Reporter: Valery Fremaux
Votes: 0
Watchers: 1
Operations

Add/Edit UI Mockup to this issue
If you were logged in you would be able to see more operations.
Moodle

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

Created: 08/Nov/08 07:39 AM   Updated: 31/Dec/08 09:49 AM
Return to search
Component/s: Networking
Affects Version/s: 1.9.3
Fix Version/s: None

Database: Any
Participants: Nigel McNie, Nobody and Valery Fremaux
Security Level: None
Affected Branches: MOODLE_19_STABLE


 Description  « Hide
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.

 All   Comments   Change History   Version Control      Sort Order: Ascending order - Click to sort in descending order
Nigel McNie added a comment - 31/Dec/08 08:11 AM
We solved this on the Mahara side by simply trim()ing the raw response - that would work here yes?

Valery Fremaux added a comment - 31/Dec/08 09:49 AM
Yes, sure, its simpler indeed. !!