Oh, I forgot to say: no, curl_exec does not close the file handle.
This should and does occur later with fclose().

If it did, the stream_get_contents() would fail with an error (cos the
filehandle would technically no longer exist), but it doesn't.


On Sun, Aug 30, 2009 at 8:06 PM, Colin<[email protected]> wrote:
> Hi Chris
>
> Yes, file_get_contents() works, but that's because it sets it's own
> filehandle when it opens and reads the file, rather than using the
> file handle already open. stream_get_contents() uses an already open
> filehandle, and this needs read permissions. This is ultimately where
> the problem was.
>
> The latest SVN code has the correct permissions and resolves the
> issue, without resorting to using file_get_contents().
>
> Cheers,
> Colin
>
>
> On Sat, Aug 29, 2009 at 3:38 PM, Chris
> Tankersley<[email protected]> wrote:
>>
>> curlrequestprocessor.php line 87 is using stream_get_contents after
>> the call to CURL. Changing it to file_get_contents causes the body to
>> return properly. I will test it with FlickrFeed later, but initial
>> tests seem to show the stream_get_contents to be the problem.
>>
>> Since CURLOPT_FILE takes a resource, does running the curl_exec close
>> out that resource, making stream_get_contents fail (and thereby making
>> file_get_contents work)?
>>
>> From the PHP Manual for stream_get_contents:
>> Identical to file_get_contents(), except that stream_get_contents()
>> operates on an already open stream resource and returns the remaining
>> contents in a string, up to maxlength  bytes and starting at the
>> specified offset .
>>
>> Chris
>>
>> On Sat, Aug 29, 2009 at 7:36 AM, Chris
>> Tankersley<[email protected]> wrote:
>>> Since the fix just removed using the tmpfile function and just jumps
>>> straight to using the cache directory, is your cache directory
>>> writable?
>>>
>>> Chris
>>>
>>> On Sat, Aug 29, 2009 at 5:10 AM, Ali B.<[email protected]> wrote:
>>>> Thanks for taking the time to investigate this Colin. r3693 works around a
>>>> bug in the latest versions of PHP. Not really the first time PHP does that
>>>> to us. Which makes you think if these issue should be worked around in the
>>>> first place.
>>>>
>>>> As for fixing it, I have honestly no idea how to get Remote Request to work
>>>> again without "breaking" it for PHP 5.2.10 and 5.3. I'll have to leave it
>>>> for the more experienced.
>>>>
>>>> On Sat, Aug 29, 2009 at 6:52 PM, Colin <[email protected]> wrote:
>>>>>
>>>>> Right, it's the changes that were introduced in r3693 that are
>>>>> responsible.  r3692 works as expected. r3693 doesn't. I don't have
>>>>> time right now to investigate these changes or log a bug, but will try
>>>>> take a look later this weekend if no one else gets the chance.
>>>>>
>>>>>
>>>>>
>>>>> On Sat, Aug 29, 2009 at 9:09 AM, Colin<[email protected]> wrote:
>>>>> > I noticed this too, but blamed it on my feed source and didn't
>>>>> > investigate further.
>>>>> >
>>>>> > I think I can probably trawl back through my logs and see when it
>>>>> > first started occurring for me.
>>>>> >
>>>>> >
>>>>> > On Fri, Aug 28, 2009 at 8:21 AM, Ali B.<[email protected]> wrote:
>>>>> >> I've noticed this issue recently while working with the flickrfeed
>>>>> >> plugin.
>>>>> >> Whatever URL I have a new remote request to fetch, I get a blank
>>>>> >> response
>>>>> >> body. The response header is returned with a 200 status. But the body
>>>>> >> is
>>>>> >> always blank no matter what URL is being fetched. Here's an example:
>>>>> >>
>>>>> >> $call = new RemoteRequest('http://habariproject.org/en/atom/1');
>>>>> >> $result = $call->execute();
>>>>> >> Utils::debug($call);
>>>>> >> Utils::debug($result);
>>>>> >> Utils::debug($call->get_response_header());
>>>>> >> Utils::debug($call->get_response_body());
>>>>> >>
>>>>> >> The results:
>>>>> >>
>>>>> >> -----------------------------------------------------------------------------------------------------------------
>>>>> >> object RemoteRequest Object
>>>>> >> (
>>>>> >>     [method:private] => GET
>>>>> >>     [url:private] => http://habariproject.org/en/atom/1
>>>>> >>     [params:private] => Array
>>>>> >>         (
>>>>> >>         )
>>>>> >>
>>>>> >>     [headers:private] => Array
>>>>> >>         (
>>>>> >>             [User-Agent] => Habari/0.7-alpha
>>>>> >>         )
>>>>> >>
>>>>> >>     [postdata:private] => Array
>>>>> >>         (
>>>>> >>         )
>>>>> >>
>>>>> >>     [files:private] => Array
>>>>> >>         (
>>>>> >>         )
>>>>> >>
>>>>> >>     [body:private] =>
>>>>> >>     [timeout:private] => 180
>>>>> >>     [processor:private] => CURLRequestProcessor Object
>>>>> >>         (
>>>>> >>             [response_body:private] =>
>>>>> >>             [response_headers:private] => HTTP/1.1 200 OK
>>>>> >> Date: Fri, 28 Aug 2009 07:17:45 GMT
>>>>> >> Server: Apache/2.2.8 (Ubuntu) DAV/2 SVN/1.5.1 mod_python/3.3.1
>>>>> >> Python/2.5.2
>>>>> >> PHP/5.2.4-2ubuntu5.6 with Suhosin-Patch mod_ssl/2.2.8 OpenSSL/0.9.8g
>>>>> >> X-Powered-By: PHP/5.2.4-2ubuntu5.6
>>>>> >> Set-Cookie: PHPSESSID=77a625c79c865fa68480f8ce3cc3c4b6; path=/
>>>>> >> Expires: Thu, 19 Nov 1981 08:52:00 GMT
>>>>> >> Cache-Control: no-store, no-cache, must-revalidate, post-check=0,
>>>>> >> pre-check=0
>>>>> >> Pragma: no-cache
>>>>> >> Vary: Accept-Encoding
>>>>> >> Transfer-Encoding: chunked
>>>>> >> Content-Type: application/atom+xml
>>>>> >>             [executed:private] => 1
>>>>> >>             [can_followlocation:private] => 1
>>>>> >>             [max_redirs:private] => 5
>>>>> >>             [_headers:private] => HTTP/1.1 200 OK
>>>>> >> Date: Fri, 28 Aug 2009 07:17:45 GMT
>>>>> >> Server: Apache/2.2.8 (Ubuntu) DAV/2 SVN/1.5.1 mod_python/3.3.1
>>>>> >> Python/2.5.2
>>>>> >> PHP/5.2.4-2ubuntu5.6 with Suhosin-Patch mod_ssl/2.2.8 OpenSSL/0.9.8g
>>>>> >> X-Powered-By: PHP/5.2.4-2ubuntu5.6
>>>>> >> Set-Cookie: PHPSESSID=77a625c79c865fa68480f8ce3cc3c4b6; path=/
>>>>> >> Expires: Thu, 19 Nov 1981 08:52:00 GMT
>>>>> >> Cache-Control: no-store, no-cache, must-revalidate, post-check=0,
>>>>> >> pre-check=0
>>>>> >> Pragma: no-cache
>>>>> >> Vary: Accept-Encoding
>>>>> >> Transfer-Encoding: chunked
>>>>> >> Content-Type: application/atom+xml
>>>>> >>
>>>>> >>
>>>>> >>         )
>>>>> >>
>>>>> >>     [executed:private] => 1
>>>>> >>     [response_body:private] =>
>>>>> >>     [response_headers:private] => HTTP/1.1 200 OK
>>>>> >> Date: Fri, 28 Aug 2009 07:17:45 GMT
>>>>> >> Server: Apache/2.2.8 (Ubuntu) DAV/2 SVN/1.5.1 mod_python/3.3.1
>>>>> >> Python/2.5.2
>>>>> >> PHP/5.2.4-2ubuntu5.6 with Suhosin-Patch mod_ssl/2.2.8 OpenSSL/0.9.8g
>>>>> >> X-Powered-By: PHP/5.2.4-2ubuntu5.6
>>>>> >> Set-Cookie: PHPSESSID=77a625c79c865fa68480f8ce3cc3c4b6; path=/
>>>>> >> Expires: Thu, 19 Nov 1981 08:52:00 GMT
>>>>> >> Cache-Control: no-store, no-cache, must-revalidate, post-check=0,
>>>>> >> pre-check=0
>>>>> >> Pragma: no-cache
>>>>> >> Vary: Accept-Encoding
>>>>> >> Transfer-Encoding: chunked
>>>>> >> Content-Type: application/atom+xml
>>>>> >>     [user_agent:private] => Habari/0.7-alpha
>>>>> >> )
>>>>> >>
>>>>> >> -----------------------------------------------------------------------------------------------------------------
>>>>> >> boolean 1
>>>>> >>
>>>>> >> -----------------------------------------------------------------------------------------------------------------
>>>>> >> string HTTP/1.1 200 OK
>>>>> >> Date: Fri, 28 Aug 2009 07:17:45 GMT
>>>>> >> Server: Apache/2.2.8 (Ubuntu) DAV/2 SVN/1.5.1 mod_python/3.3.1
>>>>> >> Python/2.5.2
>>>>> >> PHP/5.2.4-2ubuntu5.6 with Suhosin-Patch mod_ssl/2.2.8 OpenSSL/0.9.8g
>>>>> >> X-Powered-By: PHP/5.2.4-2ubuntu5.6
>>>>> >> Set-Cookie: PHPSESSID=77a625c79c865fa68480f8ce3cc3c4b6; path=/
>>>>> >> Expires: Thu, 19 Nov 1981 08:52:00 GMT
>>>>> >> Cache-Control: no-store, no-cache, must-revalidate, post-check=0,
>>>>> >> pre-check=0
>>>>> >> Pragma: no-cache
>>>>> >> Vary: Accept-Encoding
>>>>> >> Transfer-Encoding: chunked
>>>>> >> Content-Type: application/atom+xml
>>>>> >>
>>>>> >> -----------------------------------------------------------------------------------------------------------------
>>>>> >> string
>>>>> >>
>>>>> >> -----------------------------------------------------------------------------------------------------------------
>>>>> >>
>>>>> >> Any idea what's going on with the class?
>>>>> >>
>>>>> >> --
>>>>> >> Ali B. / dmondark
>>>>> >> http://awhitebox.com
>>>>> >>
>>>>> >> >>
>>>>> >>
>>>>> >
>>>>> >
>>>>> >
>>>>> > --
>>>>> > Colin Seymour
>>>>> > Blog: http://www.colinseymour.co.uk
>>>>> > Tech Stuff: http://www.lildude.co.uk
>>>>> >
>>>>>
>>>>>
>>>>>
>>>>> --
>>>>> Colin Seymour
>>>>> Blog: http://www.colinseymour.co.uk
>>>>> Tech Stuff: http://www.lildude.co.uk
>>>>>
>>>>>
>>>>
>>>>
>>>>
>>>> --
>>>> Ali B. / dmondark
>>>> http://awhitebox.com
>>>>
>>>> >>
>>>>
>>>
>>
>> >>
>>
>
>
>
> --
> Colin Seymour
> Blog: http://www.colinseymour.co.uk
> Tech Stuff: http://www.lildude.co.uk
>



-- 
Colin Seymour
Blog: http://www.colinseymour.co.uk
Tech Stuff: http://www.lildude.co.uk

--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at http://groups.google.com/group/habari-dev
-~----------~----~----~----~------~----~------~--~---

Reply via email to