Zend Framework

Wrongly used call_user_func_array

Details

  • Type: Bug Bug
  • Status: Reopened Reopened
  • Priority: Major Major
  • Resolution: Unresolved
  • Affects Version/s: 1.7.1
  • Fix Version/s: None
  • Component/s: Zend_Search_Lucene
  • Labels:
    None

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

Issue Links

Activity

Hide
Derick Rethans added a comment -

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

Show
Derick Rethans added a comment - 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
Hide
Alexander Veremyev added a comment -

Already fixed with 17165

Show
Alexander Veremyev added a comment - Already fixed with 17165
Hide
Kore Nordmann added a comment -

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}

Show
Kore Nordmann added a comment - 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}
Hide
Benjamin Eberlei added a comment -

Reopened due to request by koredn

Show
Benjamin Eberlei added a comment - Reopened due to request by koredn
Hide
Kore Nordmann added a comment -

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:

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.

Show
Kore Nordmann added a comment - 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:
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.

People

Vote (0)
Watch (0)

Dates

  • Created:
    Updated: