iliaa Thu May 21 12:52:05 2009 UTC
Modified files: (Branch: PHP_5_3)
/php-src/ext/curl interface.c
Log:
Fixed bug #48207 (CURLOPT_(FILE|WRITEHEADER options do not error out when
working with a non-writable stream)
http://cvs.php.net/viewvc.cgi/php-src/ext/curl/interface.c?r1=1.62.2.14.2.27.2.48&r2=1.62.2.14.2.27.2.49&diff_format=u
Index: php-src/ext/curl/interface.c
diff -u php-src/ext/curl/interface.c:1.62.2.14.2.27.2.48
php-src/ext/curl/interface.c:1.62.2.14.2.27.2.49
--- php-src/ext/curl/interface.c:1.62.2.14.2.27.2.48 Wed May 20 09:26:12 2009
+++ php-src/ext/curl/interface.c Thu May 21 12:52:05 2009
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: interface.c,v 1.62.2.14.2.27.2.48 2009/05/20 09:26:12 tony2001 Exp $ */
+/* $Id: interface.c,v 1.62.2.14.2.27.2.49 2009/05/21 12:52:05 iliaa Exp $ */
#define ZEND_INCLUDE_FULL_WINDOWS_HEADERS
@@ -1649,12 +1649,24 @@
error = CURLE_OK;
switch (option) {
case CURLOPT_FILE:
- ch->handlers->write->fp = fp;
- ch->handlers->write->method =
PHP_CURL_FILE;
+ if (((php_stream *) what)->mode[0] !=
'r') {
+ ch->handlers->write->fp = fp;
+ ch->handlers->write->method =
PHP_CURL_FILE;
+ } else {
+ php_error_docref(NULL
TSRMLS_CC, E_WARNING, "the provided file handle is not writable");
+ RETVAL_FALSE;
+ return 1;
+ }
break;
case CURLOPT_WRITEHEADER:
- ch->handlers->write_header->fp = fp;
- ch->handlers->write_header->method =
PHP_CURL_FILE;
+ if (((php_stream *) what)->mode[0] !=
'r') {
+ ch->handlers->write_header->fp
= fp;
+
ch->handlers->write_header->method = PHP_CURL_FILE;
+ } else {
+ php_error_docref(NULL
TSRMLS_CC, E_WARNING, "the provided file handle is not writable");
+ RETVAL_FALSE;
+ return 1;
+ }
break;
case CURLOPT_INFILE:
zend_list_addref(Z_LVAL_PP(zvalue));
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php