{
zval *array;
zend_refcounted *arr;
+ zend_bool retval;
PHP_ARRAY_CMP_FUNC_VARS;
PHP_ARRAY_CMP_FUNC_BACKUP();
Z_ADDREF_P(array);
arr = Z_COUNTED_P(array);
- if (zend_hash_sort(Z_ARRVAL_P(array), php_array_user_compare, 1) == FAILURE) {
- RETVAL_FALSE;
- } else {
- if (arr != Z_COUNTED_P(array)) {
- php_error_docref(NULL, E_WARNING, "Array was modified by the user comparison function");
- if (--GC_REFCOUNT(arr) <= 0) {
- _zval_dtor_func(arr ZEND_FILE_LINE_CC);
- }
- RETVAL_FALSE;
- } else {
- Z_DELREF_P(array);
- RETVAL_TRUE;
+ retval = zend_hash_sort(Z_ARRVAL_P(array), php_array_user_compare, 1) != FAILURE;
+
+ if (arr != Z_COUNTED_P(array)) {
+ php_error_docref(NULL, E_WARNING, "Array was modified by the user comparison function");
+ if (--GC_REFCOUNT(arr) <= 0) {
+ _zval_dtor_func(arr ZEND_FILE_LINE_CC);
}
+ retval = 0;
+ } else {
+ Z_DELREF_P(array);
}
PHP_ARRAY_CMP_FUNC_RESTORE();
+ RETURN_BOOL(retval);
}
/* }}} */
{
zval *array;
zend_refcounted *arr;
+ zend_bool retval;
PHP_ARRAY_CMP_FUNC_VARS;
PHP_ARRAY_CMP_FUNC_BACKUP();
Z_ADDREF_P(array);
arr = Z_COUNTED_P(array);
- if (zend_hash_sort(Z_ARRVAL_P(array), php_array_user_compare, 0) == FAILURE) {
- RETVAL_FALSE;
- } else {
- if (arr != Z_COUNTED_P(array)) {
- php_error_docref(NULL, E_WARNING, "Array was modified by the user comparison function");
- if (--GC_REFCOUNT(arr) <= 0) {
- _zval_dtor_func(arr ZEND_FILE_LINE_CC);
- }
- RETVAL_FALSE;
- } else {
- Z_DELREF_P(array);
- RETVAL_TRUE;
+ retval = zend_hash_sort(Z_ARRVAL_P(array), php_array_user_compare, 0) != FAILURE;
+
+ if (arr != Z_COUNTED_P(array)) {
+ php_error_docref(NULL, E_WARNING, "Array was modified by the user comparison function");
+ if (--GC_REFCOUNT(arr) <= 0) {
+ _zval_dtor_func(arr ZEND_FILE_LINE_CC);
}
+ retval = 0;
+ } else {
+ Z_DELREF_P(array);
}
PHP_ARRAY_CMP_FUNC_RESTORE();
+ RETURN_BOOL(retval);
}
/* }}} */
{
zval *array;
zend_refcounted *arr;
+ zend_bool retval;
PHP_ARRAY_CMP_FUNC_VARS;
PHP_ARRAY_CMP_FUNC_BACKUP();
Z_ADDREF_P(array);
arr = Z_COUNTED_P(array);
- if (zend_hash_sort(Z_ARRVAL_P(array), php_array_user_key_compare, 0) == FAILURE) {
- RETVAL_FALSE;
- } else {
- if (arr != Z_COUNTED_P(array)) {
- php_error_docref(NULL, E_WARNING, "Array was modified by the user comparison function");
- if (--GC_REFCOUNT(arr) <= 0) {
- _zval_dtor_func(arr ZEND_FILE_LINE_CC);
- }
- RETVAL_FALSE;
- } else {
- Z_DELREF_P(array);
- RETVAL_TRUE;
+ retval = zend_hash_sort(Z_ARRVAL_P(array), php_array_user_key_compare, 0) != FAILURE;
+ if (arr != Z_COUNTED_P(array)) {
+ php_error_docref(NULL, E_WARNING, "Array was modified by the user comparison function");
+ if (--GC_REFCOUNT(arr) <= 0) {
+ _zval_dtor_func(arr ZEND_FILE_LINE_CC);
}
+ retval = 0;
+ } else {
+ Z_DELREF_P(array);
}
PHP_ARRAY_CMP_FUNC_RESTORE();
+ RETURN_BOOL(retval);
}
/* }}} */