mirror of
https://github.com/php/php-src.git
synced 2025-01-09 04:24:06 +08:00
906dd4eac5
I have been wanting to make this change for years, but there is a small chance of BC issues, so it shouldn't go into a minor release.
47 lines
1.8 KiB
PHP
47 lines
1.8 KiB
PHP
--TEST--
|
|
Bug #44703 (htmlspecialchars() does not detect bad character set argument)
|
|
--FILE--
|
|
<?php
|
|
|
|
var_dump(htmlspecialchars(b"<a href='test'>Test</a>", ENT_COMPAT, 1));
|
|
var_dump(htmlspecialchars(b"<a href='test'>Test</a>", ENT_COMPAT, 12));
|
|
var_dump(htmlspecialchars(b"<a href='test'>Test</a>", ENT_COMPAT, 125));
|
|
var_dump(htmlspecialchars(b"<a href='test'>Test</a>", ENT_COMPAT, 1252));
|
|
var_dump(htmlspecialchars(b"<a href='test'>Test</a>", ENT_COMPAT, 12526));
|
|
|
|
var_dump(htmlspecialchars(b"<>", ENT_COMPAT, 866));
|
|
var_dump(htmlspecialchars(b"<>", ENT_COMPAT, 8666));
|
|
|
|
var_dump(htmlspecialchars(b"<>", ENT_COMPAT, NULL));
|
|
|
|
|
|
var_dump(htmlspecialchars(b"<>", ENT_COMPAT, 'SJIS'));
|
|
var_dump(htmlspecialchars(b"<>", ENT_COMPAT, 'SjiS'));
|
|
|
|
var_dump(htmlspecialchars(b"<>", ENT_COMPAT, str_repeat('a', 100)));
|
|
|
|
?>
|
|
--EXPECTF--
|
|
Warning: htmlspecialchars(): charset `1' not supported, assuming utf-8 in %s on line %d
|
|
string(35) "<a href='test'>Test</a>"
|
|
|
|
Warning: htmlspecialchars(): charset `12' not supported, assuming utf-8 in %s on line %d
|
|
string(35) "<a href='test'>Test</a>"
|
|
|
|
Warning: htmlspecialchars(): charset `125' not supported, assuming utf-8 in %s on line %d
|
|
string(35) "<a href='test'>Test</a>"
|
|
string(35) "<a href='test'>Test</a>"
|
|
|
|
Warning: htmlspecialchars(): charset `12526' not supported, assuming utf-8 in %s on line %d
|
|
string(35) "<a href='test'>Test</a>"
|
|
string(8) "<>"
|
|
|
|
Warning: htmlspecialchars(): charset `8666' not supported, assuming utf-8 in %s on line %d
|
|
string(8) "<>"
|
|
string(8) "<>"
|
|
string(8) "<>"
|
|
string(8) "<>"
|
|
|
|
Warning: htmlspecialchars(): charset `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' not supported, assuming utf-8 in %s on line %d
|
|
string(8) "<>"
|