iliaa           Thu May 21 12:53:24 2009 UTC

  Modified files:              (Branch: PHP_5_2)
    /php-src/ext/curl   interface.c 
    /php-src    NEWS 
  Log:
  
  MFB: 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.49&r2=1.62.2.14.2.50&diff_format=u
Index: php-src/ext/curl/interface.c
diff -u php-src/ext/curl/interface.c:1.62.2.14.2.49 
php-src/ext/curl/interface.c:1.62.2.14.2.50
--- php-src/ext/curl/interface.c:1.62.2.14.2.49 Wed May 20 09:26:20 2009
+++ php-src/ext/curl/interface.c        Thu May 21 12:53:24 2009
@@ -16,7 +16,7 @@
    +----------------------------------------------------------------------+
 */
 
-/* $Id: interface.c,v 1.62.2.14.2.49 2009/05/20 09:26:20 tony2001 Exp $ */
+/* $Id: interface.c,v 1.62.2.14.2.50 2009/05/21 12:53:24 iliaa Exp $ */
 
 #define ZEND_INCLUDE_FULL_WINDOWS_HEADERS
 
@@ -1436,12 +1436,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));
http://cvs.php.net/viewvc.cgi/php-src/NEWS?r1=1.2027.2.547.2.1515&r2=1.2027.2.547.2.1516&diff_format=u
Index: php-src/NEWS
diff -u php-src/NEWS:1.2027.2.547.2.1515 php-src/NEWS:1.2027.2.547.2.1516
--- php-src/NEWS:1.2027.2.547.2.1515    Wed May 20 09:06:31 2009
+++ php-src/NEWS        Thu May 21 12:53:24 2009
@@ -29,6 +29,8 @@
 - Fixed bug #48240 (DBA Segmentation fault dba_nextkey). (Felipe)
 - Fixed bug #48224 (Incorrect shuffle in array_rand). (Etienne)
 - Fixed bug #48221 (memory leak when passing invalid xslt parameter). (Felipe)
+- Fixed bug #48207 (CURLOPT_(FILE|WRITEHEADER options do not error out when   
+  working with a non-writable stream). (Ilia)
 - Fixed bug #48206 (Iterating over an invalid data structure
   with RecursiveIteratorIterator leads to a segfault). (Scott)
 - Fixed bug #48204 (xmlwriter_open_uri() does not emit warnings on invalid



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to