php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #58959 Problem in the solr_encode_generic_xml_response function
Submitted: 2009-11-22 19:00 UTC Modified: 2009-11-22 23:13 UTC
From: pierrick@php.net Assigned: iekpo (profile)
Status: Closed Package: solr (PECL)
PHP Version: 5_3 SVN-2009-11-22 (dev) OS: Ubuntu 9.10
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: pierrick@php.net
New email:
PHP Version: OS:

 

 [2009-11-22 19:00 UTC] pierrick@php.net
Description:
------------
Here is a GDB backtrace of what i get when i try to query my solr :

Program received signal SIGSEGV, Segmentation fault.
0x00533cb0 in solr_encode_string () from /usr/local/lib/php/extensions/debug-zts-20090626/solr.so
(gdb) bt
#0  0x00533cb0 in solr_encode_string () from /usr/local/lib/php/extensions/debug-zts-20090626/solr.so
#1  0x005330e8 in solr_encode_document () from /usr/local/lib/php/extensions/debug-zts-20090626/solr.so
#2  0x005339a2 in solr_encode_result () from /usr/local/lib/php/extensions/debug-zts-20090626/solr.so
#3  0x00533ed7 in solr_encode_object () from /usr/local/lib/php/extensions/debug-zts-20090626/solr.so
#4  0x0053400c in solr_encode_generic_xml_response () from /usr/local/lib/php/extensions/debug-zts-20090626/solr.so
#5  0x0052ec5f in zim_SolrResponse_getResponse () from /usr/local/lib/php/extensions/debug-zts-20090626/solr.so
#6  0x0855e627 in zend_do_fcall_common_helper_SPEC (execute_data=0x8c942e4, tsrm_ls=0x8aab070)
    at /home/charronp/php-dev/branches/PHP_5_3/Zend/zend_vm_execute.h:313
#7  0x0855ee92 in ZEND_DO_FCALL_BY_NAME_SPEC_HANDLER (execute_data=0x8c942e4, tsrm_ls=0x8aab070)
    at /home/charronp/php-dev/branches/PHP_5_3/Zend/zend_vm_execute.h:418
#8  0x0855d8f7 in execute (op_array=0x8c6691c, tsrm_ls=0x8aab070) at /home/charronp/php-dev/branches/PHP_5_3/Zend/zend_vm_execute.h:104
#9  0x0852be8a in zend_execute_scripts (type=8, tsrm_ls=0x8aab070, retval=0x0, file_count=3) at /home/charronp/php-dev/branches/PHP_5_3/Zend/zend.c:1194
#10 0x084a72a0 in php_execute_script (primary_file=0xbffff2d0, tsrm_ls=0x8aab070) at /home/charronp/php-dev/branches/PHP_5_3/main/main.c:2231
#11 0x08601d25 in main (argc=3, argv=0xbffff464) at /home/charronp/php-dev/branches/PHP_5_3/sapi/cli/php_cli.c:1190


Reproduce code:
---------------
<?php
ini_set('display_errors','1');
define('SOLR_SERVER_HOSTNAME', 'solr');
define('SOLR_SECURE', false);
define('SOLR_SERVER_PORT', ((SOLR_SECURE) ? 8443 : 8983));
define('SOLR_SERVER_TIMEOUT', 10);
$options = array(
        'hostname' => SOLR_SERVER_HOSTNAME,
        'port'     => SOLR_SERVER_PORT,
        'secure'   => SOLR_SECURE,
        'timeout'  => SOLR_SERVER_TIMEOUT,
        'path'     => '/solr/mycore'
        );
$client = new SolrClient($options);
$query = new SolrQuery('id:1');

$updateResponse = $client->query($query);
$response_array = $updateResponse->getResponse();
?>

And here is the received XML :

<?xml version="1.0" encoding="UTF-8"?>
<response>

<lst name="responseHeader">
 <int name="status">0</int>
 <int name="QTime">0</int>
 <lst name="params">
  <str name="indent">on</str>
  <str name="q">id:1 AND type:collection</str>
  <str name="wt">xml</str>
  <str name="version">2.2</str>
 </lst>
</lst>
<result name="response" numFound="1" start="0">
 <doc>
  <str name="body"/>
  <str name="classNameLabel">_LBL_COLLECTION</str>
  <str name="controllerName">collection</str>
  <str name="description"/>
  <str name="id">1</str>
  <str name="searchTitle">Accueil</str>
  <arr name="text"><str>1</str><str>collection</str><str>Accueil</str>
	<str/><str/></arr>
  <str name="title">Accueil</str>
  <str name="type">collection</str>
  <str name="uniqId">collection_1</str>
  <str name="url">/accueil</str>
 </doc>
</result>
</response>


Expected result:
----------------
No segfault

Actual result:
--------------
Segfault

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2009-11-22 23:12 UTC] iekpo@php.net
Segfault in solr_encode_string() during attempt to retrieve solrXmlNode->children->content when solrXmlNode->children is NULL.
 [2009-11-22 23:13 UTC] iekpo@php.net
This bug has been fixed in CVS.

In case this was a documentation problem, the fix will show up at the
end of next Sunday (CET) on pecl.php.net.

In case this was a pecl.php.net website problem, the change will show
up on the website in short time.
 
Thank you for the report, and for helping us make PECL better.

This has been fixed in SVN revision 291171
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun Dec 22 11:01:30 2024 UTC