Make WordPress Core

Opened 6 years ago

Last modified 5 years ago

#44461 new defect (bug)

inconsistent type for global $blog_id

Reported by: anonymized_10765487's profile anonymized_10765487 Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version: 4.9.6
Component: Networks and Sites Keywords: needs-testing
Focuses: Cc:



in a single installation global $blog_id is 1, its type is integer.
in a multisite context global $blog_id is a string, this might be a problem considering the fact that operator == && != have been deprecated.

There is a function called get_current_blog_id() that basically applies an absint() on this global but I guess this should be an integer whatever happens.

Change History (3)

#1 @subrataemfluence
6 years ago

  • Focuses multisite added
  • Keywords reporter-feedback added

I tested by echo-ing blog_id in both single and multisite. Both cases it returned me integer.

On single site get_current_blog_id() returned 1, and the same is 5 when I did it on a multisite environment.

echo get_current_blog_id();

If this is not correct please let me know the exact steps for reproducing the issue.

Thank you!

#2 @anonymized_10765487
6 years ago

That's normal, as I said get_current_blog_id() is basically applying an absint() on the global but the global itself is inconsistent.

#3 @desrosj
5 years ago

  • Component changed from General to Networks and Sites
  • Focuses multisite removed
  • Keywords needs-testing added; reporter-feedback removed
Note: See TracTickets for help on using tickets.