Numeric term fields are strings
|Reported by:||foofy||Owned by:|
The numeric fields (term_id, parent, etc.) on term objects are strings. I only noticed this because term_exists() uses is_int() to determine if the $term value is an ID or slug.
Only ticket I could find about this is #5381.
sanitize_term() should fix this, but it bails early in the "raw" context. sanitize_term_field() sanitizes the numeric fields in every context. I don't see a reason for sanitize_term() to bail early so I made a patch that takes that out. The patch also adds some missing fields to the list of those to be sanitized and changes term_exists() to use is_numeric() (which will correctly identify strings containing only numbers) instead of is_int().
Change History (10)
- Keywords dev-feedback added
- Milestone changed from Awaiting Review to Future Release
- Cc ian_dunn@… added
- Keywords changed from has-patch dev-feedback to has-patch dev-feedback
- Keywords needs-patch added; has-patch dev-feedback removed