#49528 [NEW]: UTF-16 strings prefixed by BOMs wrondly converted

2009-09-11 Thread moriyo...@php.net
From: moriyo...@php.net
Operating system: N/A
PHP version:  5.3SVN-2009-09-11 (SVN)
PHP Bug Type: mbstring related
Bug description:  UTF-16 strings prefixed by BOMs wrondly converted

Description:

The first character of a UTF-16 string prefixed by "\xff\xfe" (LE BOM)
gets converted to wrong Unicode codepoint. Moreover, the resulting string
contains the BOM itself while it is uncalled for.



Reproduce code:
---


Expected result:

string(8) "02010403"

Actual result:
--
string(12) "fe010403"

-- 
Edit bug report at http://bugs.php.net/?id=49528&edit=1
-- 
Try a snapshot (PHP 5.2):
http://bugs.php.net/fix.php?id=49528&r=trysnapshot52
Try a snapshot (PHP 5.3):
http://bugs.php.net/fix.php?id=49528&r=trysnapshot53
Try a snapshot (PHP 6.0):
http://bugs.php.net/fix.php?id=49528&r=trysnapshot60
Fixed in SVN:
http://bugs.php.net/fix.php?id=49528&r=fixed
Fixed in SVN and need be documented: 
http://bugs.php.net/fix.php?id=49528&r=needdocs
Fixed in release:
http://bugs.php.net/fix.php?id=49528&r=alreadyfixed
Need backtrace:  
http://bugs.php.net/fix.php?id=49528&r=needtrace
Need Reproduce Script:   
http://bugs.php.net/fix.php?id=49528&r=needscript
Try newer version:   
http://bugs.php.net/fix.php?id=49528&r=oldversion
Not developer issue: 
http://bugs.php.net/fix.php?id=49528&r=support
Expected behavior:   
http://bugs.php.net/fix.php?id=49528&r=notwrong
Not enough info: 
http://bugs.php.net/fix.php?id=49528&r=notenoughinfo
Submitted twice: 
http://bugs.php.net/fix.php?id=49528&r=submittedtwice
register_globals:
http://bugs.php.net/fix.php?id=49528&r=globals
PHP 4 support discontinued:  http://bugs.php.net/fix.php?id=49528&r=php4
Daylight Savings:http://bugs.php.net/fix.php?id=49528&r=dst
IIS Stability:   
http://bugs.php.net/fix.php?id=49528&r=isapi
Install GNU Sed: 
http://bugs.php.net/fix.php?id=49528&r=gnused
Floating point limitations:  
http://bugs.php.net/fix.php?id=49528&r=float
No Zend Extensions:  
http://bugs.php.net/fix.php?id=49528&r=nozend
MySQL Configuration Error:   
http://bugs.php.net/fix.php?id=49528&r=mysqlcfg



#49536 [NEW]: mb_detect_encoding() returns incorrect results when strict_mode is turned on

2009-09-11 Thread moriyo...@php.net
From: moriyo...@php.net
Operating system: *
PHP version:  5.3SVN-2009-09-11 (SVN)
PHP Bug Type: mbstring related
Bug description:  mb_detect_encoding() returns incorrect results when 
strict_mode is turned on

Description:

mb_detect_encoding() produces wrong results from incomplete multibyte
sequences when strict_mode is turned on. (originally reported by
komura.db2r1e|at|gmail|dot|com)

Reproduce code:
---
// non-strict mode
var_dump(mb_detect_encoding("A\x81", "SJIS", false));
// strict mode
var_dump(mb_detect_encoding("A\x81", "SJIS", true));
// non-strict mode
var_dump(mb_detect_encoding("\xc0\x00", "UTF-8", false));
// strict mode
var_dump(mb_detect_encoding("\xc0\x00", "UTF-8", true));

Expected result:

string(4) "SJIS"
bool(false)
string(5) "UTF-8"
bool(false)


Actual result:
--
string(4) "SJIS"
string(4) "SJIS"
string(5) "UTF-8"
string(5) "UTF-8"


-- 
Edit bug report at http://bugs.php.net/?id=49536&edit=1
-- 
Try a snapshot (PHP 5.2):
http://bugs.php.net/fix.php?id=49536&r=trysnapshot52
Try a snapshot (PHP 5.3):
http://bugs.php.net/fix.php?id=49536&r=trysnapshot53
Try a snapshot (PHP 6.0):
http://bugs.php.net/fix.php?id=49536&r=trysnapshot60
Fixed in SVN:
http://bugs.php.net/fix.php?id=49536&r=fixed
Fixed in SVN and need be documented: 
http://bugs.php.net/fix.php?id=49536&r=needdocs
Fixed in release:
http://bugs.php.net/fix.php?id=49536&r=alreadyfixed
Need backtrace:  
http://bugs.php.net/fix.php?id=49536&r=needtrace
Need Reproduce Script:   
http://bugs.php.net/fix.php?id=49536&r=needscript
Try newer version:   
http://bugs.php.net/fix.php?id=49536&r=oldversion
Not developer issue: 
http://bugs.php.net/fix.php?id=49536&r=support
Expected behavior:   
http://bugs.php.net/fix.php?id=49536&r=notwrong
Not enough info: 
http://bugs.php.net/fix.php?id=49536&r=notenoughinfo
Submitted twice: 
http://bugs.php.net/fix.php?id=49536&r=submittedtwice
register_globals:
http://bugs.php.net/fix.php?id=49536&r=globals
PHP 4 support discontinued:  http://bugs.php.net/fix.php?id=49536&r=php4
Daylight Savings:http://bugs.php.net/fix.php?id=49536&r=dst
IIS Stability:   
http://bugs.php.net/fix.php?id=49536&r=isapi
Install GNU Sed: 
http://bugs.php.net/fix.php?id=49536&r=gnused
Floating point limitations:  
http://bugs.php.net/fix.php?id=49536&r=float
No Zend Extensions:  
http://bugs.php.net/fix.php?id=49536&r=nozend
MySQL Configuration Error:   
http://bugs.php.net/fix.php?id=49536&r=mysqlcfg



#49861 [NEW]: htmlspecialchars() returns incorrect results for Unicode characters outside BMP

2009-10-13 Thread moriyo...@php.net
From: moriyo...@php.net
Operating system: *
PHP version:  5.3SVN-2009-10-13 (SVN)
PHP Bug Type: Strings related
Bug description:  htmlspecialchars() returns incorrect results for Unicode 
characters outside BMP

Description:

htmlspecialchars() / htmlentities() returns incorrect results when an 
Unicode character whose codepoint is outside the range of BMP.

Confirmed with 5.3.0, 5.3SVN.


Reproduce code:
---


Expected result:

string(8) "f09080bc"


Actual result:
--
string(8) "266c743b"


-- 
Edit bug report at http://bugs.php.net/?id=49861&edit=1
-- 
Try a snapshot (PHP 5.2):
http://bugs.php.net/fix.php?id=49861&r=trysnapshot52
Try a snapshot (PHP 5.3):
http://bugs.php.net/fix.php?id=49861&r=trysnapshot53
Try a snapshot (PHP 6.0):
http://bugs.php.net/fix.php?id=49861&r=trysnapshot60
Fixed in SVN:
http://bugs.php.net/fix.php?id=49861&r=fixed
Fixed in SVN and need be documented: 
http://bugs.php.net/fix.php?id=49861&r=needdocs
Fixed in release:
http://bugs.php.net/fix.php?id=49861&r=alreadyfixed
Need backtrace:  
http://bugs.php.net/fix.php?id=49861&r=needtrace
Need Reproduce Script:   
http://bugs.php.net/fix.php?id=49861&r=needscript
Try newer version:   
http://bugs.php.net/fix.php?id=49861&r=oldversion
Not developer issue: 
http://bugs.php.net/fix.php?id=49861&r=support
Expected behavior:   
http://bugs.php.net/fix.php?id=49861&r=notwrong
Not enough info: 
http://bugs.php.net/fix.php?id=49861&r=notenoughinfo
Submitted twice: 
http://bugs.php.net/fix.php?id=49861&r=submittedtwice
register_globals:
http://bugs.php.net/fix.php?id=49861&r=globals
PHP 4 support discontinued:  http://bugs.php.net/fix.php?id=49861&r=php4
Daylight Savings:http://bugs.php.net/fix.php?id=49861&r=dst
IIS Stability:   
http://bugs.php.net/fix.php?id=49861&r=isapi
Install GNU Sed: 
http://bugs.php.net/fix.php?id=49861&r=gnused
Floating point limitations:  
http://bugs.php.net/fix.php?id=49861&r=float
No Zend Extensions:  
http://bugs.php.net/fix.php?id=49861&r=nozend
MySQL Configuration Error:   
http://bugs.php.net/fix.php?id=49861&r=mysqlcfg



[PHP-BUG] Bug #53273 [NEW]: mb_strcut() returns garbage with the excessive length parameter

2010-11-08 Thread moriyo...@php.net
From: moriyoshi
Operating system: Irrelevant
PHP version:  Irrelevant
Package:  mbstring related
Bug Type: Bug
Bug description:mb_strcut() returns garbage with the excessive length parameter

Description:

mb_strcut() returns garbage when the following conditions are met:



1. The value specified to length parameter exceeds the length of the
subject 

string.

2. mbstring.internal_encoding is set to some single-byte encoding.



The garbage may consist of uncleared part of the heap that has previously
been 

used for some purpose, which could lead to unexpected information
exposure.



This bug was originally reported by Mateusz Kocielski.



Test script:
---




Expected result:

bbb

Actual result:
--
bbb??D$Ј=m???=m?(?=m?`?=m??5http://bugs.php.net/bug.php?id=53273&edit=1
-- 
Try a snapshot (PHP 5.2):
http://bugs.php.net/fix.php?id=53273&r=trysnapshot52
Try a snapshot (PHP 5.3):
http://bugs.php.net/fix.php?id=53273&r=trysnapshot53
Try a snapshot (trunk):  
http://bugs.php.net/fix.php?id=53273&r=trysnapshottrunk
Fixed in SVN:
http://bugs.php.net/fix.php?id=53273&r=fixed
Fixed in SVN and need be documented: 
http://bugs.php.net/fix.php?id=53273&r=needdocs
Fixed in release:
http://bugs.php.net/fix.php?id=53273&r=alreadyfixed
Need backtrace:  
http://bugs.php.net/fix.php?id=53273&r=needtrace
Need Reproduce Script:   
http://bugs.php.net/fix.php?id=53273&r=needscript
Try newer version:   
http://bugs.php.net/fix.php?id=53273&r=oldversion
Not developer issue: 
http://bugs.php.net/fix.php?id=53273&r=support
Expected behavior:   
http://bugs.php.net/fix.php?id=53273&r=notwrong
Not enough info: 
http://bugs.php.net/fix.php?id=53273&r=notenoughinfo
Submitted twice: 
http://bugs.php.net/fix.php?id=53273&r=submittedtwice
register_globals:
http://bugs.php.net/fix.php?id=53273&r=globals
PHP 4 support discontinued:  http://bugs.php.net/fix.php?id=53273&r=php4
Daylight Savings:http://bugs.php.net/fix.php?id=53273&r=dst
IIS Stability:   
http://bugs.php.net/fix.php?id=53273&r=isapi
Install GNU Sed: 
http://bugs.php.net/fix.php?id=53273&r=gnused
Floating point limitations:  
http://bugs.php.net/fix.php?id=53273&r=float
No Zend Extensions:  
http://bugs.php.net/fix.php?id=53273&r=nozend
MySQL Configuration Error:   
http://bugs.php.net/fix.php?id=53273&r=mysqlcfg