Re: post 5.3.0 development
| From: | Ilia Alshanetsky | Date: | Fri, 26 Jun 2009 23:52:51 +0000 |
| Subject: | Re: post 5.3.0 development | ||
| References: | 1 2 3 4 5 6 7 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-44503@lists.php.net to get a copy of this message | ||
Here is the least intrusive fix I can come up for this bug. When doing curl_close() the dtor will force flush of data on a file stream synching the data to disk. As far as I can tell (using Rasmus' example) this appears to adequately fix the problem and I see no immediate side-effects.
Index: ext/curl/interface.c =================================================================== RCS file: /repository/php-src/ext/curl/interface.c,v retrieving revision 1.62.2.14.2.57 diff -u -p -a -d -r1.62.2.14.2.57 interface.c --- ext/curl/interface.c 15 Jun 2009 12:38:11 -0000 1.62.2.14.2.57 +++ ext/curl/interface.c 26 Jun 2009 23:50:00 -0000 @@ -2093,6 +2093,11 @@ static void _php_curl_close_ex(php_curl efree(ch->header.str); } + /* flush the file handle, so any remaining data is synched to disk */ + if (ch->handlers->write->method = PHP_CURL_FILE && ch->handlers->write->fp) { + fflush(ch->handlers->write->fp); + } + efree(ch->handlers->write); efree(ch->handlers->write_header); efree(ch->handlers->read);
Index: ext/curl/interface.c =================================================================== RCS file: /repository/php-src/ext/curl/interface.c,v retrieving revision 1.62.2.14.2.57 diff -u -p -a -d -r1.62.2.14.2.57 interface.c --- ext/curl/interface.c 15 Jun 2009 12:38:11 -0000 1.62.2.14.2.57 +++ ext/curl/interface.c 26 Jun 2009 23:50:00 -0000 @@ -2093,6 +2093,11 @@ static void _php_curl_close_ex(php_curl efree(ch->header.str); } + /* flush the file handle, so any remaining data is synched to disk */ + if (ch->handlers->write->method = PHP_CURL_FILE && ch->handlers->write->fp) { + fflush(ch->handlers->write->fp); + } + efree(ch->handlers->write); efree(ch->handlers->write_header); efree(ch->handlers->read);