google-cloud-php
google-cloud-php copied to clipboard
[Storage] scandir() truncates names in "root directory"
When scandir() is used with stream wrapper to list «top-level» objects (with no slashes in their names) listed names are truncated (the first byte of each name is missing).
Environment details
- Package name and version: Google Cloud Storage, 1.21.0
Steps to reproduce
- Register stream wrapper.
- Create some objects with names containing no slashes.
- Call
scandir()passing bucket name with no object name prefix.
Code example
$storage = new Google\Cloud\Storage\StorageClient();
$storage->registerStreamWrapper();
file_put_contents('gs://my-bucket/foo', 'hi ');
file_put_contents('gs://my-bucket/bar', 'all');
$names = scandir('gs://my-bucket'); // expected ['bar', 'foo']
var_dump($names); // got ['ar', 'oo']
@ava12 nice find. Is this something you can address along with the other stream wrapper work you've been doing?
Well, I can add a commit to PR #3108, but I was thinking about a separate PR, which could be reviewed and approved quicker.
I agree, separate PR would be best. I just meant since you're already working on it and it's probably fresh in your mind.