From:             seven at nivas dot hr
Operating system: windows & unix
PHP version:      5.4.7
Package:          mbstring related
Bug Type:         Bug
Bug description:Different behavior of $_POST data when setting 
mbstring.internal_encoding on ru

Description:
------------
I am unaware if this is a bug or feature, but it’s strange. It should be
fixed or documented somewhere. 

I’ve run into this in process of debugging a problem I was having with
old code running on php 5.4 and php 5.4.7 which caused all utf8 form data
to be submitted in wrong encoding. Instead of “[šđčćž]“ I would
get “[šđčćž]“. After a while I've found out that because
of the utf8 changes implemented into php 5.4.x mbstring.http_input=auto
should be set to “pass”.
my php.ini has default_charset = "UTF-8" and my form is on utf8 html page
and <form tag has accept-charset="utf-8".

Imagine having this in .htaccess file:
php_value mbstring.encoding_translation  1
php_value mbstring.internal_encoding     UTF-8
php_value mbstring.http_input            auto

and this in php:
echo $_POST['test']; // outputs [šđčćž]

php ini_get sees this, so all settings are applied ok:
mbstring.internal_encoding:UTF-8
mbstring.encoding_translation:1
mbstring.http_input:auto

The utf8 form data problem occurs.

Now, imagine having only this in .htaccess (since encoding_translation is
PHP_INI_PERDIR setting and can’t be set from runtime):
php_value mbstring.encoding_translation  1

and this in  php:
mb_internal_encoding ('UTF-8');
mb_http_input('auto');
echo $_POST['test']; // outputs [šđčćž]

php ini_get sees this, so all settings are applied ok:
mbstring.internal_encoding:UTF-8
mbstring.encoding_translation:1
mbstring.http_input:auto

No utf8 data form submission problem.


mbstring.internal_encoding is PHP_INI_ALL setting, however, it does not
behave the same if set from .htaccess or .php. It seems to me that setting
it from .php does not make any change in how mbstring.http_input will
process form data.



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

Reply via email to