Make WordPress Core

Opened 5 weeks ago

Closed 5 weeks ago

Last modified 5 weeks ago

#62803 closed defect (bug) (fixed)

Fix update_attached_file return type comment

Reported by: arnoutblueshell's profile arnoutblueshell Owned by: sergeybiryukov's profile SergeyBiryukov
Milestone: 6.8 Priority: normal
Severity: minor Version: trunk
Component: Posts, Post Types Keywords: has-patch
Focuses: docs, coding-standards Cc:

Description

The current return type comment of update_attached_file is inaccurate. It only has the correct return type when the post meta is deleted. But doesn't take into consideration when the post meta is updated.

Proposed new comment:

/**
 * Updates attachment file path based on attachment ID.
 *
 * Used to update the file path of the attachment, which uses post meta name
 * '_wp_attached_file' to store the path of the attachment.
 *
 * @since 2.1.0
 *
 * @param int    $attachment_id Attachment ID.
 * @param string $file          File path for the attachment.
 * @return int|bool Meta ID if the key didn't exist, true on success,
 *                  false on failure or if the value passed to the function
 *                  is the same as the one that is already in the database.
 */
function update_attached_file( $attachment_id, $file ) {

Attachments (1)

62803.patch (693 bytes) - added by karthickmurugan 5 weeks ago.
Patch file with updated comments

Download all attachments as: .zip

Change History (5)

#1 @SergeyBiryukov
5 weeks ago

  • Component changed from General to Posts, Post Types
  • Focuses docs added
  • Milestone changed from Awaiting Review to 6.8
  • Owner set to SergeyBiryukov
  • Status changed from new to reviewing

@karthickmurugan
5 weeks ago

Patch file with updated comments

#2 @karthickmurugan
5 weeks ago

  • Keywords has-patch reporter-feedback needs-testing added

@arnoutblueshell - Thank you creating this issue. I have created a patch file for updating the comments in the function update_attached_file.

#3 @SergeyBiryukov
5 weeks ago

  • Resolution set to fixed
  • Status changed from reviewing to closed

In 59602:

Docs: Correct @return value for update_attached_file().

Follow-up to [4612], [21967], [24490], [47611], [48214].

Props arnoutblueshell, karthickmurugan, SergeyBiryukov.
Fixes #62803.

#4 @SergeyBiryukov
5 weeks ago

  • Keywords reporter-feedback needs-testing removed
Note: See TracTickets for help on using tickets.