diff options
author | Zeev Suraski <zeev@php.net> | 1999-12-21 20:30:04 +0000 |
---|---|---|
committer | Zeev Suraski <zeev@php.net> | 1999-12-21 20:30:04 +0000 |
commit | f0888ccaef222093c962eef72857e424f0fc5cb7 (patch) | |
tree | dd5ae96c2287110b9cd62898ec5b10908460ccf1 /Zend | |
parent | 42847f7d5c434b5ee9c57026b8215df883575d4e (diff) | |
download | php-git-f0888ccaef222093c962eef72857e424f0fc5cb7.tar.gz |
Fix the highlighting problem. STR_REALLOC() should be used instead of plain erealloc()
whenever you're dealing with strings that might be coming back from the engine - there seem
to be a few other places like this in PHP.
Diffstat (limited to 'Zend')
-rw-r--r-- | Zend/zend-scanner.l | 2 | ||||
-rw-r--r-- | Zend/zend.h | 8 | ||||
-rw-r--r-- | Zend/zend_compile.c | 4 | ||||
-rw-r--r-- | Zend/zend_execute.c | 2 |
4 files changed, 13 insertions, 3 deletions
diff --git a/Zend/zend-scanner.l b/Zend/zend-scanner.l index a4edba40a0..238a6544b2 100644 --- a/Zend/zend-scanner.l +++ b/Zend/zend-scanner.l @@ -409,7 +409,7 @@ static inline int prepare_string_for_scanning(zval *str CLS_DC) { #ifndef ZTS /* enforce two trailing NULLs for flex... */ - str->value.str.val = (char *) erealloc(str->value.str.val,str->value.str.len+2); + STR_REALLOC(str->value.str.val, str->value.str.len+2); str->value.str.val[str->value.str.len+1]=0; diff --git a/Zend/zend.h b/Zend/zend.h index ea66e2da2c..1c1871e985 100644 --- a/Zend/zend.h +++ b/Zend/zend.h @@ -231,6 +231,14 @@ ZEND_API extern char *undefined_variable_string; #define STR_FREE(ptr) if (ptr && ptr!=empty_string && ptr!=undefined_variable_string) { efree(ptr); } #define STR_FREE_REL(ptr) if (ptr && ptr!=empty_string && ptr!=undefined_variable_string) { efree_rel(ptr); } +#define STR_REALLOC(ptr, size) \ + if (ptr!=empty_string && ptr!=undefined_variable_string) { \ + ptr = (char *) erealloc(ptr, size); \ + } else { \ + ptr = (char *) emalloc(size); \ + memset(ptr, 0, size); \ + } + /* output support */ #define ZEND_WRITE(str, str_len) zend_write((str), (str_len)) #define ZEND_PUTS(str) zend_write((str), strlen((str))) diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c index dbc413b15d..9d70d255fd 100644 --- a/Zend/zend_compile.c +++ b/Zend/zend_compile.c @@ -1251,9 +1251,9 @@ void do_switch_cond(znode *cond CLS_DC) switch_entry.control_var = -1; zend_stack_push(&CG(switch_cond_stack), (void *) &switch_entry, sizeof(switch_entry)); - if (opline->result.op_type == IS_VAR) { +/* if (opline->result.op_type == IS_VAR) { opline->result.u.EA.type |= EXT_TYPE_UNUSED; - } + }*/ do_begin_loop(CLS_C); diff --git a/Zend/zend_execute.c b/Zend/zend_execute.c index 6b3a1aab0a..f109ea1217 100644 --- a/Zend/zend_execute.c +++ b/Zend/zend_execute.c @@ -1806,6 +1806,8 @@ send_by_ref: if (!Ts[opline->op1.u.var].var.ptr_ptr) { get_zval_ptr(&opline->op1, Ts, &EG(free_op1), BP_VAR_R); FREE_OP(&opline->op1, EG(free_op1)); + } else { + zval_ptr_dtor(&Ts[opline->op1.u.var].var.ptr); } break; case IS_TMP_VAR: |