Skip to content

Fix bug #60110 (fclose(), file_put_contents(), copy() do not return false properly) - #12067

Merged
bukka merged 1 commit into
php:masterfrom
bukka:stream_close_flush_retval
Sep 15, 2026
Merged

bukka merged 1 commit into
php:masterfrom
bukka:stream_close_flush_retval

Conversation

@bukka

@bukka bukka commented Aug 28, 2023

Copy link
Copy Markdown
Member

This PR changes the return value to false if the flush operation fails. That introduces possibility to check if those operations have been executed correctly which wasn't previously possible.

@bukka

bukka commented Aug 29, 2023

Copy link
Copy Markdown
Member Author

I have been looking to the pipeline errors and this has got some bigger impact as it is impacting exec exit code as well so this needs a proper analysis of the potential and possibly considering some other ways how to inform users about failed flush. Something needs to be done about this but it's too late for 8.3 so this should hopefully happen in the following minor or major (if BC impact is too big) version.

Comment thread ext/standard/tests/file/bug60110.phpt Outdated
Comment thread main/streams/streams.c Outdated
Comment thread ext/phar/stream.c
@bukka
bukka force-pushed the stream_close_flush_retval branch from 691da05 to bc8e56f Compare September 15, 2026 15:06
…alse properly)

Propagate stream flush and close failures to the return value.

Co-authored-by: Ilija Tovilo <ilija.tovilo@me.com>
@bukka
bukka force-pushed the stream_close_flush_retval branch from bc8e56f to 1d7e76c Compare September 15, 2026 15:55
@bukka
bukka merged commit c07cc85 into php:master Sep 15, 2026
17 of 19 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants