Yup, and heavily used by several of the plugins I'm working on. I've looked into this further the problem is the permissions passed to fopen() when opening the file. Only write permissions are given. Accordingly, subsequent reads, as the stream_get_contents() uses to populate $body will silently fail.
Setting the permissions to "w+b" resolves the problem. This all makes sense when you look at what the tmpfile() functions does when it opens a file - it opens it with write AND read permissions. In the original code, the filehandle opened by tmpfile() is never actually closed, accordingly the subsequent fopen() with "wb" perms doesn't do anything and the old perms are kept, and thus the stream_get_contents() worked. I've logged ticket #1055 detailing this issue and provided a patch. If someone with the necessary perms could implement this, that would be great. Cheers, Colin. On Sat, Aug 29, 2009 at 12:36 PM, 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 --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
