#60032 closed defect (bug) (fixed)
$body_id global variable return value to string not int.
Reported by: | upadalavipul | Owned by: | SergeyBiryukov |
---|---|---|---|
Milestone: | 6.5 | Priority: | normal |
Severity: | normal | Version: | 4.3 |
Component: | General | Keywords: | has-patch changes-requested |
Focuses: | coding-standards | Cc: |
Description (last modified by )
I have reviewed the media.php file code and found the $body_id global variable returns the value int and the comment code mentions string values. So think we need to update the comment code here.
Files:
- wp-admin/includes/media.php
Attachments (1)
Change History (8)
#1
@
10 months ago
- Keywords has-patch commit added
- Milestone changed from Awaiting Review to 6.5
- Version set to 5.3
#2
@
10 months ago
- Keywords changes-requested added; commit removed
- Version changed from 5.3 to 4.3
Hi there, thanks for the patch!
- The suggested change does not look correct to me.
$body_id
is actually a string here, see where it's defined in media-upload.php or plugin-install.php. $body_id
is incorrectly documented asint
inwp_iframe()
. That should be updated tostring
instead.- This was not introduced in [45602] / #47632, but rather in [32643] / #32444.
#3
@
10 months ago
- Description modified (diff)
- Summary changed from $body_id global variable return value int not string. to $body_id global variable return value to string not int.
Thanks @SergeyBiryukov for checking the variable name suggest it's ID so i also think it was integer value 😉
This ticket was mentioned in PR #5754 on WordPress/wordpress-develop by @mukesh27.
10 months ago
#4
Trac ticket: https://core.trac.wordpress.org/ticket/60032
#5
@
10 months ago
- Owner set to SergeyBiryukov
- Resolution set to fixed
- Status changed from new to closed
In 57181:
@SergeyBiryukov commented on PR #5754:
10 months ago
#6
Thanks for the PR! Merged in r57181.
#7
@
8 months ago
If the $body_id
global variable in wp-admin/includes/media.php
is returning a value of type integer, but the comments suggest it should return a string, then indeed, there might be a discrepancy between the expected and actual behavior.
To ensure clarity and consistency, you should update the comments to accurately reflect the type of value returned by the $body_id
global variable.
Here's an example of how you might update the comment:
`php
/
- ID attribute for the body element in the media library. *
- @global int $body_id The ID attribute for the body element. This should be a string value. */
`
By making this change, you're helping to maintain code clarity and ensuring that other developers who work with this code understand the expected data type of the $body_id
global variable.
Hi there! Thanks for ticket and patch.
Good catch, introduced in [45602] / #47632.
Happy to commit but don't have access. @SergeyBiryukov Could you please commit this one?