Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mod_fcgid: stderr: PHP Fatal error: Class name must be a valid object or a string #21

Closed
kw-pr opened this issue Mar 5, 2015 · 6 comments

Comments

@kw-pr
Copy link
Contributor

kw-pr commented Mar 5, 2015

If I am not in debug mode I get on /elasticsearch/search/?q=test

Notice: Undefined variable: dicParams in /httpdocs/app/code/community/Pocketphp/Elasticsearch/lib/Pocketphp/Elasticsearch/Common/DICBuilder.php on line 191

[Thu Mar 05 10:45:59 2015] [warn] [client 79.238.69.171] mod_fcgid: stderr: PHP Fatal error: Class name must be a valid object or a string in /httpdocs/app/code/community/Pocketphp/Elasticsearch/lib/Pocketphp/Elasticsearch/Common/DICBuilder.php on line 192

In debug mode it works. Any idea why?

@ctasca
Copy link
Owner

ctasca commented Mar 5, 2015

What version of PHP?

@kw-pr
Copy link
Contributor Author

kw-pr commented Mar 5, 2015

PHP 5.3.3
I think the problem is that $dicParams is empty. I did not find where it is filled...

@ctasca
Copy link
Owner

ctasca commented Mar 5, 2015

In what context you get this error?

@kw-pr
Copy link
Contributor Author

kw-pr commented Mar 5, 2015

This is the backtrace:

#0  Elasticsearch\Common\{closure}(Array ([scheme] => http,[host] => 127.0.0.1,[port] => 9200)) called at [/httpdocs/app/code/community/Pocketphp/Elasticsearch/lib/Pocketphp/Elasticsearch/Transport.php:236]
#1  Elasticsearch\Transport->hostsToConnections(Array ([0] => Array ([scheme] => http,[host] => 127.0.0.1,[port] => 9200))) called at [/httpdocs/app/code/community/Pocketphp/Elasticsearch/lib/Pocketphp/Elasticsearch/Transport.php:107]
#2  Elasticsearch\Transport->setConnections(Array ([0] => Array ([scheme] => http,[host] => 127.0.0.1,[port] => 9200))) called at [/httpdocs/app/code/community/Pocketphp/Elasticsearch/lib/Pocketphp/Elasticsearch/Transport.php:81]
#3  Elasticsearch\Transport->__construct(Array ([0] => Array ([scheme] => http,[host] => 127.0.0.1,[port] => 9200)), Elasticsearch\Pimple Object ([] => Array ([connectionClass] => \Elasticsearch\Connections\GuzzleConnection,[connectionFactoryClass] => \Elasticsearch\Connections\ConnectionFactory,[connectionPoolClass] => \Elasticsearch\ConnectionPool\StaticNoPingConnectionPool,[selectorClass] => \Elasticsearch\ConnectionPool\Selectors\RoundRobinSelector,[serializerClass] => \Elasticsearch\Serializers\SmartSerializer,[sniffOnStart] => ,[connectionParams] => Array (),[logging] => ,[logObject] => Elasticsearch\Common\EmptyLogger Object (),[logPath] => elasticsearch.log,[logLevel] => warning,[traceObject] => Elasticsearch\Common\EmptyLogger Object (),[tracePath] => elasticsearch.log,[traceLevel] => warning,[guzzleOptions] => Array (),[connectionPoolParams] => Array ([randomizeHosts] => 1),[retries] => ,[connection] => Closure Object (),[connectionFactory] => Closure Object (),[selector] => Closure Object (),[serializer] => Closure Object (),[connectionPool] => Closure Object (),[transport] => Closure Object (),[clusterNamespace] => Closure Object (),[indicesNamespace] => Closure Object (),[nodesNamespace] => Closure Object (),[catNamespace] => Closure Object (),[snapshotNamespace] => Closure Object (),[connectionParamsShared] => Closure Object (),[curlMultiHandle] => Closure Object (),[guzzleClient] => Closure Object (),[endpoint] => Closure Object ())), Elasticsearch\Common\EmptyLogger Object ()) called at [/httpdocs/app/code/community/Pocketphp/Elasticsearch/lib/Pocketphp/Elasticsearch/Common/DICBuilder.php:258]
#4  Elasticsearch\Common\{closure}(Elasticsearch\Pimple Object ([] => Array ([connectionClass] => \Elasticsearch\Connections\GuzzleConnection,[connectionFactoryClass] => \Elasticsearch\Connections\ConnectionFactory,[connectionPoolClass] => \Elasticsearch\ConnectionPool\StaticNoPingConnectionPool,[selectorClass] => \Elasticsearch\ConnectionPool\Selectors\RoundRobinSelector,[serializerClass] => \Elasticsearch\Serializers\SmartSerializer,[sniffOnStart] => ,[connectionParams] => Array (),[logging] => ,[logObject] => Elasticsearch\Common\EmptyLogger Object (),[logPath] => elasticsearch.log,[logLevel] => warning,[traceObject] => Elasticsearch\Common\EmptyLogger Object (),[tracePath] => elasticsearch.log,[traceLevel] => warning,[guzzleOptions] => Array (),[connectionPoolParams] => Array ([randomizeHosts] => 1),[retries] => ,[connection] => Closure Object (),[connectionFactory] => Closure Object (),[selector] => Closure Object (),[serializer] => Closure Object (),[connectionPool] => Closure Object (),[transport] => Closure Object (),[clusterNamespace] => Closure Object (),[indicesNamespace] => Closure Object (),[nodesNamespace] => Closure Object (),[catNamespace] => Closure Object (),[snapshotNamespace] => Closure Object (),[connectionParamsShared] => Closure Object (),[curlMultiHandle] => Closure Object (),[guzzleClient] => Closure Object (),[endpoint] => Closure Object ()))) called at [/httpdocs/app/code/community/Pocketphp/Elasticsearch/lib/Pocketphp/Elasticsearch/Pimple.php:126]
#5  Elasticsearch\{closure}(Elasticsearch\Pimple Object ([] => Array ([connectionClass] => \Elasticsearch\Connections\GuzzleConnection,[connectionFactoryClass] => \Elasticsearch\Connections\ConnectionFactory,[connectionPoolClass] => \Elasticsearch\ConnectionPool\StaticNoPingConnectionPool,[selectorClass] => \Elasticsearch\ConnectionPool\Selectors\RoundRobinSelector,[serializerClass] => \Elasticsearch\Serializers\SmartSerializer,[sniffOnStart] => ,[connectionParams] => Array (),[logging] => ,[logObject] => Elasticsearch\Common\EmptyLogger Object (),[logPath] => elasticsearch.log,[logLevel] => warning,[traceObject] => Elasticsearch\Common\EmptyLogger Object (),[tracePath] => elasticsearch.log,[traceLevel] => warning,[guzzleOptions] => Array (),[connectionPoolParams] => Array ([randomizeHosts] => 1),[retries] => ,[connection] => Closure Object (),[connectionFactory] => Closure Object (),[selector] => Closure Object (),[serializer] => Closure Object (),[connectionPool] => Closure Object (),[transport] => Closure Object (),[clusterNamespace] => Closure Object (),[indicesNamespace] => Closure Object (),[nodesNamespace] => Closure Object (),[catNamespace] => Closure Object (),[snapshotNamespace] => Closure Object (),[connectionParamsShared] => Closure Object (),[curlMultiHandle] => Closure Object (),[guzzleClient] => Closure Object (),[endpoint] => Closure Object ()))) called at [/httpdocs/app/code/community/Pocketphp/Elasticsearch/lib/Pocketphp/Elasticsearch/Pimple.php:83]
#6  Elasticsearch\Pimple->offsetGet(transport) called at [/httpdocs/app/code/community/Pocketphp/Elasticsearch/lib/Pocketphp/Elasticsearch/Client.php:86]
#7  Elasticsearch\Client->__construct(Array ([hosts] => Array ([0] => 127.0.0.1:9200))) called at [/httpdocs/app/code/community/Pocketphp/Elasticsearch/Model/Client.php:64]
#8  Pocketphp_Elasticsearch_Model_Client->connect() called at [/httpdocs/app/code/community/Pocketphp/Elasticsearch/Helper/Data.php:87]
#9  Pocketphp_Elasticsearch_Helper_Data->isActiveEngine() called at [/httpdocs/app/code/community/Pocketphp/Elasticsearch/Block/Catalogsearch/Layer.php:65]
#10 Pocketphp_Elasticsearch_Block_Catalogsearch_Layer->_initBlocks() called at [/httpdocs/app/code/core/Mage/Catalog/Block/Layer/View.php:78]
#11 Mage_Catalog_Block_Layer_View->_construct() called at [/httpdocs/app/code/core/Mage/CatalogSearch/Block/Layer.php:38]
#12 Mage_CatalogSearch_Block_Layer->_construct() called at [/httpdocs/lib/Varien/Object.php:112]
#13 Varien_Object->__construct(Array ()) called at [/httpdocs/app/code/core/Mage/Core/Model/Layout.php:491]
#14 Mage_Core_Model_Layout->_getBlockInstance(catalogsearch/layer, Array ()) called at [/httpdocs/app/code/core/Mage/Core/Model/Layout.php:437]
#15 Mage_Core_Model_Layout->createBlock(catalogsearch/layer, catalogsearch.leftnav) called at [/httpdocs/app/code/core/Mage/Core/Model/Layout.php:472]
#16 Mage_Core_Model_Layout->addBlock(catalogsearch/layer, catalogsearch.leftnav) called at [/httpdocs/app/code/core/Mage/Core/Model/Layout.php:239]
#17 Mage_Core_Model_Layout->_generateBlock(Mage_Core_Model_Layout_Element Object ([@attributes] => Array ([type] => catalogsearch/layer,[name] => catalogsearch.leftnav,[after] => currency,[template] => catalog/layer/view.phtml)), Mage_Core_Model_Layout_Element Object ([@attributes] => Array ([name] => left),[block] => Mage_Core_Model_Layout_Element Object ([@attributes] => Array ([type] => catalogsearch/layer,[name] => catalogsearch.leftnav,[after] => currency,[template] => catalog/layer/view.phtml)))) called at [/httpdocs/app/code/core/Mage/Core/Model/Layout.php:205]
#18 Mage_Core_Model_Layout->generateBlocks(Mage_Core_Model_Layout_Element Object ([@attributes] => Array ([name] => left),[block] => Mage_Core_Model_Layout_Element Object ([@attributes] => Array ([type] => catalogsearch/layer,[name] => catalogsearch.leftnav,[after] => currency,[template] => catalog/layer/view.phtml)))) called at [/httpdocs/app/code/core/Mage/Core/Model/Layout.php:210]
#19 Mage_Core_Model_Layout->generateBlocks() called at [/httpdocs/app/code/core/Mage/Core/Controller/Varien/Action.php:344]
#20 Mage_Core_Controller_Varien_Action->generateLayoutBlocks() called at [/httpdocs/app/code/core/Mage/Core/Controller/Varien/Action.php:269]
#21 Mage_Core_Controller_Varien_Action->loadLayout() called at [/httpdocs/app/code/core/Mage/CatalogSearch/controllers/ResultController.php:77]
#22 Mage_CatalogSearch_ResultController->indexAction() called at [/httpdocs/app/code/core/Mage/Core/Controller/Varien/Action.php:419]
#23 Mage_Core_Controller_Varien_Action->dispatch(index) called at [/httpdocs/app/code/core/Mage/Core/Controller/Varien/Router/Standard.php:250]
#24 Mage_Core_Controller_Varien_Router_Standard->match(Mage_Core_Controller_Request_Http Object ([] => /catalogsearch/result/,[] => ,[] => /catalogsearch/result/,[] => ,[] => ,[] => Array (),[] => catalogsearch,[] => Array ([api] => ,[xmlconnect] => ),[] => Mage_CatalogSearch,[] => ,[] => Array (),[] => Array ([0] => _GET,[1] => _POST),[] => /catalogsearch/result/?q=test,[] => ,[] => ,[] => /catalogsearch/result/,[] => Array (),[] => ,[] => Array (),[] => 1,[] => catalogsearch,[] => module,[] => result,[] => controller,[] => index,[] => action)) called at [/httpdocs/app/code/core/Mage/Core/Controller/Varien/Front.php:176]
#25 Mage_Core_Controller_Varien_Front->dispatch() called at [/httpdocs/app/code/core/Mage/Core/Model/App.php:354]
#26 Mage_Core_Model_App->run(Array ([scope_code] => ,[scope_type] => store,[options] => Array ())) called at [/httpdocs/app/Mage.php:683]
#27 Mage::run(, store) called at [/httpdocs/index.php:92]

I think this is the problem:

private function setConnectionObj()
{
        $this->dic['connection'] = function ($dicParams) {
            // $dicParams filled
            return function ($hostDetails) use ($dicParams) {
            // $dicParams == NULL

Strange, this works:

$a = function ($dicParams) {
    return function ($hostDetails) use ($dicParams) {
        echo $dicParams;
    };
};

$b = $a("1");
$b(2);

I can work around this by passing $dicParams from Transport but more problems are coming up.

What PHP version do you use?

@Ig0r-M-magic42
Copy link

@kw-pr if you close an issue could you post motive for closing it.

@kw-pr
Copy link
Contributor Author

kw-pr commented Mar 29, 2017

@Ig0r-M You are right. I closed it because I didn't need a solution for this anymore. I think I switched to an older version of elasticsearch and used the closed source module I already had in the shop. I guess that is not helping anyone but you never know...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants