php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #77727 Unable to extend client and change query method
Submitted: 2019-03-12 10:27 UTC Modified: -
Votes:1
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: grzegorz dot drozd at gmail dot com Assigned:
Status: Open Package: solr (PECL)
PHP Version: Irrelevant OS: Linux
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please — but make sure to vote on the bug!
Your email address:
MUST BE VALID
Solve the problem:
39 + 19 = ?
Subscribe to this entry?

 
 [2019-03-12 10:27 UTC] grzegorz dot drozd at gmail dot com
Description:
------------
Hi.

I am trying to add list of queries into some legacy system to see what is sent to solr server. I replaced all Client instances with my own instance. I am trying to change query method to inject some query statistics gathering. I think there is an issue with function declaration that prevents me from making it work.
I tried various combinations of method declaration:
\SolrParams $query
\SolrParams &$query

// this obviously does not work because it seeks for a class in current namespace
SolrParams $query
SolrParams &$query

use \SolrParams as SolrParams;
SolrParams $query
SolrParams &$query

Please fix function declaration.


Test script:
---------------
<?php 
namespace \Api\Solr;
class Client extends \SolrClient {

    public function __construct($options){
        $options['secure']=false;
        parent::__construct($options);
    }

    public function query(\SolrParams &$query){
        return parent::query($query);
    }
}


Expected result:
----------------
Ability to change query method.

Actual result:
--------------
Declaration of \Api\Solr\Client::query() should be compatible with & SolrClient::query(SolrParams &$query)

Patches

Add a Patch

Pull Requests

Add a Pull Request

 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Apr 25 10:01:29 2024 UTC