WordPress.org

Make WordPress Core

Opened 8 years ago

Closed 7 years ago

#3156 closed defect (bug) (fixed)

Uninitialized var (PHP Notice) in ternary expressions - wp-db.php

Reported by: alexkingorg Owned by:
Milestone: 2.3 Priority: normal
Severity: normal Version: 2.1
Component: General Keywords: has-patch 2nd-opinion
Focuses: Cc:

Description

I'm not sure the best way to fix this. I've attached a patch that I think should work, but someone should put some serious eyeballs on this one.

Attachments (1)

patch.diff (430 bytes) - added by alexkingorg 8 years ago.
patch

Download all attachments as: .zip

Change History (10)

alexkingorg8 years ago

patch

comment:1 foolswisdom8 years ago

  • Keywords has-patch 2nd-opinion added
  • Milestone set to 2.1
  • Version set to 2.1

comment:2 ryan8 years ago

  • Resolution set to fixed
  • Status changed from new to closed

(In [4208]) Check if array index is set. Props Alex King. fixes #3156

comment:3 donncha8 years ago

  • Resolution fixed deleted
  • Status changed from closed to reopened

This caused some weird problems for wpcom - it looked like a cache problem and caused lots of hits on the same queries over and over again. ie.

SELECT option_value FROM wp_options WHERE option_name = 'siteurl' LIMIT 1

repeated about 50 times.

comment:4 ryan8 years ago

Maybe we need to return false.

comment:5 ryan8 years ago

Actually, nevermind on that. I'm not seeing why this would make a difference. Weird.

comment:6 markjaquith8 years ago

Lots of hits on the same queries over and over again can happen if you're using the WP Object Cache (I think you're using a Memcached drop-in on WP.com) and you're querying something that doesn't exist in the DB (like an option).

See #2268

Basically, there's no way to tell the difference between "option isn't in cache" and "option's non-existence has been cached."

This may be related... dunno.

comment:7 matt7 years ago

  • Milestone changed from 2.1 to 2.2

comment:8 foolswisdom7 years ago

  • Milestone changed from 2.2 to 2.3

comment:9 westi7 years ago

  • Resolution set to fixed
  • Status changed from reopened to closed

Marking this as fixed.

No extra info in nearly a year.

Non-existent options caching went into [4855] which should fix the large number of db queries on cache misses for non-existent options.

Please raise another ticket if you still have issue.

Note: See TracTickets for help on using tickets.