Issues

ZF-7081: Wrongly used call_user_func_array

Issue Type: Bug Created: 2009-06-22T04:02:40.000+0000 Last Updated: 2012-11-20T21:37:23.000+0000 Status: Reopened Fix version(s): Reporter: Derick Rethans (derick) Assignee: None Tags: - Zend_Search_Lucene

Related issues: - ZF-2529

Attachments:

Description

PHP Warning: Parameter 1 to array_multisort() expected to be a reference, value given in /home/derick/dev/ZendFramework-1.7.7-minimal/library/Zend/Search/Lucene.php on line 1018 PHP Stack trace: PHP 1. {main}() /home/derick/dev/ezcomponents/trunk/UnitTest/src/runtests.php:0 PHP 2. ezcTestRunner::main() /home/derick/dev/ezcomponents/trunk/UnitTest/src/runtests.php:16 PHP 3. ezcTestRunner->runFromArguments() /home/derick/dev/ezcomponents/trunk/UnitTest/src/test/runner.php:37 PHP 4. PHPUnit_TextUI_TestRunner->doRun() /home/derick/dev/ezcomponents/trunk/UnitTest/src/test/runner.php:221 PHP 5. PHPUnit_Framework_TestSuite->run() /usr/local/lib/php/PHPUnit/TextUI/TestRunner.php:348 PHP 6. PHPUnit_Framework_TestSuite->run() /usr/local/lib/php/PHPUnit/Framework/TestSuite.php:639 PHP 7. PHPUnit_Framework_TestSuite->run() /usr/local/lib/php/PHPUnit/Framework/TestSuite.php:639 PHP 8. PHPUnit_Framework_TestSuite->runTest() /usr/local/lib/php/PHPUnit/Framework/TestSuite.php:678 PHP 9. PHPUnit_Framework_TestCase->run() /usr/local/lib/php/PHPUnit/Framework/TestSuite.php:701 PHP 10. PHPUnit_Framework_TestResult->run() /usr/local/lib/php/PHPUnit/Framework/TestCase.php:629 PHP 11. PHPUnit_Framework_TestCase->runBare() /usr/local/lib/php/PHPUnit/Framework/TestResult.php:666 PHP 12. PHPUnit_Framework_TestCase->runTest() /usr/local/lib/php/PHPUnit/Framework/TestCase.php:676 PHP 13. ReflectionMethod->invokeArgs() /usr/local/lib/php/PHPUnit/Framework/TestCase.php:783 PHP 14. ezcSearchHandlerZendLuceneTest->testCreateFindQueryOrderByDesc() /home/derick/dev/ezcomponents/trunk/Search/tests/handlers/zend_lucene_test.php:0 PHP 15. ezcSearchSession->find() /home/derick/dev/ezcomponents/trunk/Search/tests/handlers/zend_lucene_test.php:480 PHP 16. ezcSearchZendLuceneHandler->find() /home/derick/dev/ezcomponents/trunk/Search/src/search_session.php:70 PHP 17. ezcSearchZendLuceneHandler->search() /home/derick/dev/ezcomponents/trunk/Search/src/handlers/zend_lucene.php:234 PHP 18. call_user_func_array() /home/derick/dev/ezcomponents/trunk/Search/src/handlers/zend_lucene.php:179 PHP 19. Zend_Search_Lucene_Proxy->find() /home/derick/dev/ezcomponents/trunk/Search/src/handlers/zend_lucene.php:0 PHP 20. call_user_func_array() /home/derick/dev/ZendFramework-1.7.7-minimal/library/Zend/Search/Lucene/Proxy.php:345 PHP 21. Zend_Search_Lucene->find() /home/derick/dev/ZendFramework-1.7.7-minimal/library/Zend/Search/Lucene/Proxy.php:0 PHP 22. call_user_func_array() /home/derick/dev/ZendFramework-1.7.7-minimal/library/Zend/Search/Lucene.php:1018

Comments

Posted by Derick Rethans (derick) on 2009-08-26T03:02:19.000+0000

Actually, this bug makes sorting not work at all. It used to sort decrementally just fine with PHP 5.2, but no longer with PHP 5.3. This is related to bugs:

http://bugs.php.net/bug.php?edit=1&id=49069 http://bugs.php.net/bug.php?id=43568

Posted by Alexander Veremyev (alexander) on 2009-08-27T06:39:25.000+0000

Already fixed with 17165

Posted by Kore Nordmann (kore) on 2009-11-25T01:05:37.000+0000

I still get the same error with trunk, revision 19229.

exception 'arbitPhpErrorException' with message 'A PHP error occured: Warning: Parameter 1 to array_multisort() expected to be a reference, value given' in /home/kore/devel/arbit/trunk/src/libraries/Zend/Search/Lucene.php:1045 Stack trace:

0 [internal function]: arbitErrorHandler(2, 'Parameter 1 to ...', '/home/kore/deve...', 1045, Array)

1 /home/kore/devel/arbit/trunk/src/libraries/Zend/Search/Lucene.php(1045): call_user_func_array('array_multisort', Array)

2 [internal function]: Zend_Search_Lucene->find('ezcsearch_type:...', 'issue', 0, 3)

3 /home/kore/devel/arbit/trunk/src/libraries/Zend/Search/Lucene/Proxy.php(346): call_user_func_array(Array, Array)

4 [internal function]: Zend_Search_Lucene_Proxy->find('ezcsearch_type:...', 'issue', 0, 3)

5 /home/kore/devel/arbit/trunk/src/libraries/ezc/search/handlers/zend_lucene.php(199): call_user_func_array(Array, Array)

6 /home/kore/devel/arbit/trunk/src/libraries/ezc/search/handlers/zend_lucene.php(254): ezcSearchZendLuceneHandler->search('ezcsearch_type:...', Array, Array)

7 /home/kore/devel/arbit/trunk/src/libraries/ezc/search/search_session.php(70): ezcSearchZendLuceneHandler->find(Object(ezcSearchQueryZendLucene))

8 /home/kore/devel/arbit/trunk/src/modules/tracker/classes/controller.php(385): ezcSearchSession->find(Object(ezcSearchQueryZendLucene))

9 /home/kore/devel/arbit/trunk/src/classes/controller/project.php(70): arbitModuleTrackerController->report(Object(arbitHttpRequest))

10 /home/kore/devel/arbit/trunk/src/classes/controller/project.php(188): arbitProjectController->callModuleController('issue_tracker', Object(arbitHttpRequest))

11 /home/kore/devel/arbit/trunk/src/libraries/ezc/mvc/dispatchers/configurable.php(255): arbitProjectController->createResult()

12 /home/kore/devel/arbit/trunk/src/htdocs/index.php(74): ezcMvcConfigurableDispatcher->run()

13 {main}

Posted by Benjamin Eberlei (beberlei) on 2009-11-25T11:05:36.000+0000

Reopened due to request by koredn

Posted by Kore Nordmann (kore) on 2010-01-12T13:18:42.000+0000

The unset($valuesArray); in line 1013 causes the $sortArray to not contain a reference any more, but the actual variable content.

If the refCount drops to 1 isref is set to 0 in the ZVal.

Example code:

<pre class="highlight">
kore@kore src $ cat test.php 
<?php

$array = array( 1 );

$reference[] = &$array;
var_dump( $reference );

unset( $array );
var_dump( $reference );

kore@kore src $ php test.php 
array(1) {
  [0]=>
  &array(1) {
    [0]=>
    int(1)
  }
}
array(1) {
  [0]=>
  array(1) {
    [0]=>
    int(1)
  }
}

The missing ampersand in the second paste is the important part. The fix is to just remove the unset() call.

Have you found an issue?

See the Overview section for more details.

Copyright

© 2006-2016 by Zend, a Rogue Wave Company. Made with by awesome contributors.

This website is built using zend-expressive and it runs on PHP 7.

Contacts