PHPResponseWriter fails to serialize boolean vars for spellcheck output
-----------------------------------------------------------------------

                 Key: SOLR-892
                 URL: https://issues.apache.org/jira/browse/SOLR-892
             Project: Solr
          Issue Type: Bug
          Components: clients - php, search, spellchecker
    Affects Versions: 1.3
         Environment: Solr nightly 2008-11-25, example configuration, Jetty 
container
            Reporter: Steffen Baumgart


When using org.apache.solr.request.PHPSerializedResponseWriter as the 
queryResponseWriter, search results that contain spellcheck-fields are 
incorrectly serialized and can't be properly deserialized by PHP 5. Example 
error:
Notice: unserialize() [function.unserialize]: Error at offset 305 of 312 bytes 
in /Solr/Client.php on line 131 

How to reproduce:
- open the example solrconfig.xml 
(apache-solr-nightly/example/solr/conf/solrconfig.xml)
- uncomment the PHPSerializedResponseWriter, around line 733
- start the Jetty container
- index all the example documents from exampledocs/
- open this URL: 
http://localhost:8983/solr/spellCheckCompRH?cmd=&q=ipod&spellcheck=true&spellcheck.extendedResults=true&spellcheck.onlyMorePopular=true&wt=phps

At the very end of the serialized array you will see this:
> s:10:"spellcheck";a:1:{s:11:"suggestions";a:1:{s:16:"correctlySpelled";true}}}
>  

When you serialize a similar array in PHP, you get this:
echo 
serialize(array("spellcheck"=>array("suggestions"=>array("correctlySpelled"=>true))));
> a:1:{s:10:"spellcheck";a:1:{s:11:"suggestions";a:1:{s:16:"correctlySpelled";b:1;}}}
>  

So it seems to be, that the PHPResponseWriter doesn't recognize "true" to be a 
boolean var and prints it directly, instead of transforming it to "b:1;".

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to