Re: [PATCH] Fix for bug #48607 (ftp_fopen_wrapper)
| From: | Pierre Joye | Date: | Tue, 09 Feb 2010 00:18:49 +0000 |
| Subject: | Re: [PATCH] Fix for bug #48607 (ftp_fopen_wrapper) | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-46963@lists.php.net to get a copy of this message | ||
hi,
On Mon, Feb 8, 2010 at 12:03 PM, Beat Vontobel <b.vontobel@meteonews.ch> wrote:
> I'm new to the PHP internals mailing list (and also to PHP internals in
> general), so let's first say hello to everybody and thanks for your work!
Thanks and welcome to the list :)
> I needed to dive into PHP's internals myself because I hit a problem (which
> I later found to be bug #48607) with the ftp_fopen_wrapper: fwrite basically
> doesn't work at all with FTP, because PHP's implementation is in violation
> of the FTP specs. No EOF is signalled at the end of a transmission -- PHP's
> behaviour after writing to an FTP server has to be treated as an aborted
> connection by a clean server. If an fwrite to an FTP server ever succeeded,
> it was only due to lucky timing coincidence or buggy servers.
>
> The patch below fixes this issue for me. I run it successfully since more
> than a month on two high-load production webservers. I'd be happy if
> somebody more familiar with PHP's internals could review it, apply it to SVN
> and then hopefully close bug #48607.
Do you have tests cases please? Also specify which server you use so
we can run the tests in the similar context, or compare with
alternative ftp servers if necessary.
> Just one important note for the reviewer: I wasn't quite sure on how to
> correctly "hand up" errors to the higher levels of the API. That's where I
> just used php_error_docref(), which is probably not the intended way, but
> worked for me to at least generate a warning. I also now set the return
> value of the function on failure, but realized that it's again hardcoded to
> "success" on higher levels of the code. This would probably make for another
> bug report and more patches.
It would be cleaner to fix them as well then no? Can you give it a try?
Thanks for your work!
Cheers,
--
Pierre
@pierrejoye | http://blog.thepimp.net | http://www.libgd.org