php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #76976 xmlrpc_decode is creating a memory leak
Submitted: 2018-10-05 12:41 UTC Modified: 2019-07-28 04:22 UTC
Votes:1
Avg. Score:3.0 ± 0.0
Reproduced:0 of 0 (0.0%)
From: marek dot salzinger at gmail dot com Assigned:
Status: No Feedback Package: XMLRPC-EPI related
PHP Version: 7.2.10 OS: Windows 10
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2018-10-05 12:41 UTC] marek dot salzinger at gmail dot com
Description:
------------
---
From manual page: http://www.php.net/function.xmlrpc-decode
---

The function xmlrpc_decode is creating a memory leak on Windows. I am using PHP 7.2.9.
I tried my code on Ubuntu and there was no memoryleak involved.

Test script:
---------------
//pseudo:

while( condition ) {
        $ch = curl_init( $xml_rpc_url . $xml_rpc_login );
      
        curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
        curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
        curl_setopt($ch, CURLOPT_ENCODING ,"UTF-8");
        curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'POST');
        curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: text/xml'));
        curl_setopt($ch, CURLOPT_POSTFIELDS, $xml_request_query);
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);

        $xml_response_aa[$imported_data_type][$group_name] = xmlrpc_decode(utf8_encode(curl_exec($ch)));
        
        curl_close($ch);
        unset($ch);
}


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2018-10-05 14:09 UTC] cmb@php.net
-Status: Open +Status: Feedback -Assigned To: +Assigned To: cmb
 [2018-10-05 14:09 UTC] cmb@php.net
What is the return value of `curl_exec($ch)`?
 [2018-10-05 14:26 UTC] marek dot salzinger at gmail dot com
Its a multi dimensional array. It can have up to 600~1000 Entries.
The total length of one return value is 10933653.

The structure is:
array["type"]["group"] = array(
          'callId' => value,
          'callStepId' => value, 
          'callLegUUID' => value,
          'agentId' => value,
          'cdrAccountId' => value,
          'callerAccountId' => value,
          'calledAccountId' => value, 
          'calledCallerId' => value,
          'starttime' => value,
          'ringingtime' => value,
          'linktime' => value,
          'callresultTime' => value,
          'callResult' => value,
          'callResultCausedBy' => value,
          'lineId' => value,
          'lineName' => value,
          'answeredElsewhere' => value,
          'incoming' => value,
          'answered' => value,
          'hasVoicemail' => value,
          'hasMonitor' => value,
          'callbackNumberExtern' => value,
          'groupname' => value
);


Its formated in xml so the output is a bit of a mess. i will give you a example output, this may not create the memory leak.

<?xml version="1.0" encoding="UTF-8"?>
<methodCall>
   <methodName>Queue.getHistoryData</methodName>
   <params>
      <param>
         <value>
            <struct>
               <member>
                  <name>queueName</name>
                  <value>
                     <string>testIq</string>
                  </value>
               </member>
               <member>
                  <name>from</name>
                  <value>
                     <string>20150701T12:59:05</string>
                  </value>
               </member>
               <member>
                  <name>to</name>
                  <value>
                     <string>20160701T12:59:05</string>
                  </value>
               </member>
            </struct>
         </value>
      </param>
   </params>
</methodCall>
 [2018-10-07 16:27 UTC] cmb@php.net
-Status: Feedback +Status: Open
 [2018-10-07 16:27 UTC] cmb@php.net
> i will give you a example output, this may not create the memory
> leak.

Hmm, you're giving us not much.  Anyhow, I've checked this XML,
and I can't detect a memory leak.
 [2018-10-07 16:27 UTC] cmb@php.net
-Package: XML related +Package: XMLRPC-EPI related
 [2018-10-07 16:28 UTC] cmb@php.net
-Assigned To: cmb +Assigned To:
 [2019-07-15 13:27 UTC] nikic@php.net
-Status: Open +Status: Feedback
 [2019-07-15 13:27 UTC] nikic@php.net
I don't think we can do anything here without the actual XML that causes the leak.
 [2019-07-28 04:22 UTC] php-bugs at lists dot php dot net
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Re-Opened". Thank you.
 
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Sat Dec 04 19:03:35 2021 UTC