Make WordPress Core

Opened 4 weeks ago

Last modified 4 weeks ago

#44461 new defect (bug)

inconsistent type for global $blog_id

Reported by: jmlapam Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version: 4.9.6
Component: General Keywords: reporter-feedback
Focuses: multisite 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 (2)

#1 @subrataemfluence
4 weeks 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 @jmlapam
4 weeks 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.

Note: See TracTickets for help on using tickets.