php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #77201 SolrDisMaxQuery generates invalid query field specification
Submitted: 2018-11-26 03:21 UTC Modified: -
From: le dot concorde dot 4590 at gmail dot com Assigned:
Status: Open Package: solr (PECL)
PHP Version: 7.2.12 OS: openSUSE Leap 15.0
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: le dot concorde dot 4590 at gmail dot com
New email:
PHP Version: OS:

 

 [2018-11-26 03:21 UTC] le dot concorde dot 4590 at gmail dot com
Description:
------------
Running the test script while capturing the network traffic or running strace will show a trailing \x00 in the query field specifier sent to the Solr server.

This is reproducible on current git master, bisecting points to the following commit:

commit b1b44e0a22bcce8f625707248d0b4d3630935359
Author: Omar Shaban <omars@php.net>
Date:   Fri Nov 4 13:09:15 2016 +0100

    Fixes Bug #72740: addQueryField return wrong query


Test script:
---------------
<?php
$client = new \SolrClient(['hostname' => '127.0.0.1', 'port' => 8983, 'path' => '/solr/foo']);
$query = new \SolrDisMaxQuery();
$query->setQuery('foo');
$query->addQueryField('foo');
$r = $client->query($query);


Expected result:
----------------
POST /solr/foo/select/?version=2.2&indent=on&wt=xml HTTP/1.1
Host: 127.0.0.1:8983
User-Agent: PHP Solr Client 2.4.0
Accept: */*
Accept-Encoding: deflate, gzip
Accept-Charset: utf-8
Keep-Alive: 300
Connection: keep-alive
Content-Type: application/x-www-form-urlencoded;charset=UTF-8
Content-Length: 31

defType=edismax&q=foo&qf=foo

Actual result:
--------------
POST /solr/foo/select/?version=2.2&indent=on&wt=xml HTTP/1.1
Host: 127.0.0.1:8983
User-Agent: PHP Solr Client 2.4.0
Accept: */*
Accept-Encoding: deflate, gzip
Accept-Charset: utf-8
Keep-Alive: 300
Connection: keep-alive
Content-Type: application/x-www-form-urlencoded;charset=UTF-8
Content-Length: 31

defType=edismax&q=foo&qf=foo%00

Patches

Add a Patch

Pull Requests

Add a Pull Request

 
PHP Copyright © 2001-2018 The PHP Group
All rights reserved.
Last updated: Thu Dec 13 09:01:26 2018 UTC