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

only fclose the stream if it's a valid resource #12908

Merged
merged 3 commits into from
Mar 16, 2023

Conversation

i-just
Copy link
Contributor

@i-just i-just commented Mar 16, 2023

Description

When Google Cloud Storage is done with the $stream, it’s no longer recognised as a valid resource. It comes back with type=Unknown and then causes fclose() to trigger an error: TypeError: fclose(): supplied resource is not a valid stream resource.

Wrapping fclose() in an is_resource() check makes it behave as expected. Also tested against Local FS and Amazon S3. In both cases, $stream is still a valid resource which makes fclose() work as expected.

Related issues

#12878

@i-just i-just requested a review from a team as a code owner March 16, 2023 10:33
@brandonkelly brandonkelly self-requested a review as a code owner March 16, 2023 15:45
@brandonkelly brandonkelly merged commit 96c8822 into develop Mar 16, 2023
@brandonkelly brandonkelly deleted the bugfix/12878-fclose-with-google-cloud-storage branch March 16, 2023 15:45
@DynamiteGoesBoom
Copy link

DynamiteGoesBoom commented Mar 16, 2023

FWIW This is happening with Azure Blob Storage as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants