Re: [PHP-DEV] Bug w/ multi-dimensional form elements and file uploads?

2001-01-19 Thread Zeev Suraski

If it works, +1 :)

At 15:21 19/1/2001, Sascha Schumann wrote:
> [hate to reply to myself, but I don't want to waste other
> people's time looking into this thing.]
>
> I think I've found the bug.
>
> The comment in rfc1867.c around line 195 says:
>
> start_arr is set to point to 1st [
>
> But the code use strrchr to locate the bracket, so start_arr
> is set to the last bracket.  The attached one-liner fixes it.
>
> Comments?
>
> - Sascha
>
>--
>PHP Development Mailing List 
>To unsubscribe, e-mail: [EMAIL PROTECTED]
>For additional commands, e-mail: [EMAIL PROTECTED]
>To contact the list administrators, e-mail: [EMAIL PROTECTED]

--
Zeev Suraski <[EMAIL PROTECTED]>
CTO &  co-founder, Zend Technologies Ltd. http://www.zend.com/


-- 
PHP Development Mailing List 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP-DEV] Bug w/ multi-dimensional form elements and file uploads?

2001-01-19 Thread Sascha Schumann

[hate to reply to myself, but I don't want to waste other
people's time looking into this thing.]

I think I've found the bug.

The comment in rfc1867.c around line 195 says:

start_arr is set to point to 1st [

But the code use strrchr to locate the bracket, so start_arr
is set to the last bracket.  The attached one-liner fixes it.

Comments?

- Sascha


Index: rfc1867.c
===
RCS file: /repository/php4/main/rfc1867.c,v
retrieving revision 1.58
diff -u -r1.58 rfc1867.c
--- rfc1867.c   2001/01/15 10:50:39 1.58
+++ rfc1867.c   2001/01/19 13:22:27
@@ -195,7 +195,7 @@
 * start_arr is set to point to 1st [
 * end_arr points to last ]
 */
-   is_arr_upload = (start_arr = 
strrchr(namebuf,'[')) && 
+   is_arr_upload = (start_arr = 
+strchr(namebuf,'[')) && 
(end_arr = 
strrchr(namebuf,']')) && 
(end_arr = 
namebuf+strlen(namebuf)-1);
if(is_arr_upload) {


-- 
PHP Development Mailing List 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]


[PHP-DEV] Bug w/ multi-dimensional form elements and file uploads?

2001-01-19 Thread Sascha Schumann

Hi,

please consider this part of a form:

  
  

The file upload code adds Data[user][foo] properly to
HTTP_POST_FILES.  But then, it tries to add variables like
these:

Data[user]_name[bar]
Data[user]_size[bar]
Data[user]_type[bar]

php_register_variable_ex() decides then to nuke the existing
Data[user] entry from the HTTP_POST_FILES hash (because it
sees _name instead of [.*]), so that the previously set
Data[user][foo] entry becomes inaccessible.

Questions:

1.  Is this supposed to work at all?
2.  What do you think of adding Data_name[user][bar] instead
of the above form?

- Sascha


-- 
PHP Development Mailing List 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]