mirror of
https://github.com/php/php-src.git
synced 2024-09-21 09:57:23 +00:00
- 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:
parent
9178503610
commit
9b894e6e62
16
Zend/tests/declare_001.phpt
Normal file
16
Zend/tests/declare_001.phpt
Normal 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
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user