php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Return to Bug #67216
Patch SetGroupBy-params-bugfix revision 2014-05-06 12:56 UTC by saprykin dot dmitry at gmail dot com

Patch SetGroupBy-params-bugfix for sphinx Bug #67216

Patch version 2014-05-06 12:56 UTC

Return to Bug #67216 | Download this patch
Patch Revisions:

Developer: saprykin.dmitry@gmail.com

--- sphinx.c	2014-05-06 16:49:11.351156773 +0400
+++ sphinx.c.patched	2014-05-06 16:49:32.255157414 +0400
@@ -685,11 +685,19 @@
 	php_sphinx_client *c;
 	char *attribute, *groupsort = NULL;
 	int attribute_len, groupsort_len, func, res;
+	long func_param;
 
-	if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sl|s", &attribute, &attribute_len, &func, &groupsort, &groupsort_len) == FAILURE) {
+	if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sl|s", &attribute, &attribute_len, &func_param, &groupsort, &groupsort_len) == FAILURE) {
 		return;
 	}
 	
+	if( func_param >= SPH_GROUPBY_DAY && func_param <= SPH_GROUPBY_ATTRPAIR ) {
+	  func = func_param;
+	}
+	else {
+	  func = SPH_GROUPBY_DAY;
+	}
+
 	if (groupsort == NULL) {
 		groupsort = "@group desc";
 	}
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Apr 19 13:01:30 2024 UTC