Browse Source

[PHP-5.3-COMPAT] Backport r17164 to trunk

git-svn-id: http://framework.zend.com/svn/framework/standard/trunk@17165 44c647ce-9c0f-0410-b52a-842ac1e357ba
matthew 16 years ago
parent
commit
8ae8c01c5a
1 changed files with 17 additions and 10 deletions
  1. 17 10
      library/Zend/Search/Lucene.php

+ 17 - 10
library/Zend/Search/Lucene.php

@@ -952,6 +952,13 @@ class Zend_Search_Lucene implements Zend_Search_Lucene_Interface
             $fieldNames = $this->getFieldNames();
             $sortArgs   = array();
 
+            // PHP 5.3 now expects all arguments to array_multisort be passed by
+            // reference; since constants can't be passed by reference, create 
+            // some placeholder variables.
+            $sortReg    = SORT_REGULAR;
+            $sortAsc    = SORT_ASC;
+            $sortNum    = SORT_NUMERIC;
+
             require_once 'Zend/Search/Lucene/Exception.php';
             for ($count = 1; $count < count($argList); $count++) {
                 $fieldName = $argList[$count];
@@ -979,32 +986,32 @@ class Zend_Search_Lucene implements Zend_Search_Lucene_Interface
                     $valuesArray[] = $value;
                 }
 
-                $sortArgs[] = $valuesArray;
+                $sortArgs[] = &$valuesArray;
 
                 if ($count + 1 < count($argList)  &&  is_integer($argList[$count+1])) {
                     $count++;
-                    $sortArgs[] = $argList[$count];
+                    $sortArgs[] = &$argList[$count];
 
                     if ($count + 1 < count($argList)  &&  is_integer($argList[$count+1])) {
                         $count++;
-                        $sortArgs[] = $argList[$count];
+                        $sortArgs[] = &$argList[$count];
                     } else {
                         if ($argList[$count] == SORT_ASC  || $argList[$count] == SORT_DESC) {
-                            $sortArgs[] = SORT_REGULAR;
+                            $sortArgs[] = &$sortReg;
                         } else {
-                            $sortArgs[] = SORT_ASC;
+                            $sortArgs[] = &$sortAsc;
                         }
                     }
                 } else {
-                    $sortArgs[] = SORT_ASC;
-                    $sortArgs[] = SORT_REGULAR;
+                    $sortArgs[] = &$sortAsc;
+                    $sortArgs[] = &$sortReg;
                 }
             }
 
             // Sort by id's if values are equal
-            $sortArgs[] = $ids;
-            $sortArgs[] = SORT_ASC;
-            $sortArgs[] = SORT_NUMERIC;
+            $sortArgs[] = &$ids;
+            $sortArgs[] = &$sortAsc;
+            $sortArgs[] = &$sortNum;
 
             // Array to be sorted
             $sortArgs[] = &$hits;