mirror of
https://github.com/php/php-src.git
synced 2025-08-15 21:48:51 +02:00

If we reach the end of the string without reducing to a single encoding, then we should flush to check whether the last character is incomplete.
15 lines
459 B
PHP
15 lines
459 B
PHP
--TEST--
|
|
mb_detect_encoding() with incomplete trailing sequence
|
|
--EXTENSIONS--
|
|
mbstring
|
|
--FILE--
|
|
<?php
|
|
|
|
// Even in non-strict mode, this should detect as ISO-8859-1. When the end of the string is
|
|
// reached neither have illegal characters and would be picked based on score. However, flushing
|
|
// the string will disqualify UTF-8 due to illegal characters.
|
|
var_dump(mb_detect_encoding("A\xC2", ["UTF-8", "ISO-8859-1"]));
|
|
|
|
?>
|
|
--EXPECT--
|
|
string(10) "ISO-8859-1"
|