Postponed
Project:
Remote Stream Wrapper
Version:
7.x-1.0-beta2
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
25 Jan 2012 at 15:05 UTC
Updated:
3 Jul 2017 at 21:29 UTC
Jump to comment: Most recent
Comments
Comment #1
dave reidThere's no reference to any kind of 'http_response_header' variable in the module? Where is the PHP notice coming from?
Comment #2
pgrond commentedThe notice is coming from code in a custom module that connects to an Adlib database. This code is assumes there is a $http_repsonse_header in the local scope. Without the remote stream wrapper there is. I use file_get_contents, and that will create one. With the remote stream wrapper enabled the $http_response_header is not available anymore. This is the code that triggers the error:
Comment #3
dave reidHrm. Since we're overriding the HTTP and HTTPS stream wrappers, this global variable is no longer available. I'm not really sure what we can do. I cannot duplicate what PHP is doing because I will not be able to emulate creating a local-scope variable that persists once file_get_contents() is executed.
Comment #4
pgrond commentedHmm, I was guessing some override was the root of the problem ;).
I will try to figure out another way of doing this. Maybe remote stream wrapper is not the solution in this case.
Comment #5
dave reidThe alternative here is maybe to advise you to use drupal_http_request() rather than file_get_contents() to fetch your data since it provides you with a proper $request object back with all the data.
Comment #6
pgrond commentedThat could be an alternative. The only thing is that the rest of the code for the connection with Adlib is Drupal agnostic. It's a library that could be used in any other PHP project. I have to think about it if we want to make it Drupal dependent for this.
Comment #7
dave reidYeah if you want to make it Drupal-agnostic, I'd advise requiring the cURL library and use those functions instead. You could make a Drupal "wrapper" layer on top of this that uses drupal_http_request() instead.
Comment #8
jrbeemanNoting here for others that may run into the issue: I ran into exceptions with use of Composer Manager on a project that are related to this issue. Because remote stream wrappers is overriding the stream wrapper, Composer Manager was throwing exceptions and warnings when installing or updating packages. Fortunately, my project actually didn't need remote stream wrappers, so disabling the module solved the issue for me. I believe a workaround would be to not use `drush composer install` and instead install composer dependencies with just `composer install`.
Comment #9
becw commentedI ran into this issue recently with Acquia Search and the Solarium library: #2891977: Acquia Search uses a Solarium adapter that conflicts with the remote_stream_wrapper module
PHP's usage of the
$http_response_headervariable withfile_get_contents()is very... quirky... and ideally new code shouldn't rely on such anachronistic behavior :)