From:             hello at iwamot dot com
Operating system: *
PHP version:      5.3.0
PHP Bug Type:     Strings related
Bug description:  htmlentities/htmlspecialchars accept partial multibyte 
sequences still

Description:
------------
PHP 5 ChangelLog says "Fixed htmlentities/htmlspecialchars not to accept
partial multibyte sequences."
http://www.php.net/ChangeLog-5.php#5.2.5

But it has not been fixed in reality. Please correct the log, or
investigate my patch.
http://iwamot.com/misc/html.c.patch.20091008

Reproduce code:
---------------
// Shift_JIS
echo htmlspecialchars("\x80",  ENT_QUOTES, 'Shift_JIS') . "!\n";
echo htmlspecialchars("\x81/", ENT_QUOTES, 'Shift_JIS') . "!\n";
// EUC-JP
echo htmlspecialchars("\x80",  ENT_QUOTES, 'EUC-JP')    . "!\n";
echo htmlspecialchars("\xA1/", ENT_QUOTES, 'EUC-JP')    . "!\n";

Expected result:
----------------
returning empty string (as well as my patch):

!
!
!
!

or sanitizing:

!
/!
!
/!

Actual result:
--------------
_!
_/!
_!
_/!

("_" means an invalid byte)

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

Reply via email to