com php-src: fix array related compare functions: ext/standard/array.c
| From: | Anatol Belski | Date: | Sat, 09 Nov 2013 09:30:55 +0000 |
| Subject: | com php-src: fix array related compare functions: ext/standard/array.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-73909@lists.php.net to get a copy of this message | ||
Commit: c58f9eea11da6ef166275b0dac60cf11e406aeb8
Author: Anatol Belski <ab@php.net> Sat, 9 Nov 2013 10:30:55 +0100
Parents: c2e228b77dcd015a2fc7679d6e62044100e66ce0
Branches: str_size_and_int64
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=c58f9eea11da6ef166275b0dac60cf11e406aeb8
Log:
fix array related compare functions
Changed paths:
M ext/standard/array.c
Diff:
diff --git a/ext/standard/array.c b/ext/standard/array.c
index 4363e31..1774e1e 100644
--- a/ext/standard/array.c
+++ b/ext/standard/array.c
@@ -592,7 +592,7 @@ static int php_array_user_compare(const void *a, const void *b TSRMLS_DC) /* {{{
BG(user_compare_fci).retval_ptr_ptr = &retval_ptr;
BG(user_compare_fci).no_separation = 0;
if (zend_call_function(&BG(user_compare_fci), &BG(user_compare_fci_cache) TSRMLS_CC) ==
SUCCESS && retval_ptr) {
- long retval;
+ php_int_t retval;
convert_to_long_ex(&retval_ptr);
retval = Z_LVAL_P(retval_ptr);
@@ -726,7 +726,7 @@ static int php_array_user_key_compare(const void *a, const void *b TSRMLS_DC) /*
zval *key1, *key2;
zval **args[2];
zval *retval_ptr = NULL;
- long result;
+ int result;
ALLOC_INIT_ZVAL(key1);
ALLOC_INIT_ZVAL(key2);
@@ -759,7 +759,7 @@ static int php_array_user_key_compare(const void *a, const void *b TSRMLS_DC) /*
BG(user_compare_fci).no_separation = 0;
if (zend_call_function(&BG(user_compare_fci), &BG(user_compare_fci_cache) TSRMLS_CC) ==
SUCCESS && retval_ptr) {
convert_to_long_ex(&retval_ptr);
- result = Z_LVAL_P(retval_ptr);
+ result = Z_LVAL_P(retval_ptr) < 0 ? -1 : Z_LVAL_P(retval_ptr) > 0 ? 1 : 0;
zval_ptr_dtor(&retval_ptr);
} else {
result = 0;