stas            Mon Nov 24 18:12:17 2008 UTC

  Modified files:              (Branch: PHP_5_3)
    /php-src/ext/standard       array.c basic_functions.c 
  Log:
  restore BC for arrays
  [DOC] natsort, natcasesort, usort, uasort, uksort, array_flip, array_unique 
  still won't work with objects
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/array.c?r1=1.308.2.21.2.37.2.45&r2=1.308.2.21.2.37.2.46&diff_format=u
Index: php-src/ext/standard/array.c
diff -u php-src/ext/standard/array.c:1.308.2.21.2.37.2.45 
php-src/ext/standard/array.c:1.308.2.21.2.37.2.46
--- php-src/ext/standard/array.c:1.308.2.21.2.37.2.45   Tue Oct 21 22:08:36 2008
+++ php-src/ext/standard/array.c        Mon Nov 24 18:12:16 2008
@@ -21,7 +21,7 @@
    +----------------------------------------------------------------------+
 */
 
-/* $Id: array.c,v 1.308.2.21.2.37.2.45 2008/10/21 22:08:36 lbarnaud Exp $ */
+/* $Id: array.c,v 1.308.2.21.2.37.2.46 2008/11/24 18:12:16 stas Exp $ */
 
 #include "php.h"
 #include "php_ini.h"
@@ -751,16 +751,17 @@
    Advances array argument's internal pointer to the last element and return 
it */
 PHP_FUNCTION(end)
 {
-       zval *array, **entry;
+       HashTable *array;
+       zval **entry;
 
-       if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "a", &array) == 
FAILURE) {
+       if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "H", &array) == 
FAILURE) {
                return;
        }
 
-       zend_hash_internal_pointer_end(Z_ARRVAL_P(array));
+       zend_hash_internal_pointer_end(array);
 
        if (return_value_used) {
-               if (zend_hash_get_current_data(Z_ARRVAL_P(array), (void **) 
&entry) == FAILURE) {
+               if (zend_hash_get_current_data(array, (void **) &entry) == 
FAILURE) {
                        RETURN_FALSE;
                }
 
@@ -773,16 +774,17 @@
    Move array argument's internal pointer to the previous element and return 
it */
 PHP_FUNCTION(prev)
 {
-       zval *array, **entry;
+       HashTable *array;
+       zval **entry;
 
-       if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "a", &array) == 
FAILURE) {
+       if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "H", &array) == 
FAILURE) {
                return;
        }
 
-       zend_hash_move_backwards(Z_ARRVAL_P(array));
+       zend_hash_move_backwards(array);
 
        if (return_value_used) {
-               if (zend_hash_get_current_data(Z_ARRVAL_P(array), (void **) 
&entry) == FAILURE) {
+               if (zend_hash_get_current_data(array, (void **) &entry) == 
FAILURE) {
                        RETURN_FALSE;
                }
 
@@ -795,16 +797,17 @@
    Move array argument's internal pointer to the next element and return it */
 PHP_FUNCTION(next)
 {
-       zval *array, **entry;
+       HashTable *array;
+       zval **entry;
 
-       if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "a", &array) == 
FAILURE) {
+       if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "H", &array) == 
FAILURE) {
                return;
        }
 
-       zend_hash_move_forward(Z_ARRVAL_P(array));
+       zend_hash_move_forward(array);
 
        if (return_value_used) {
-               if (zend_hash_get_current_data(Z_ARRVAL_P(array), (void **) 
&entry) == FAILURE) {
+               if (zend_hash_get_current_data(array, (void **) &entry) == 
FAILURE) {
                        RETURN_FALSE;
                }
 
@@ -817,16 +820,17 @@
    Set array argument's internal pointer to the first element and return it */
 PHP_FUNCTION(reset)
 {
-       zval *array, **entry;
+       HashTable *array;
+       zval **entry;
 
-       if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "a", &array) == 
FAILURE) {
+       if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "H", &array) == 
FAILURE) {
                return;
        }
 
-       zend_hash_internal_pointer_reset(Z_ARRVAL_P(array));
+       zend_hash_internal_pointer_reset(array);
 
        if (return_value_used) {
-               if (zend_hash_get_current_data(Z_ARRVAL_P(array), (void **) 
&entry) == FAILURE) {
+               if (zend_hash_get_current_data(array, (void **) &entry) == 
FAILURE) {
                        RETURN_FALSE;
                }
 
@@ -839,13 +843,14 @@
    Return the element currently pointed to by the internal array pointer */
 PHP_FUNCTION(current)
 {
-       zval *array, **entry;
+       HashTable *array;
+       zval **entry;
 
-       if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "a", &array) == 
FAILURE) {
+       if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "H", &array) == 
FAILURE) {
                return;
        }
 
-       if (zend_hash_get_current_data(Z_ARRVAL_P(array), (void **) &entry) == 
FAILURE) {
+       if (zend_hash_get_current_data(array, (void **) &entry) == FAILURE) {
                RETURN_FALSE;
        }
        RETURN_ZVAL(*entry, 1, 0);
@@ -856,16 +861,16 @@
    Return the key of the element currently pointed to by the internal array 
pointer */
 PHP_FUNCTION(key)
 {
-       zval *array;
+       HashTable *array;
        char *string_key;
        uint string_length;
        ulong num_key;
 
-       if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "a", &array) == 
FAILURE) {
+       if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "H", &array) == 
FAILURE) {
                return;
        }
 
-       switch (zend_hash_get_current_key_ex(Z_ARRVAL_P(array), &string_key, 
&string_length, &num_key, 0, NULL)) {
+       switch (zend_hash_get_current_key_ex(array, &string_key, 
&string_length, &num_key, 0, NULL)) {
                case HASH_KEY_IS_STRING:
                        RETVAL_STRINGL(string_key, string_length - 1, 1);
                        break;
@@ -1070,21 +1075,21 @@
    Apply a user function to every member of an array */
 PHP_FUNCTION(array_walk)
 {
-       zval *array,
-                *userdata = NULL;
+       HashTable *array;
+       zval *userdata = NULL;
        zend_fcall_info orig_array_walk_fci;
        zend_fcall_info_cache orig_array_walk_fci_cache;
 
        orig_array_walk_fci = BG(array_walk_fci);
        orig_array_walk_fci_cache = BG(array_walk_fci_cache);
 
-       if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "af|z/", &array, 
&BG(array_walk_fci), &BG(array_walk_fci_cache), &userdata) == FAILURE) {
+       if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Hf|z/", &array, 
&BG(array_walk_fci), &BG(array_walk_fci_cache), &userdata) == FAILURE) {
                BG(array_walk_fci) = orig_array_walk_fci;
                BG(array_walk_fci_cache) = orig_array_walk_fci_cache;
                return;
        }
 
-       php_array_walk(Z_ARRVAL_P(array), userdata ? &userdata : NULL, 0 
TSRMLS_CC);
+       php_array_walk(array, userdata ? &userdata : NULL, 0 TSRMLS_CC);
        BG(array_walk_fci) = orig_array_walk_fci;
        BG(array_walk_fci_cache) = orig_array_walk_fci_cache;
        RETURN_TRUE;
@@ -1095,21 +1100,21 @@
    Apply a user function recursively to every member of an array */
 PHP_FUNCTION(array_walk_recursive)
 {
-       zval *array,
-                *userdata = NULL;
+       HashTable *array;
+       zval *userdata = NULL;
        zend_fcall_info orig_array_walk_fci;
        zend_fcall_info_cache orig_array_walk_fci_cache;
 
        orig_array_walk_fci = BG(array_walk_fci);
        orig_array_walk_fci_cache = BG(array_walk_fci_cache);
 
-       if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "af|z/", &array, 
&BG(array_walk_fci), &BG(array_walk_fci_cache), &userdata) == FAILURE) {
+       if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Hf|z/", &array, 
&BG(array_walk_fci), &BG(array_walk_fci_cache), &userdata) == FAILURE) {
                BG(array_walk_fci) = orig_array_walk_fci;
                BG(array_walk_fci_cache) = orig_array_walk_fci_cache;
                return;
        }
 
-       php_array_walk(Z_ARRVAL_P(array), userdata ? &userdata : NULL, 1 
TSRMLS_CC);
+       php_array_walk(array, userdata ? &userdata : NULL, 1 TSRMLS_CC);
        BG(array_walk_fci) = orig_array_walk_fci;
        BG(array_walk_fci_cache) = orig_array_walk_fci_cache;
        RETURN_TRUE;
@@ -4268,26 +4273,26 @@
    Checks if the given key or index exists in the array */
 PHP_FUNCTION(array_key_exists)
 {
-       zval *key,                                      /* key to check for */
-                *array;                                /* array to check in */
+       zval *key;                                      /* key to check for */
+       HashTable *array;                       /* array to check in */
 
-       if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "za", &key, 
&array) == FAILURE) {
+       if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "zH", &key, 
&array) == FAILURE) {
                return;
        }
 
        switch (Z_TYPE_P(key)) {
                case IS_STRING:
-                       if (zend_symtable_exists(Z_ARRVAL_P(array), 
Z_STRVAL_P(key), Z_STRLEN_P(key) + 1)) {
+                       if (zend_symtable_exists(array, Z_STRVAL_P(key), 
Z_STRLEN_P(key) + 1)) {
                                RETURN_TRUE;
                        }
                        RETURN_FALSE;
                case IS_LONG:
-                       if (zend_hash_index_exists(Z_ARRVAL_P(array), 
Z_LVAL_P(key))) {
+                       if (zend_hash_index_exists(array, Z_LVAL_P(key))) {
                                RETURN_TRUE;
                        }
                        RETURN_FALSE;
                case IS_NULL:
-                       if (zend_hash_exists(Z_ARRVAL_P(array), "", 1)) {
+                       if (zend_hash_exists(array, "", 1)) {
                                RETURN_TRUE;
                        }
                        RETURN_FALSE;
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/basic_functions.c?r1=1.725.2.31.2.64.2.73&r2=1.725.2.31.2.64.2.74&diff_format=u
Index: php-src/ext/standard/basic_functions.c
diff -u php-src/ext/standard/basic_functions.c:1.725.2.31.2.64.2.73 
php-src/ext/standard/basic_functions.c:1.725.2.31.2.64.2.74
--- php-src/ext/standard/basic_functions.c:1.725.2.31.2.64.2.73 Mon Nov 17 
11:27:59 2008
+++ php-src/ext/standard/basic_functions.c      Mon Nov 24 18:12:17 2008
@@ -18,7 +18,7 @@
    +----------------------------------------------------------------------+
  */
 
-/* $Id: basic_functions.c,v 1.725.2.31.2.64.2.73 2008/11/17 11:27:59 felipe 
Exp $ */
+/* $Id: basic_functions.c,v 1.725.2.31.2.64.2.74 2008/11/24 18:12:17 stas Exp 
$ */
 
 #include "php.h"
 #include "php_streams.h"
@@ -4770,7 +4770,7 @@
        HashTable *params_ar;
        int num_elems, element = 0;
 
-       if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z/za/", 
&callback, &object, &params) == FAILURE) {
+       if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z/zA/", 
&callback, &object, &params) == FAILURE) {
                return;
        }
 

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

Reply via email to