Opened 19 years ago
Closed 17 years ago
#5110 closed defect (bug) (invalid)
in_category function does no sanity checking
| Reported by: | tomsing1 | Owned by: | markjaquith |
|---|---|---|---|
| Priority: | normal | Milestone: | |
| Component: | Template | Version: | 2.3 |
| Severity: | normal | Keywords: | has-patch 2nd-opinion |
| Cc: | Focuses: |
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
@
19 years ago
- Summary on_category function in category-template.php outputs warning with different themes → 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
@
19 years ago
- Keywords has-patch 2nd-opinion added
- Milestone 2.3.1 → 2.4
- Owner changed from to
- Status new → 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
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)
Patch to add sanity checking to $category value