[wp-trac] [WordPress Trac] #61715: Only type cast a scalar $comment_id in get_comment_author_link()
WordPress Trac
noreply at wordpress.org
Thu Jul 25 22:36:29 UTC 2024
#61715: Only type cast a scalar $comment_id in get_comment_author_link()
--------------------------------------+-----------------------------
Reporter: SergeyBiryukov | Owner: SergeyBiryukov
Type: defect (bug) | Status: closed
Priority: normal | Milestone: 6.7
Component: Comments | Version: 6.2
Severity: normal | Resolution: fixed
Keywords: good-first-bug has-patch | Focuses:
--------------------------------------+-----------------------------
Changes (by SergeyBiryukov):
* owner: (none) => SergeyBiryukov
* status: new => closed
* resolution: => fixed
Comment:
In [changeset:"58809" 58809]:
{{{
#!CommitTicketReference repository="" revision="58809"
Comments: Only type cast a scalar `$comment_id` in
`get_comment_author_link()`.
This aims to resolve a fatal error when the incoming `$comment_id` is an
instance of `WP_Comment` (or any object) without a `comment_ID` property
defined, or if it's empty:
{{{
Object of class WP_Comment could not be converted to string
}}}
This commit mirrors the changes previously made for a similar code
fragment in `get_comment_author()`.
Includes:
* Unit tests to demonstrate the fatal error and validate the fix.
* Changing the default value for a non-existent comment ID in
`get_comment_author()` from an empty string to zero as a numeric string,
for consistency with `get_comment_ID()`.
Follow-up to [52818], [55289], [58335], [58755].
Props narenin, mukesh27, iflairwebtechnologies, umeshsinghin,
SergeyBiryukov.
Fixes #61715.
}}}
--
Ticket URL: <https://core.trac.wordpress.org/ticket/61715#comment:8>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list