ID: 44624
Comment by: script-kid at hotmail dot co dot jp
Reported By: sh_tanaka at mail dot goo dot ne dot jp
Status: Open
Bug Type: mbstring related
Operating System: Solaris 8
PHP Version: 5.2.5
New Comment:
Hi. I have the same problem with PHP-5.2.5 on RedHasES4.
I guess that sapi_module.input_filter in main/rfc1867.c seem to be
return 0 when post multipart/form-data. I confirmed this by putting
Debug code.
main/rfc1867.c:925
> if (sapi_module.input_filter(PARSE_POST, param, &value,
value_len, &new_val_len TSRMLS_CC)) {
> if (php_rfc1867_callback != NULL) {
> multipart_event_formdata event_formdata;
> size_t newlength = 0;
>
> event_formdata.post_bytes_processed = SG(read_post_bytes);
> event_formdata.name = param;
> event_formdata.value = &value;
> event_formdata.length = new_val_len;
> event_formdata.newlength = &newlength;
> if (php_rfc1867_callback(MULTIPART_EVENT_FORMDATA,
&event_formdata, &event_extra_data TSRMLS_CC) == FAILURE) {
> efree(param);
> efree(value);
> continue;
> }
> new_val_len = newlength;
> }
So, The follow process is not done.
main/rfc1867.c:943
>#if HAVE_MBSTRING && !defined(COMPILE_DL_MBSTRING)
> if (php_mb_encoding_translation(TSRMLS_C)) {
> php_mb_gpc_stack_variable(param, value, &val_list,
&len_list,
> &num_vars, &num_vars_max TSRMLS_CC);
> } else {
> safe_php_register_variable(param, value, new_val_len,
array_ptr, 0 TSRMLS_CC);
> }
>#else
> safe_php_register_variable(param, value, new_val_len,
array_ptr, 0 TSRMLS_CC);
>#endif
> } else if (php_rfc1867_callback != NULL) {
It seem to work properly when I tyr to change code like that.
$ diff -u main/rfc1867.c.org main/rfc1867.c
--- main/rfc1867.c.org 2007-07-18 08:46:40.000000000 +0900
+++ main/rfc1867.c 2008-04-08 21:55:05.000000000 +0900
@@ -937,33 +937,34 @@
efree(value);
continue;
}
new_val_len = newlength;
}
-#if HAVE_MBSTRING && !defined(COMPILE_DL_MBSTRING)
- if (php_mb_encoding_translation(TSRMLS_C)) {
- php_mb_gpc_stack_variable(param, value, &val_list,
&len_list,
- &num_vars, &num_vars_max TSRMLS_CC);
- } else {
- safe_php_register_variable(param, value, new_val_len,
array_ptr, 0 TSRMLS_CC);
- }
-#else
- safe_php_register_variable(param, value, new_val_len,
array_ptr, 0 TSRMLS_CC);
-#endif
} else if (php_rfc1867_callback != NULL) {
multipart_event_formdata event_formdata;
event_formdata.post_bytes_processed = SG(read_post_bytes);
event_formdata.name = param;
event_formdata.value = &value;
event_formdata.length = value_len;
event_formdata.newlength = NULL;
php_rfc1867_callback(MULTIPART_EVENT_FORMDATA,
&event_formdata, &event_extra_data TSRMLS_CC);
}
+#if HAVE_MBSTRING && !defined(COMPILE_DL_MBSTRING)
+ if (php_mb_encoding_translation(TSRMLS_C)) {
+ php_mb_gpc_stack_variable(param, value, &val_list,
&len_list,
+ &num_vars, &num_vars_max TSRMLS_CC);
+ } else {
+ safe_php_register_variable(param, value, new_val_len,
array_ptr, 0 TSRMLS_CC);
+ }
+#else
+ safe_php_register_variable(param, value, new_val_len,
array_ptr, 0 TSRMLS_CC);
+#endif
+
if (!strcasecmp(param, "MAX_FILE_SIZE")) {
max_file_size = atol(value);
}
Previous Comments:
------------------------------------------------------------------------
[2008-04-03 05:38:45] sh_tanaka at mail dot goo dot ne dot jp
Description:
------------
Encoding translation of incomming posted data does't work when enctype
attribute in from element is set to multipart/form-data.
We are plannning to upgrade PHP4.3.11 to 5.2.5 and now we are testing
all applications.
Translation of PHP4.3.11 is OK, but NO translation occurrs on
PHP5.2.5.
Online manual( http://www.php.net/manual/en/ref.mbstring.php ) says,
> Note: In PHP 4.3.2 or earlier versions, there was a limitation in
> this functionality that mbstring does not perform character
> encoding conversion in POST data if the enctype attribute in the
> form element is set to multipart/form-data.
If conversion in PHP 5.2.5 is as same as PHP4.3.2 or earlier versions,
online manual should be corrected.
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=44624&edit=1