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

Warning: touch(): Google\Cloud\Storage\StreamWrapper::stream_metadata is not implemented! #5118

Closed
icedevelopment opened this issue Feb 14, 2022 · 3 comments · Fixed by #7144
Assignees
Labels
api: storage Issues related to the Cloud Storage API. priority: p2 Moderately-important priority. Fix may not be included in next release. type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design.

Comments

@icedevelopment
Copy link

Hi,

I'm getting the following PHP warning: Warning: touch(): Google\Cloud\Storage\StreamWrapper::stream_metadata is not implemented! when trying to install a 3rd party WordPress plugin that calls the touch() PHP function.
Internally PHP calls streamWrapper::stream_metadata() as mentionned in its documentation which is indeed not implemented in Google\Cloud\Storage\StreamWrapper in the GCS WordPress plugin.

The issue looks similar to #4744 (fixed in #5067).

Environment details

  • OS: Google App Engine Standard
  • PHP version: 7.2
  • Package name and version: google/cloud-storage v1.22.0 (from https://wordpress.org/plugins/gcs/ 0.1.6) on WordPress 5.9.

Steps to reproduce

  1. Install the latest WordPress and GCS plugin.
  2. Run PHP code calling touch() after Google\Cloud\Storage\StreamWrapper::register has been called, for example at the beginning of your theme functions.php.

Code example

<?php
// wp-content/themes/twentytwentytwo/functions.php

touch('gs://my-storage/1/file.txt');

// ...

@saranshdhingra @bshaffer could any of you have a look at this please?

Thanks!

@yoshi-automation yoshi-automation added the triage me I really want to be triaged. label Feb 15, 2022
@saranshdhingra saranshdhingra added the status: investigating The issue is under investigation, which is determined to be non-trivial. label Feb 15, 2022
@yoshi-automation yoshi-automation removed the triage me I really want to be triaged. label Feb 15, 2022
@icedevelopment
Copy link
Author

Just wanted to add that the problem is the same with chmod(), chown() and chgrp() since they all call streamWrapper::stream_metadata().

@saranshdhingra
Copy link
Contributor

Hi @icedevelopment
Just to update you.

The fix for removing the warning is simple as you already have discovered.
However, the methods touch, file_put_contents(with an empty string) and fwrite with empty data aren't yet working.

So, for your particular use case, just fixing the warning may not work.

I will however keep you updated on this.

@saranshdhingra saranshdhingra self-assigned this Feb 25, 2022
@saranshdhingra saranshdhingra added api: storage Issues related to the Cloud Storage API. and removed status: investigating The issue is under investigation, which is determined to be non-trivial. labels Feb 25, 2022
@yoshi-automation yoshi-automation added triage me I really want to be triaged. 🚨 This issue needs some love. labels Feb 25, 2022
@danielduhh danielduhh added type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design. priority: p2 Moderately-important priority. Fix may not be included in next release. labels Feb 25, 2022
@yoshi-automation yoshi-automation removed 🚨 This issue needs some love. triage me I really want to be triaged. labels Feb 25, 2022
@vishwarajanand
Copy link
Contributor

I attempted a change and it seems to fix the issue of warnings, but it indeed does not make any file.
So, I added the code to create a file in stream_metadata.
However, I am unable to get file_put_contents and fwrite working for empty files. I think thats okay, since we have touch as a workaround.

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. priority: p2 Moderately-important priority. Fix may not be included in next release. type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants