felipe          Thu Feb 14 14:02:02 2008 UTC

  Modified files:              (Branch: PHP_5_2)
    /php-src/ext/standard       array.c 
    /php-src    NEWS 
  Log:
  Fixed Bug #42838 (Wrong results in array_diff_uassoc)
  
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/array.c?r1=1.308.2.21.2.51&r2=1.308.2.21.2.52&diff_format=u
Index: php-src/ext/standard/array.c
diff -u php-src/ext/standard/array.c:1.308.2.21.2.51 
php-src/ext/standard/array.c:1.308.2.21.2.52
--- php-src/ext/standard/array.c:1.308.2.21.2.51        Thu Feb 14 08:46:08 2008
+++ php-src/ext/standard/array.c        Thu Feb 14 14:02:02 2008
@@ -21,7 +21,7 @@
    +----------------------------------------------------------------------+
 */
 
-/* $Id: array.c,v 1.308.2.21.2.51 2008/02/14 08:46:08 dmitry Exp $ */
+/* $Id: array.c,v 1.308.2.21.2.52 2008/02/14 14:02:02 felipe Exp $ */
 
 #include "php.h"
 #include "php_ini.h"
@@ -3718,13 +3718,14 @@
                }
                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) {
@@ -3738,11 +3739,11 @@
                                                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_func_name) = args[arr_argc];
                                                }
-                                               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) {
http://cvs.php.net/viewvc.cgi/php-src/NEWS?r1=1.2027.2.547.2.1077&r2=1.2027.2.547.2.1078&diff_format=u
Index: php-src/NEWS
diff -u php-src/NEWS:1.2027.2.547.2.1077 php-src/NEWS:1.2027.2.547.2.1078
--- php-src/NEWS:1.2027.2.547.2.1077    Tue Feb 12 23:29:18 2008
+++ php-src/NEWS        Thu Feb 14 14:02:02 2008
@@ -98,6 +98,7 @@
 - Fixed bug #42937 (__call() method not invoked when methods are called on
   parent from child class). (Dmitry)
 - Fixed bug #42841 (REF CURSOR and oci_new_cursor() crash PHP). (Chris)
+- Fixed Bug #42838 (Wrong results in array_diff_uassoc) (Felipe)
 - Fixed bug #42779 (Incorrect forcing from HTTP/1.0 request to HTTP/1.1
   response). (Ilia)
 - Fixed bug #42736 (xmlrpc_server_call_method() crashes). (Tony)

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to