Uploaded image for project: 'Solr'
  1. Solr
  2. SOLR-892

PHPResponseWriter fails to serialize boolean vars for spellcheck output

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 1.3
    • 1.4
    • None
    • Solr nightly 2008-11-25, example configuration, Jetty container

    Description

      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:

      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;".

      Attachments

        1. SOLR-892.patch
          0.7 kB
          Yonik Seeley

        Activity

          People

            yseeley@gmail.com Yonik Seeley
            sbgt Steffen Baumgart
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: