[wp-trac] [WordPress Trac] #58121: WP_Filesystem_SSH2::put_contents() assumes that PHP's file_put_contents() always returns in int

WordPress Trac noreply at wordpress.org
Wed Apr 12 19:09:24 UTC 2023


#58121: WP_Filesystem_SSH2::put_contents() assumes that PHP's file_put_contents()
always returns in int
----------------------------+-----------------------------
 Reporter:  pbiron          |      Owner:  (none)
     Type:  defect (bug)    |     Status:  new
 Priority:  normal          |  Milestone:  Awaiting Review
Component:  Filesystem API  |    Version:
 Severity:  normal          |   Keywords:
  Focuses:                  |
----------------------------+-----------------------------
 See https://core.trac.wordpress.org/browser/trunk/src/wp-admin/includes
 /class-wp-filesystem-ssh2.php#L285.

 The [https://www.php.net/manual/en/function.file-put-contents.php PHP
 manual for file_put_contents()] says

 > This function returns the number of bytes that were written to the file,
 or false on failure.

 I'm not sure it `file_put_contents()` could always return a boolean
 `false` or whether than is a PHP 8 thing, but we should make sure that the
 Filesystem API accounts for it

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/58121>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list