- Fixed bug #46546 (Segmentation fault when using declare statement with non-string value)

# This issue only happens in this branch
This commit is contained in:
Felipe Pena 2008-11-11 16:15:53 +00:00
parent 9178503610
commit 9b894e6e62
2 changed files with 18 additions and 1 deletions

View File

@ -0,0 +1,16 @@
--TEST--
Testing declare statement with several type values
--FILE--
<?php
declare(encoding = 1);
declare(encoding = 1123131232131312321);
declare(encoding = NULL);
declare(encoding = M_PI);
declare(encoding = 'utf-8');
print 'DONE';
?>
--EXPECT--
DONE

View File

@ -4770,12 +4770,13 @@ void zend_do_declare_stmt(znode *var, znode *val TSRMLS_DC)
zend_multibyte_yyinput_again(old_input_filter, old_encoding TSRMLS_CC);
}
}
efree(val->u.constant.value.str.val);
#else /* !ZEND_MULTIBYTE */
} else if (!zend_binary_strcasecmp(var->u.constant.value.str.val, var->u.constant.value.str.len, "encoding", sizeof("encoding")-1)) {
/* Do not generate any kind of warning for encoding declares */
/* zend_error(E_COMPILE_WARNING, "Declare encoding [%s] not supported", val->u.constant.value.str.val); */
zval_dtor(&val->u.constant);
#endif /* ZEND_MULTIBYTE */
efree(val->u.constant.value.str.val);
} else {
zend_error(E_COMPILE_WARNING, "Unsupported declare '%s'", var->u.constant.value.str.val);
zval_dtor(&val->u.constant);