Make WordPress Core

Opened 15 years ago

Closed 14 years ago

#18387 closed defect (bug) (fixed)

get_blog_id_from_url() has wrong return

Reported by: lonnylot Owned by:
Priority: normal Milestone: 3.5
Component: Multisite Version: 3.0
Severity: minor Keywords: has-patch
Cc: Focuses:

Description

If the blog does not exist we sometimes return 0 and sometimes return false. Per the comment we should always be returning an int.

Attachments (3)

wrong_return.diff (368 bytes ) - added by lonnylot 15 years ago.
18387.diff (4.8 KB ) - added by ryan 14 years ago.
Down the rabbit hole
18387-ut.diff (3.0 KB ) - added by ryan 14 years ago.
Unit tests

Download all attachments as: .zip

Change History (10)

#1 @scribu
15 years ago

  • Severity normalminor

#2 @nacin
15 years ago

  • Version3.0

#3 @wonderboymusic
14 years ago

  • Milestone Awaiting Review3.5

#4 @ryan
14 years ago

This function needs a lot of help. It's cache is never invalidated and escaped data is used to create cache keys. We need to do something like we did for #20950.

Version 0, edited 14 years ago by ryan (next)

#5 @ryan
14 years ago

No to mention it is pretty much the same as domain_exists() and get_id_from_blogname().

@ryan
14 years ago

Down the rabbit hole

#6 @ryan
14 years ago

  • Register blog-id-cache group as global
  • Introduce clean_blog_cache() so we can run it independently of refresh_blog_details() which assumes the blog still exists and get_blog_details() can be called.
  • Don't db escape cache keys
  • Return 0 for all failures in get_blog_id_from_url()
  • clean_blog_cache() after dropping tables in wpmu_delete_blog() to make sure the cache is for real cleaned.

@ryan
14 years ago

Unit tests

#7 @ryan
14 years ago

  • Resolutionfixed
  • Status newclosed
Note: See TracTickets for help on using tickets.