diff options
-rw-r--r-- | ext/standard/array.c | 6 | ||||
-rw-r--r-- | ext/standard/type.c | 7 |
2 files changed, 9 insertions, 4 deletions
diff --git a/ext/standard/array.c b/ext/standard/array.c index b6684c8dca..642cc29eba 100644 --- a/ext/standard/array.c +++ b/ext/standard/array.c @@ -1520,7 +1520,7 @@ static void php_compact_var(HashTable *eg_active_symbol_table, zval *return_valu ZVAL_DEREF(entry); if (Z_TYPE_P(entry) == IS_STRING) { if ((value_ptr = zend_hash_find_ind(eg_active_symbol_table, Z_STR_P(entry))) != NULL) { - ZVAL_DUP(&data, value_ptr); + ZVAL_COPY(&data, value_ptr); zend_hash_update(Z_ARRVAL_P(return_value), Z_STR_P(entry), &data); } } else if (Z_TYPE_P(entry) == IS_ARRAY) { @@ -3292,12 +3292,14 @@ PHP_FUNCTION(array_unique) php_set_compare_func(sort_type); - RETVAL_ARR(zend_array_dup(Z_ARRVAL_P(array))); if (Z_ARRVAL_P(array)->nNumOfElements <= 1) { /* nothing to do */ + ZVAL_COPY(return_value, array); return; } + RETVAL_ARR(zend_array_dup(Z_ARRVAL_P(array))); + /* create and sort array with pointers to the target_hash buckets */ arTmp = (struct bucketindex *) pemalloc((Z_ARRVAL_P(array)->nNumOfElements + 1) * sizeof(struct bucketindex), Z_ARRVAL_P(array)->u.flags & HASH_FLAG_PERSISTENT); if (!arTmp) { diff --git a/ext/standard/type.c b/ext/standard/type.c index b4d8586dcc..ea88d41a23 100644 --- a/ext/standard/type.c +++ b/ext/standard/type.c @@ -154,8 +154,11 @@ PHP_FUNCTION(intval) ZEND_PARSE_PARAMETERS_END(); #endif - ZVAL_DUP(return_value, num); - convert_to_long_base(return_value, (int)base); + if (Z_TYPE_P(num) != IS_STRING) { + RETVAL_LONG(zval_get_long(num)); + } else { + RETVAL_LONG(ZEND_STRTOL(Z_STRVAL_P(num), NULL, base)); + } } /* }}} */ |