Re: Need karma for committing test patches

From: Date: Tue, 17 May 2011 14:21:59 +0000
Subject: Re: Need karma for committing test patches
References: 1  Groups: php.internals 
Request: Send a blank email to internals+get-52428@lists.php.net to get a copy of this message
Em Tue, 17 May 2011 14:40:53 +0100, Alexey Shein <confik@gmail.com> escreveu:
2) fix for http://bugs.php.net/48203: there's a segfault when CURLOPT_STDERR file pointer is closed before calling curl_exec, i.e. like this: $fp = fopen(dirname(__FILE__) . '/bug48203.tmp', 'w'); $ch = curl_init(); curl_setopt($ch, CURLOPT_VERBOSE, 1); curl_setopt($ch, CURLOPT_STDERR, $fp); curl_setopt($ch, CURLOPT_URL, getenv("PHP_CURL_HTTP_REMOTE_SERVER")); fclose($fp); // <-- premature close of $fp caused a crash! curl_exec($ch); // segfault All tests run ok on php5.3 php5.4 and trunk. Could somebody review this patch since I'm new to developing php and could make some silly mistakes?
A few remarks: * Isn't this supposed to be fixed? Was there something that triggered a regression? * If this strategy is used (checking whether the resource associated with the stored zval is valid), how about curl_multi_exec? * I think a better strategy would be to just dup the file descriptor gotten after the cast in curl_setopt, store it (instead of storing the zval) and close it on curl handle destruction. This way we wouldn't have to worry about zval refcounts or whether the file descriptor obtained is still valid. Could you see if this other strategy works? (otherwise I can do it later this week) -- Gustavo Lopes

« previous php.internals (#52428) next »