Bug #55635 [Asn->]: CURLOPT_BINARYTRANSFER no longer used?

From: Date: Tue, 22 Nov 2011 17:16:01 +0000
Subject: Bug #55635 [Asn->]: CURLOPT_BINARYTRANSFER no longer used?
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-165431@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=55635&edit=1

 ID:                 55635
 Updated by:         pierrick@php.net
 Reported by:        matthijs at stdin dot nl
 Summary:            CURLOPT_BINARYTRANSFER no longer used?
-Status:             Assigned
+Status:             To be documented
 Type:               Bug
 Package:            cURL related
 PHP Version:        trunk-SVN-2011-09-07 (SVN)
 Assigned To:        pierrick
 Block user comment: N
 Private report:     N

 New Comment:

This bug has been fixed in SVN.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
 
Thank you for the report, and for helping us make PHP better.




Previous Comments:
------------------------------------------------------------------------
[2011-11-22 17:13:14] pierrick@php.net

Automatic comment from SVN on behalf of pierrick
Revision: http://svn.php.net/viewvc/?view=revision&revision=319692
Log: Fixed bug #55635

------------------------------------------------------------------------
[2011-09-07 13:41:50] matthijs at stdin dot nl

Description:
------------
While trying to find out what CURLOPT_BINARYTRANSFER did exactly, I found that it isn't used at
all. I looked around in the ext/curl directory in trunk for uses of the PHP_CURL_BINARY and
PHP_CURL_ASCII constants, and found that they're only used for setting the
ch->handlers->write->type value, but this value is never used anywhere.

It seems the last use of the constants has disappeared in r211314 ("fix bug #37061 (curl_exec()
doesn't zero-terminate binary strings) - we get the data length from cURL, so it's binary
safe.
fix leak appearing when re-using curl handle").

I'm not 100% sure my analysis is correct, but if it is, I guess the (code for) the option
should be removed and the documentation updated. there's no need for them to be zero-terminated

It actually makes sense not to distinguish between binary and non-binary results: A normal string is
just a special case of binary string, so always returning a "binary string" should work
just fine. AFAIK strings always have a length associated with them, so zero bytes could occur within
any PHP string (it's just that using strings with zero bytes in them don't always work
with external C functions that expect zero terminated strings...).



------------------------------------------------------------------------



-- 
Edit this bug report at https://bugs.php.net/bug.php?id=55635&edit=1


Thread (2 messages)

« previous php.bugs (#165431) next »