Opened 17 years ago
Closed 15 years ago
#5110 closed defect (bug) (invalid)
in_category function does no sanity checking
Reported by: | tomsing1 | Owned by: | markjaquith |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | 2.3 |
Component: | Template | Keywords: | has-patch 2nd-opinion |
Focuses: | Cc: |
Description
Using Wordpress 2.3 and themes "Fallseason 1.1" and "TerraFirma 3.4", I noticed the following warning displayed at the top of the page:
Warning: array_key_exists() [function.array-key-exists]: The first argument should be either a string or an integer in /wordpress/wp-includes/category-template.php on line 176
This problem was reported by others using different themes, too:
http://wordpress.org/support/topic/135658
http://wordpress.org/support/topic/132280
and it was suggested that this might be a bug in the "on_category" function itself, as it is not confined to any single theme.
Attachments (2)
Change History (6)
#1
@
17 years ago
- Summary changed from on_category function in category-template.php outputs warning with different themes to in_category function does no sanity checking
This is in_category, not on_category.
Some error checking should be performed to see if $category is null, and if so, return false. Diff attached.
#3
@
17 years ago
- Keywords has-patch 2nd-opinion added
- Milestone changed from 2.3.1 to 2.4
- Owner changed from anonymous to markjaquith
- Status changed from new to assigned
Updated patch casts $category
to an absolute integer, and then checks if it is zero. Should catch more errors, such as in_category('category-name')
Patches go into trunk first, and then are considered for backporting to 2.3.1
Patch to add sanity checking to $category value