summaryrefslogtreecommitdiff
path: root/ext/mbstring/mbstring.c
diff options
context:
space:
mode:
Diffstat (limited to 'ext/mbstring/mbstring.c')
-rw-r--r--ext/mbstring/mbstring.c36
1 files changed, 22 insertions, 14 deletions
diff --git a/ext/mbstring/mbstring.c b/ext/mbstring/mbstring.c
index 5524b4180d..d5af96a5a1 100644
--- a/ext/mbstring/mbstring.c
+++ b/ext/mbstring/mbstring.c
@@ -3766,10 +3766,12 @@ PHP_FUNCTION(mb_convert_variables)
target_hash = HASH_OF(var);
if (target_hash != NULL) {
while ((hash_entry = zend_hash_get_current_data(target_hash)) != NULL) {
- if (++target_hash->u.v.nApplyCount > 1) {
- --target_hash->u.v.nApplyCount;
- recursion_error = 1;
- goto detect_end;
+ if (!Z_IMMUTABLE_P(var)) {
+ if (++target_hash->u.v.nApplyCount > 1) {
+ --target_hash->u.v.nApplyCount;
+ recursion_error = 1;
+ goto detect_end;
+ }
}
zend_hash_move_forward(target_hash);
if (Z_TYPE_P(hash_entry) == IS_INDIRECT) {
@@ -3813,15 +3815,17 @@ detect_end:
}
if (recursion_error) {
while(stack_level-- && (var = &stack[stack_level])) {
- if (HASH_OF(var)->u.v.nApplyCount > 1) {
- HASH_OF(var)->u.v.nApplyCount--;
+ if (!Z_IMMUTABLE_P(var)) {
+ if (HASH_OF(var)->u.v.nApplyCount > 1) {
+ HASH_OF(var)->u.v.nApplyCount--;
+ }
}
}
efree(stack);
if (elist != NULL) {
efree((void *)elist);
}
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Cannot handle recursive references");
+ php_error_docref(NULL, E_WARNING, "Cannot handle recursive references");
RETURN_FALSE;
}
efree(stack);
@@ -3878,10 +3882,12 @@ detect_end:
hash_entry = hash_entry_ptr;
ZVAL_DEREF(hash_entry);
if (Z_TYPE_P(hash_entry) == IS_ARRAY || Z_TYPE_P(hash_entry) == IS_OBJECT) {
- if (++(HASH_OF(hash_entry)->u.v.nApplyCount) > 1) {
- --(HASH_OF(hash_entry)->u.v.nApplyCount);
- recursion_error = 1;
- goto conv_end;
+ if (!Z_IMMUTABLE_P(hash_entry)) {
+ if (++(HASH_OF(hash_entry)->u.v.nApplyCount) > 1) {
+ --(HASH_OF(hash_entry)->u.v.nApplyCount);
+ recursion_error = 1;
+ goto conv_end;
+ }
}
if (stack_level >= stack_max) {
stack_max += PHP_MBSTR_STACK_BLOCK_SIZE;
@@ -3929,12 +3935,14 @@ conv_end:
if (recursion_error) {
while(stack_level-- && (var = &stack[stack_level])) {
- if (HASH_OF(var)->u.v.nApplyCount > 1) {
- HASH_OF(var)->u.v.nApplyCount--;
+ if (!Z_IMMUTABLE_P(var)) {
+ if (HASH_OF(var)->u.v.nApplyCount > 1) {
+ HASH_OF(var)->u.v.nApplyCount--;
+ }
}
}
efree(stack);
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Cannot handle recursive references");
+ php_error_docref(NULL, E_WARNING, "Cannot handle recursive references");
RETURN_FALSE;
}
efree(stack);