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
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: grzegorz dot drozd at gmail dot com
New email:
PHP Version: OS:

 

 [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: Wed Apr 24 13:01:29 2024 UTC