Fixed altering $this via argument named "this"

This commit is contained in:
Dmitry Stogov 2007-05-04 06:18:53 +00:00
parent cd32cab680
commit d8ce0568ef
2 changed files with 11 additions and 1 deletions

1
NEWS
View File

@ -3,6 +3,7 @@ PHP NEWS
?? ??? 2007, PHP 5.2.3
- Fixed ext/filter Email Validation Vulnerability (MOPB-24 by Stefan Esser)
(Ilia)
- Fixed altering $this via argument named "this". (Dmitry)
03 May 2007, PHP 5.2.2
- Improved bundled GD

View File

@ -1265,9 +1265,18 @@ void zend_do_end_function_declaration(znode *function_token TSRMLS_DC)
void zend_do_receive_arg(zend_uchar op, znode *var, znode *offset, znode *initialization, znode *class_type, znode *varname, zend_uchar pass_by_reference TSRMLS_DC)
{
zend_op *opline = get_next_op(CG(active_op_array) TSRMLS_CC);
zend_op *opline;
zend_arg_info *cur_arg_info;
if (CG(active_op_array)->scope &&
((CG(active_op_array)->fn_flags & ZEND_ACC_STATIC) == 0) &&
(Z_TYPE(varname->u.constant) == IS_STRING) &&
(Z_STRLEN(varname->u.constant) == sizeof("this")-1) &&
(memcmp(Z_STRVAL(varname->u.constant), "this", sizeof("this")) == 0)) {
zend_error(E_COMPILE_ERROR, "Cannot re-assign $this");
}
opline = get_next_op(CG(active_op_array) TSRMLS_CC);
CG(active_op_array)->num_args++;
opline->opcode = op;
opline->result = *var;