Make WordPress Core

Opened 10 months ago

Closed 10 months ago

Last modified 10 months ago

#60183 closed defect (bug) (fixed)

Missing $previous_status argument in post trash hooks causes fatal error

Reported by: joelcj91's profile joelcj91 Owned by: joelcj91's profile joelcj91
Milestone: 6.5 Priority: normal
Severity: normal Version: 6.3
Component: Posts, Post Types Keywords: has-patch
Focuses: Cc:

Description

In WordPress 6.3.0, the $previous_status argument was added to the pre_trash_post, wp_trash_post, and trashed_post hooks in wp-includes/post.php. However, this argument was not added to the corresponding hooks in wp-includes/class-wp-customizer-manager.php. This inconsistency leads to a fatal error when the code assumes the presence of the $previous_status argument in Customizer-related contexts.

Attachments (1)

60183.diff (1.8 KB) - added by joelcj91 10 months ago.
First patch

Download all attachments as: .zip

Change History (6)

@joelcj91
10 months ago

First patch

#1 @mukesh27
10 months ago

  • Focuses php-compatibility removed
  • Severity changed from major to normal

Related to [56043]/#58392

#2 @SergeyBiryukov
10 months ago

  • Milestone changed from Awaiting Review to 6.5

Hi there, thanks for the patch! Looks good :)

#3 @SergeyBiryukov
10 months ago

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

In 57238:

Customize: Pass the previous status to post trash hooks when trashing a changeset.

This ensures that the correct number of arguments is passed to post trash hooks in WP_Customize_Manager::trash_changeset_post(), which bypasses wp_trash_post().

Follow-up to [56043].

Props joelcj91, mukesh27.
Fixes #60183.

#4 @SergeyBiryukov
10 months ago

In 57241:

Tests: Add a unit test for post trash hooks executed when trashing a changeset.

The test ensures that the correct number of arguments is passed to post trash hooks in WP_Customize_Manager::trash_changeset_post(), which bypasses wp_trash_post().

Follow-up to [56043], [57238].

See #60183.

#5 @SergeyBiryukov
10 months ago

In 57242:

Tests: Add a @ticket reference for WP_Customize_Manager::trash_changeset_post() test.

Follow-up to [56043], [57238], [57241].

Props mukesh27.
See #60183.

Note: See TracTickets for help on using tickets.