Repository navigation
Conversation
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. Core Committers: Use this line as a base for the props when committing in SVN: To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. Props Bot commandsYou can trigger Props Bot actions by commenting on this PR:
|
Test using WordPress PlaygroundThe changes in this pull request can previewed and tested using a WordPress Playground instance. WordPress Playground is an experimental project that creates a full WordPress instance entirely within the browser. Some things to be aware of
For more details about these limitations and more, check out the Limitations page in the WordPress Playground documentation. |
WP_Filesystem_Direct::put_contents()checks the byte count fromfwrite()but ignores the result offclose(). As of PHP 8.6,fclose()returnsfalsewhen flushing or closing the stream fails, so the method can report success, and go on to change permissions, for a write that never completed.This checks the close result alongside the byte count. The handle is still always closed. Successful, empty and short writes keep their existing results.
The same PHP change was handled for image saves in [65294] and for the test stream in [65278]. This covers the direct filesystem method.
Testing
putContents.phpputContents.phptests/filesystem/wpFilesystemDirectputContents.phptests/filesystem/wpFilesystemDirectPHPCS passes on both changed files.
One thing to be aware of: on PHP 8.6 a userland stream wrapper with no
stream_flush()method fails on close, soput_contents()would returnfalsefor it, as image saves now do.Trac ticket: https://core.trac.wordpress.org/ticket/66784
Use of AI Tools
AI assistance: Yes
Tool(s): Codex, Claude Code
Used for: Finding the unchecked close, writing the change, the tests and this description, and running the tests. The test results above are automated runs by those tools.