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: 2020-06-28 07:59 UTC
From: le dot concorde dot 4590 at gmail dot com Assigned: omars (profile)
Status: Assigned Package: solr (PECL)
PHP Version: 7.2.12 OS: openSUSE Leap 15.0
Private report: No CVE-ID: None
 [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

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2020-06-28 07:59 UTC] omars@php.net
-Assigned To: +Assigned To: omars
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Dec 07 22:01:27 2024 UTC