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

XMLRPC request encoded on Moodle 3.1 can not be decoded

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Won't Do
    • Icon: Minor Minor
    • None
    • 3.3.3, 3.4
    • Hub
    • MOODLE_33_STABLE, MOODLE_34_STABLE
    • wip-MDL-60977-master
    • Hide
      1. Make sure your site is accessible from internet (i.e. use ngrok.com)
      2. Register the site with moodle.net , specify some weird characters in the site name
      3. Share a course on moodle.net , specify some weird characters in the course name
      4. Unregister the site
      Show
      Make sure your site is accessible from internet (i.e. use ngrok.com) Register the site with moodle.net , specify some weird characters in the site name Share a course on moodle.net , specify some weird characters in the course name Unregister the site

      In Moodle 3.0 and below we used xmlrpc in Zend
      In Moodle 3.2 and above the xmlrpc_encode_request() was fixed by MDL-57775 (fixed in 3.2.5, 3.3.2)
      Websites using Moodle 3.1 send requests to moodle.net that are weirdly encoded. Moodle.net can not decode these requests.

      Example:

      $str = 'Πλατφόρμα';
      $encoded = xmlrpc_encode_request('test', ['s' => $str]);
      $method = null;
      $decoded = xmlrpc_decode_request($encoded, $method);
      echo $str."\nENCODED=\n".$encoded."\nDECODED=\n".$decoded."\n";
      

      I have tried different arguments to xmlrpc_decode_request() as suggested in MDLSITE-4726 but no luck, the string can not be decoded at all.

      output:

      $ php testencoding.php 
      expat reports error code 14
      	description: reference to invalid character number
      	line: 11
      	column: 14
      	byte index: 187
      	total bytes: 0
       
      	data beginning 10 before byte index:   <string>&#26;&#160;&#26;&#187;&#26;&#177;&#27;&#132;&#27;& 
       
      Πλατφόρμα
      ENCODED=
      <?xml version="1.0" encoding="iso-8859-1"?>
      <methodCall>
      <methodName>test</methodName>
      <params>
       <param>
        <value>
         <struct>
          <member>
           <name>s</name>
           <value>
            <string>&#26;&#160;&#26;&#187;&#26;&#177;&#27;&#132;&#27;&#134;&#27;&#140;&#27;&#129;&#26;&#188;&#26;&#177;</string>
           </value>
          </member>
         </struct>
        </value>
       </param>
      </params>
      </methodCall>
       
      DECODED=
      

            Unassigned Unassigned
            marina Marina Glancy
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved:

                Error rendering 'clockify-timesheets-time-tracking-reports:timer-sidebar'. Please contact your Jira administrators.