php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Return to Bug #75944
Patch mbstring_cp1251_0xff_return revision 2018-02-16 20:42 UTC by dmk001 at inbox dot ru
revision 2018-02-09 18:48 UTC by dmk001 at inbox dot ru

Patch mbstring_cp1251_0xff_return for mbstring related Bug #75944

Patch version 2018-02-09 18:48 UTC

Return to Bug #75944 | Download this patch
Patch Revisions: 2018-02-16 20:42 UTC | 2018-02-09 18:48 UTC

Developer: dmk001@inbox.ru

Line 10 (now 10), was 23 lines, now 4 lines

  +	if (c >= 0x80 && c <= 0xff)
   		filter->flag = 0;
   	else
   		filter->flag = 1; /* not it */
 diff --git a/ext/mbstring/tests/bug75944.phpt b/ext/mbstring/tests/bug75944.phpt
 new file mode 100644
 index 0000000..20cb9f5
 --- /dev/null
 +++ b/ext/mbstring/tests/bug75944.phpt
 @@ -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"
 +
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu May 02 20:01:31 2024 UTC