Hi Jani,
there were some places in the codebase where the macro ZEND_ENGINE_2 was used.
I think these were the last 2 occurances.

Andrey

Jani Taskinen wrote:
Yes, what's the point in having such compatibility things
in HEAD?
--Jani


On Sat, 24 Jan 2004, Andrey Hristov wrote:


Ooops, something else slipped in :/ (no more commits so late).
Anyway, should I revert the irrelevant part about ZEND_ENGINE_2 ?

Andrey

Andrey Hristov wrote:

andrey Fri Jan 23 19:25:58 2004 EDT

Modified files: /php-src/ext/standard array.c Log:
Added third parameter (optional) to array_keys for strictness. It behaves
like the "strict" parameter of in_array().
#Closing feature request #24258
http://cvs.php.net/diff.php/php-src/ext/standard/array.c?r1=1.256&r2=1.257&ty=u
Index: php-src/ext/standard/array.c
diff -u php-src/ext/standard/array.c:1.256 php-src/ext/standard/array.c:1.257
--- php-src/ext/standard/array.c:1.256 Sat Jan 17 12:33:10 2004
+++ php-src/ext/standard/array.c Fri Jan 23 19:25:58 2004
@@ -21,7 +21,7 @@
+----------------------------------------------------------------------+
*/


-/* $Id: array.c,v 1.256 2004/01/17 17:33:10 andrey Exp $ */
+/* $Id: array.c,v 1.257 2004/01/24 00:25:58 andrey Exp $ */

#include "php.h"
#include "php_ini.h"
@@ -1135,6 +1135,13 @@
                WRONG_PARAM_COUNT;
        }

+#ifndef ZEND_ENGINE_2  
+       if (Z_TYPE_PP(value) == IS_OBJECT) {
+               php_error_docref(NULL TSRMLS_CC, E_WARNING, "Wrong datatype for first 
argument");
+               RETURN_FALSE;
+       }
+#endif
+       
        if (Z_TYPE_PP(array) != IS_ARRAY) {
                php_error_docref(NULL TSRMLS_CC, E_WARNING, "Wrong datatype for second 
argument");
                RETURN_FALSE;
@@ -1473,6 +1480,14 @@
        }
        newval = *val;
        while (i--) {
+#ifndef ZEND_ENGINE_2
+               if (newval->refcount >= 62000) {
+                       MAKE_STD_ZVAL(newval);
+                       *newval = **val;
+                       zval_copy_ctor(newval);
+                       newval->refcount = 0;
+               }
+#endif         
                zval_add_ref(&newval);
                zend_hash_next_index_insert(Z_ARRVAL_P(return_value), &newval, 
sizeof(zval *), NULL);
        }
@@ -2243,7 +2258,7 @@
/* }}} */


-/* {{{ proto array array_keys(array input [, mixed search_value]) +/* {{{ proto array array_keys(array input [, mixed search_value[, bool strict]]) Return just the keys from the input array, optionally only for the specified search_value */ PHP_FUNCTION(array_keys) { @@ -2251,18 +2266,21 @@ **search_value, /* Value to search for */ **entry, /* An entry in the input array */ res, /* Result of comparison */ + **strict, /* be strict */ *new_val; /* New value */ int add_key; /* Flag to indicate whether a key should be added */ char *string_key; /* String key */ uint string_key_len; ulong num_key; /* Numeric key */ HashPosition pos; + int (*is_equal_func)(zval *, zval *, zval * TSRMLS_DC) = is_equal_function; +

        search_value = NULL;
        
        /* Get arguments and do error-checking */
-       if (ZEND_NUM_ARGS() < 1 || ZEND_NUM_ARGS() > 2 ||
-               zend_get_parameters_ex(ZEND_NUM_ARGS(), &input, &search_value) == 
FAILURE) {
+       if (ZEND_NUM_ARGS() < 1 || ZEND_NUM_ARGS() > 3 ||
+               zend_get_parameters_ex(ZEND_NUM_ARGS(), &input, &search_value, 
&strict) == FAILURE) {
                WRONG_PARAM_COUNT;
        }
        
@@ -2270,6 +2288,12 @@
                php_error_docref(NULL TSRMLS_CC, E_WARNING, "The first argument should be 
an array");
                return;
        }
+       if (ZEND_NUM_ARGS() == 3) {
+               convert_to_boolean_ex(strict);
+               if (Z_LVAL_PP(strict)) {
+                       is_equal_func = is_identical_function;
+               }
+       }
        
        /* Initialize return array */
        array_init(return_value);
@@ -2279,7 +2303,7 @@
        zend_hash_internal_pointer_reset_ex(Z_ARRVAL_PP(input), &pos);
        while (zend_hash_get_current_data_ex(Z_ARRVAL_PP(input), (void **)&entry, 
&pos) == SUCCESS) {
                if (search_value != NULL) {
-                       is_equal_function(&res, *search_value, *entry TSRMLS_CC);
+                       is_equal_func(&res, *search_value, *entry TSRMLS_CC);
                        add_key = zval_is_true(&res);
                }
        





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



Reply via email to