Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Google\Cloud\Storage\StreamWrapper::stream_set_option is not implemented! #4744

Closed
am-adnbp opened this issue Dec 7, 2021 · 2 comments · Fixed by #5067
Closed

Google\Cloud\Storage\StreamWrapper::stream_set_option is not implemented! #4744

am-adnbp opened this issue Dec 7, 2021 · 2 comments · Fixed by #5067
Assignees
Labels
api: storage Issues related to the Cloud Storage API. type: question Request for information or clarification. Not an issue.

Comments

@am-adnbp
Copy link

am-adnbp commented Dec 7, 2021

Hi, after talk with google support they recommended me to write directly here.

We have upgraded our developments from php7.3 to php7.4 and we started to receive a Warning message when we include some file from Google Storage Bucket.

Our code execute an include_once("gs://xxxxx/xxx.php") and to do dat we have to execute previously the following code:

$client = new StorageClient(['projectId' => $this->gc_project_id]);
$client->registerStreamWrapper();

This allow to register the StreamWrapper that allows to include a PHP file from 'gs://path'

In php7.4 we receive in APPENGINE standard version php74 de following Warning appears in the Loggins in all calls after doing the include

 Google\Cloud\Storage\StreamWrapper::stream_set_option is not implemented!

Official documentation of PHP: https://www.php.net/manual/en/migration74.incompatible.php says

When using include/require on a stream, streamWrapper::stream_set_option() will be invoked with the STREAM_OPTION_READ_BUFFER option. Custom stream wrapper implementations may need to implement the streamWrapper::stream_set_option() method to avoid a warning (always returning false is a sufficient implementation).

So if you add Google\Cloud\Storage\StreamWrapper::stream_set_option funcion returning false it will be enough

Environment details

  • OS: Appengine Standard
  • PHP version: 7.4
  • Package name and version: "google/cloud-storage": "^1.25"

Steps to reproduce

Deploy in appengine standard php74 a script that includes a php file from a Datastorage bucket

Code example

# example
$client = new StorageClient(['projectId' => '<your-project>']);
$client->registerStreamWrapper();
include_once('gs://bucket/path-to-file-php');
# Now see the logs.

Thanks!

@yoshi-automation yoshi-automation added triage me I really want to be triaged. 🚨 This issue needs some love. labels Dec 8, 2021
@danoscarmike danoscarmike added api: storage Issues related to the Cloud Storage API. and removed triage me I really want to be triaged. 🚨 This issue needs some love. labels Jan 5, 2022
@yoshi-automation yoshi-automation added triage me I really want to be triaged. 🚨 This issue needs some love. labels Jan 5, 2022
@frankyn frankyn added type: question Request for information or clarification. Not an issue. and removed triage me I really want to be triaged. 🚨 This issue needs some love. labels Jan 7, 2022
@frankyn
Copy link
Member

frankyn commented Jan 7, 2022

Hi @saranshdhingra could you take a look at this question for the Storage client?

@saranshdhingra
Copy link
Contributor

Hi @am-adnbp,
Thanks for filling the issue.

I was able to recreate the issue and I also tried implementing stream_set_option on the StreamWrapper class locally and it did seem to remove the warning like you have noted.

Let me get back to you after discussing this internally.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: storage Issues related to the Cloud Storage API. type: question Request for information or clarification. Not an issue.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants