cURL / Mailing Lists / curl-and-php / Single Mail

curl-and-php

Re: multipart/formpost result?

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Tue, 25 Jun 2002 08:48:59 +0200 (MET DST)

On Tue, 25 Jun 2002, [ks_c_5601-1987] "Á¤¹ÎÁÖ" wrote:

[Really, posting this same mail four times won't make us any more happy or
eager to reply.]

> Why is the result of this program like the this?

It looks like a bug.

> What there is the fault.

A bug, probably.

> The postingfieldname does not know why we are changed in this way.
> Inform the invalid program please.

Can you reproduce this problem with the curl stand-alone tool?

[lots of stuff removed]

> --curlgyo1xC0h80m1EP5OD3RQcSQqRqk
> Content-Disposition: form-data; name="modeýýýý1" //<!---The postingfieldname does not know why we are changed in this way.-->
>
> result

Could it be that the string isn't properly zero terminated when the PHP/CURL
module extracts the PHP string using

  zend_hash_get_current_key_ex(postfields, &string_key, &string_key_len,
                               &num_key, 0, NULL);

followed by

  error = curl_formadd(&first, &last,
                        CURLFORM_COPYNAME, string_key,
                        CURLFORM_PTRCONTENTS, postval,
                        CURLFORM_CONTENTSLENGTH, Z_STRLEN_PP(current),
                        CURLFORM_END);

The CURLFORM_COPYNAME option requires a zero terminated string, which this
'string_key' perhaps isn't?

You could try to add

                        CURLFORM_NAMELENGTH, string_key_len,

Which then would take away the need for the zero termination.

I'm not a PHP hacker.

-- 
    Daniel Stenberg -- curl groks URLs -- http://curl.haxx.se/
-------------------------------------------------------
Sponsored by:
ThinkGeek at http://www.ThinkGeek.com/
Received on 2002-06-25