Make WordPress Core

Opened 7 years ago

Last modified 6 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:

Description

Hi,

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
7 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
7 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
6 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.