title: SimpleXMLElement' is not allowed in session_write_close()
body: <p>Im not sure what to do. im trying to make a session with my string inside of my function and parse the session outside of it , if that makes sense.... but im getting this error "SimpleXMLElement' is not allowed in session_write_close()" any suggestions on what i can do to solve it?</p>
  
  <pre><code>function api_info($form, &amp;$form_state){
  
          $server_url = 'website api url'
  
          curl_setopt($ch,    CURLOPT_URL,               $server_url              );
          curl_setopt($ch,    CURLOPT_POST,              0                        );
          curl_setopt($ch,    CURLOPT_POSTFIELDS,                                 );    
          curl_setopt($ch,    CURLOPT_HTTPHEADER,        array("Expect:")         );
          curl_setopt($ch,    CURLOPT_FAILONERROR,       1                        );
          curl_setopt($ch,    CURLOPT_FOLLOWLOCATION,                             );
          curl_setopt($ch,    CURLOPT_HEADER,            false                    );
          curl_setopt($ch,    CURLOPT_RETURNTRANSFER,    1                        );
          curl_setopt($ch,    CURLOPT_SSL_VERIFYPEER,    false                    );
          curl_setopt($ch,    CURLOPT_SSL_VERIFYHOST,    false                    );
  
          curl_setopt($ch,    CURLOPT_TIMEOUT,           120                      );
          curl_setopt($ch,    CURLINFO_HEADER_OUT,       true                     );
          curl_setopt($ch,    CURLOPT_HTTP_VERSION,      CURL_HTTP_VERSION_1_1    );
  
          $xml_response_lead_point = curl_exec($ch);
          $xml_request_lead_point = new SimpleXMLElement($xml_response_lead_point);
  
  
          $result = reset($xml_request_lead_point-&gt;sm);
  
          $xml_request = $xml_request_lead_point;
  
          $xml_results = array(
                  'lead_response' =&gt; $result,
                  'results'       =&gt; $xml_request,
          );
  
          //dvm($xml_results['results']);
          //dvm($xml_request_lead_point);
          //dvm($a);
  
          $_SESSION['lead_results'] = $xml_results['results'];
  
          return $xml_results;
  }
  
  $lead_results = $_SESSION['lead_results'];
  var_dump($lead_results);
  </code></pre>