php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Return to Bug #62985
Patch bug62985.patch revision 2012-08-31 17:29 UTC by laruence@php.net
revision 2012-08-31 17:25 UTC by laruence@php.net

Patch bug62985.patch for *Configuration Issues Bug #62985

Patch version 2012-08-31 17:25 UTC

Return to Bug #62985 | Download this patch
This patch is obsolete

Obsoleted by patches:

Patch Revisions:

Developer: laruence@php.net

diff --git a/Zend/zend_execute_API.c b/Zend/zend_execute_API.c
index 1deee2a..cc3c397 100644
--- a/Zend/zend_execute_API.c
+++ b/Zend/zend_execute_API.c
@@ -1244,8 +1244,30 @@ ZEND_API int zend_eval_stringl_ex(char *str, int str_len, zval *retval_ptr, char
 	int result;
 
 	result = zend_eval_stringl(str, str_len, retval_ptr, string_name TSRMLS_CC);
-	if (handle_exceptions && EG(exception)) {
-		zend_exception_error(EG(exception), E_ERROR TSRMLS_CC);
+    if (handle_exceptions && EG(exception)) {
+        if (EG(user_exception_handler)) {
+            zval *orig_user_exception_handler;
+            zval **params[1], *retval2, *old_exception;
+            old_exception = EG(exception);
+            EG(exception) = NULL;
+            params[0] = &old_exception;
+            orig_user_exception_handler = EG(user_exception_handler);
+            if (call_user_function_ex(CG(function_table), NULL, orig_user_exception_handler, &retval2, 1, params, 1, NULL TSRMLS_CC) == SUCCESS) {
+                if (retval2 != NULL) {
+                    zval_ptr_dtor(&retval2);
+                }
+                if (EG(exception)) {
+                    zval_ptr_dtor(&EG(exception));
+                    EG(exception) = NULL;
+                }
+                zval_ptr_dtor(&old_exception);
+            } else {
+                EG(exception) = old_exception;
+                zend_exception_error(EG(exception), E_ERROR TSRMLS_CC);
+            }
+        } else {
+            zend_exception_error(EG(exception), E_ERROR TSRMLS_CC);
+        }
 		result = FAILURE;
 	}
 	return result;
diff --git a/ext/standard/array.c b/ext/standard/array.c
index 94c5e7e..3c8c5df 100644
--- a/ext/standard/array.c
+++ b/ext/standard/array.c
@@ -396,6 +396,28 @@ static int php_array_data_compare(const void *a, const void *b TSRMLS_DC) /* {{{
 }
 /* }}} */
 
+static int php_array_data_sort_compare(const void *a, const void *b TSRMLS_DC) /* {{{ */ {
+	Bucket *f;
+	Bucket *s;
+	zval *first;
+	zval *second;
+
+	f = *((Bucket **) a);
+	s = *((Bucket **) b);
+
+	first = *((zval **) f->pData);
+	second = *((zval **) s->pData);
+
+	if (Z_TYPE_P(first) == IS_OBJECT && Z_TYPE_P(second) == IS_OBJECT) {
+		if (Z_OBJCE_P(first) == Z_OBJCE_P(second)) {
+			return 0;
+		}
+	}
+
+	return php_array_data_compare(a, b TSRMLS_CC);
+}
+/* }}} */
+
 static int php_array_reverse_data_compare(const void *a, const void *b TSRMLS_DC) /* {{{ */
 {
 	return php_array_data_compare(a, b TSRMLS_CC) * -1;
@@ -2810,7 +2832,7 @@ PHP_FUNCTION(array_unique)
 		arTmp[i].i = i;
 	}
 	arTmp[i].b = NULL;
-	zend_qsort((void *) arTmp, i, sizeof(struct bucketindex), php_array_data_compare TSRMLS_CC);
+	zend_qsort((void *) arTmp, i, sizeof(struct bucketindex), php_array_data_sort_compare TSRMLS_CC);
 
 	/* go through the sorted array and delete duplicates from the copy */
 	lastkept = arTmp;
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Apr 19 15:01:28 2024 UTC