Opened 5 years ago
Closed 5 years ago
#47965 closed defect (bug) (fixed)
Missing strict comparison check in REST Autosaves Controller
Reported by: | dkarfa | Owned by: | SergeyBiryukov |
---|---|---|---|
Milestone: | 5.4 | Priority: | normal |
Severity: | normal | Version: | |
Component: | REST API | Keywords: | has-patch dev-feedback commit |
Focuses: | rest-api | Cc: |
Description
Missing Yoda conditions check at wp-includes/rest-api/endpoints/class-wp-rest-autosaves-controller.php
Attachments (2)
Change History (13)
#3
@
5 years ago
- Summary changed from Missing Yoda Conditions check to Missing strict comparison check in REST Autosaves Controller
#4
@
5 years ago
I completely agree with @TimothyBlynJacobs about $post->post_author === $user_id
check. Also the patch doesn't apply properly and I've refreshed it. I hope @dkarfa is OK with it :)
#5
@
5 years ago
- Keywords dev-feedback added
In other places this is used in core, a non-strict comparison check is used as well. For instance, wp_save_post_revision()
or wp_create_post_autosave()
. I think we'd want to be consistent, but I'm not sure.
Cc: @SergeyBiryukov
#6
@
5 years ago
- Milestone changed from Awaiting Review to 5.4
- Owner set to SergeyBiryukov
- Status changed from new to reviewing
This ticket was mentioned in Slack in #core-restapi by timothybjacobs. View the logs.
5 years ago
This ticket was mentioned in Slack in #core by david.baumwald. View the logs.
5 years ago
Note: See
TracTickets for help on using
tickets.
Thanks for the patch @dkarfa!
I'm a bit worried about the
$post->post_author === $user_id
check. In the type doc it is listed as a string and accompanied by "A numeric string, for compatibility reasons."