diff options
| author | Felipe Pena <felipe@php.net> | 2008-02-14 14:08:22 +0000 |
|---|---|---|
| committer | Felipe Pena <felipe@php.net> | 2008-02-14 14:08:22 +0000 |
| commit | aefe0569114815205aa8f7b36f68b85c68732146 (patch) | |
| tree | 96400280f841059ac9df48ddb2684341ffee0bcf /ext/standard/array.c | |
| parent | fcb243f6e70f8d71c2e32796defca0532d9d21d4 (diff) | |
| download | php-git-aefe0569114815205aa8f7b36f68b85c68732146.tar.gz | |
MFB: Fixed Bug #42838 (Wrong results in array_diff_uassoc)
Diffstat (limited to 'ext/standard/array.c')
| -rw-r--r-- | ext/standard/array.c | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/ext/standard/array.c b/ext/standard/array.c index f13aef92c6..57ead02d0e 100644 --- a/ext/standard/array.c +++ b/ext/standard/array.c @@ -3442,13 +3442,14 @@ static void php_array_diff(INTERNAL_FUNCTION_PARAMETERS, int behavior, int data_ } c = 1; for (i = 1; i < arr_argc; i++) { + Bucket **ptr = ptrs[i]; if (behavior == DIFF_NORMAL) { - while (*ptrs[i] && (0 < (c = diff_data_compare_func(ptrs[0], ptrs[i] TSRMLS_CC)))) { - ptrs[i]++; + while (*ptr && (0 < (c = diff_data_compare_func(ptrs[0], ptr TSRMLS_CC)))) { + ptr++; } } else if (behavior & DIFF_ASSOC) { /* triggered also when DIFF_KEY */ - while (*ptrs[i] && (0 < (c = diff_key_compare_func(ptrs[0], ptrs[i] TSRMLS_CC)))) { - ptrs[i]++; + while (*ptr && (0 != (c = diff_key_compare_func(ptrs[0], ptr TSRMLS_CC)))) { + ptr++; } } if (!c) { @@ -3460,12 +3461,12 @@ static void php_array_diff(INTERNAL_FUNCTION_PARAMETERS, int behavior, int data_ } else if (behavior == DIFF_ASSOC) { /* only when DIFF_ASSOC */ /* In this branch is execute only when DIFF_ASSOC. If behavior == DIFF_KEY * data comparison is not needed - skipped. */ - if (*ptrs[i]) { + if (*ptr) { if (data_compare_type == DIFF_COMP_DATA_USER) { BG(user_compare_fci) = *fci_data; BG(user_compare_fci_cache) = *fci_data_cache; } - if (diff_data_compare_func(ptrs[0], ptrs[i] TSRMLS_CC) != 0) { + if (diff_data_compare_func(ptrs[0], ptr TSRMLS_CC) != 0) { /* the data is not the same */ c = -1; if (key_compare_type == DIFF_COMP_KEY_USER) { |
