Make WordPress Core

Opened 17 years ago

Closed 14 years ago

#11630 closed defect (bug) (fixed)

0 is not a valid cache key for posts

Reported by: hakre Owned by: ryan
Priority: normal Milestone: 3.5
Component: Cache API Version: 2.9
Severity: normal Keywords:
Cc: Focuses:

Description

input sanitization just in case.

Attachments (3)

11630.patch​ (531 bytes ) - added by hakre 17 years ago.
11630.2.patch​ (1.5 KB ) - added by hakre 17 years ago.
Alternate patch allowing 0 to better reflect the API. various comment and naming-consistency improvements.
11630.3.patch​ (595 bytes ) - added by hakre 17 years ago.
pre-cache-get validation (based on feedback by DD32)

Download all attachments as: .zip

Change History (12)

@hakre
17 years ago

Alternate patch allowing 0 to better reflect the API. various comment and naming-consistency improvements.

@hakre
17 years ago

pre-cache-get validation (based on feedback by DD32)

#1 @hakre
17 years ago

Reviewed the core code now for appeareances. Found only one where this applies (can not speak for third party code and this is an API function).

the .2 + .3 patch could be merged for an overall improvement.

#2 @hakre
17 years ago

  • Keywords dev-feedback added

Would like to see some developer feedback on this one.

#3 @Denis-de-Bernardy
17 years ago

  • Component General → Cache
  • Keywords dev-feedback removed
  • Milestone Future Release → 3.0
  • Owner set to ryan

how does 0 ever get fetched in the first place?

#4 @nacin
17 years ago

  • Keywords reporter-feedback close added
  • Milestone 3.0 → Unassigned

#5 @nacin
16 years ago

  • Milestone Awaiting Review
  • Resolution → worksforme
  • Status new → closed

Re-open with steps to reproduce etc.

#6 @Denis-de-Bernardy
16 years ago

  • Milestone → 3.1
  • Resolution worksforme
  • Status closed → reopened

This is not per reproduce, this is per spec. We make the assumption, in the object cache in general, and memcached in particular, that a key is not empty. Zero is empty.

#7 @wpmuguru
16 years ago

Both 0 and '0' are valid array keys. The built in object cache uses isset() not empty() to determine if the requested object is stored in cache.

Recommending close.

#8 @ryan
16 years ago

  • Milestone 3.1 → Future Release

Wouldn't we also want to avoid the useless query while we're at it?

#9 @nacin
14 years ago

  • Keywords has-patch reporter-feedback close removed
  • Milestone Future Release → 3.5
  • Resolution → fixed
  • Status reopened → closed

This is now handled by WP_Post, which returns false in get_instance() if $post evaluates to false. See #21559.

Note: See TracTickets for help on using tickets.