derick Mon, 29 Aug 2011 20:24:09 +0000 Revision: http://svn.php.net/viewvc?view=revision&revision=315737
Log: - Zend engine part for bug #55158: Add SORT_NATURAL type to array_multisort (patch by Arpad Ray). Bug: https://bugs.php.net/55158 (Open) Add SORT_NATURAL type to array_multisort Changed paths: U php/php-src/branches/PHP_5_4/Zend/zend_operators.c U php/php-src/branches/PHP_5_4/Zend/zend_operators.h U php/php-src/trunk/Zend/zend_operators.c U php/php-src/trunk/Zend/zend_operators.h Modified: php/php-src/branches/PHP_5_4/Zend/zend_operators.c =================================================================== --- php/php-src/branches/PHP_5_4/Zend/zend_operators.c 2011-08-29 20:23:34 UTC (rev 315736) +++ php/php-src/branches/PHP_5_4/Zend/zend_operators.c 2011-08-29 20:24:09 UTC (rev 315737) @@ -1288,7 +1288,7 @@ } /* }}} */ -ZEND_API int string_compare_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) /* {{{ */ +ZEND_API int string_compare_function_ex(zval *result, zval *op1, zval *op2, zend_bool case_insensitive TSRMLS_DC) /* {{{ */ { zval op1_copy, op2_copy; int use_copy1 = 0, use_copy2 = 0; @@ -1307,7 +1307,11 @@ op2 = &op2_copy; } - ZVAL_LONG(result, zend_binary_zval_strcmp(op1, op2)); + if (case_insensitive) { + ZVAL_LONG(result, zend_binary_zval_strcasecmp(op1, op2)); + } else { + ZVAL_LONG(result, zend_binary_zval_strcmp(op1, op2)); + } if (use_copy1) { zval_dtor(op1); @@ -1319,6 +1323,18 @@ } /* }}} */ +ZEND_API int string_compare_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) /* {{{ */ +{ + return string_compare_function_ex(result, op1, op2, 0); +} +/* }}} */ + +ZEND_API int string_case_compare_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) /* {{{ */ +{ + return string_compare_function_ex(result, op1, op2, 1); +} +/* }}} */ + #if HAVE_STRCOLL ZEND_API int string_locale_compare_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) /* {{{ */ { Modified: php/php-src/branches/PHP_5_4/Zend/zend_operators.h =================================================================== --- php/php-src/branches/PHP_5_4/Zend/zend_operators.h 2011-08-29 20:23:34 UTC (rev 315736) +++ php/php-src/branches/PHP_5_4/Zend/zend_operators.h 2011-08-29 20:24:09 UTC (rev 315737) @@ -301,7 +301,9 @@ ZEND_API int zval_is_true(zval *op); ZEND_API int compare_function(zval *result, zval *op1, zval *op2 TSRMLS_DC); ZEND_API int numeric_compare_function(zval *result, zval *op1, zval *op2 TSRMLS_DC); +ZEND_API int string_compare_function_ex(zval *result, zval *op1, zval *op2, zend_bool case_insensitive TSRMLS_DC); ZEND_API int string_compare_function(zval *result, zval *op1, zval *op2 TSRMLS_DC); +ZEND_API int string_case_compare_function(zval *result, zval *op1, zval *op2 TSRMLS_DC); #if HAVE_STRCOLL ZEND_API int string_locale_compare_function(zval *result, zval *op1, zval *op2 TSRMLS_DC); #endif Modified: php/php-src/trunk/Zend/zend_operators.c =================================================================== --- php/php-src/trunk/Zend/zend_operators.c 2011-08-29 20:23:34 UTC (rev 315736) +++ php/php-src/trunk/Zend/zend_operators.c 2011-08-29 20:24:09 UTC (rev 315737) @@ -1288,7 +1288,7 @@ } /* }}} */ -ZEND_API int string_compare_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) /* {{{ */ +ZEND_API int string_compare_function_ex(zval *result, zval *op1, zval *op2, zend_bool case_insensitive TSRMLS_DC) /* {{{ */ { zval op1_copy, op2_copy; int use_copy1 = 0, use_copy2 = 0; @@ -1307,7 +1307,11 @@ op2 = &op2_copy; } - ZVAL_LONG(result, zend_binary_zval_strcmp(op1, op2)); + if (case_insensitive) { + ZVAL_LONG(result, zend_binary_zval_strcasecmp(op1, op2)); + } else { + ZVAL_LONG(result, zend_binary_zval_strcmp(op1, op2)); + } if (use_copy1) { zval_dtor(op1); @@ -1319,6 +1323,18 @@ } /* }}} */ +ZEND_API int string_compare_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) /* {{{ */ +{ + return string_compare_function_ex(result, op1, op2, 0); +} +/* }}} */ + +ZEND_API int string_case_compare_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) /* {{{ */ +{ + return string_compare_function_ex(result, op1, op2, 1); +} +/* }}} */ + #if HAVE_STRCOLL ZEND_API int string_locale_compare_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) /* {{{ */ { Modified: php/php-src/trunk/Zend/zend_operators.h =================================================================== --- php/php-src/trunk/Zend/zend_operators.h 2011-08-29 20:23:34 UTC (rev 315736) +++ php/php-src/trunk/Zend/zend_operators.h 2011-08-29 20:24:09 UTC (rev 315737) @@ -301,7 +301,9 @@ ZEND_API int zval_is_true(zval *op); ZEND_API int compare_function(zval *result, zval *op1, zval *op2 TSRMLS_DC); ZEND_API int numeric_compare_function(zval *result, zval *op1, zval *op2 TSRMLS_DC); +ZEND_API int string_compare_function_ex(zval *result, zval *op1, zval *op2, zend_bool case_insensitive TSRMLS_DC); ZEND_API int string_compare_function(zval *result, zval *op1, zval *op2 TSRMLS_DC); +ZEND_API int string_case_compare_function(zval *result, zval *op1, zval *op2 TSRMLS_DC); #if HAVE_STRCOLL ZEND_API int string_locale_compare_function(zval *result, zval *op1, zval *op2 TSRMLS_DC); #endif
-- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php