Merge branch 'PHP-7.1' into PHP-7.2

* PHP-7.1:
  Fix #75944: Wrong cp1251 detection
This commit is contained in:
Christoph M. Becker 2018-03-19 14:25:44 +01:00
commit cd2912af5e
3 changed files with 17 additions and 1 deletions

3
NEWS
View File

@ -2,6 +2,9 @@ PHP NEWS
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
?? ??? 2018, PHP 7.2.5
- Mbstring:
. Fixed bug #75944 (Wrong cp1251 detection). (dmk001)
- ODBC:
. Fixed bug #76088 (ODBC functions are not available by default on Windows).
(cmb)

View File

@ -142,7 +142,7 @@ mbfl_filt_conv_wchar_cp1251(int c, mbfl_convert_filter *filter)
/* all of this is so ugly now! */
static int mbfl_filt_ident_cp1251(int c, mbfl_identify_filter *filter)
{
if (c >= 0x80 && c < 0xff)
if (c >= 0x80 && c <= 0xff)
filter->flag = 0;
else
filter->flag = 1; /* not it */

View File

@ -0,0 +1,13 @@
--TEST--
Bug #75944 (wrong detection cp1251 encoding because of missing last cyrillic letter)
--SKIPIF--
<?php extension_loaded('mbstring') or die('skip mbstring not available'); ?>
--FILE--
<?php
var_dump(mb_detect_encoding(chr(0xfe), array('CP-1251'))); // letter '?'
var_dump(mb_detect_encoding(chr(0xff), array('CP-1251'))); // letter '?'
?>
--EXPECT--
string(12) "Windows-1251"
string(12) "Windows-1251"