Skip to:
Content

BuddyPress.org

Opened 3 years ago

Closed 3 years ago

#9099 closed defect (bug) (fixed)

Heartbeat requests need better parsing

Reported by: needle Owned by: imath
Priority: normal Milestone: 12.4.0
Component: Activity Version: 12.0.0
Severity: normal Keywords: has-patch
Cc:

Description

I opened ​this ticket on Query Monitor because I thought it was the source of PHP Warnings in my logs... however, it appears that it is BuddyPress that causes QM to throw the PHP Warning.

When heartbeat was added to in ​13526, BuddyPress resets the query during all heartbeat requests in ​bp_core_set_ajax_uri_globals(). This results in WP_Query->is_page = true in WP_Query->parse_query() because $qv['pagename'] is whatever the path component of bp_get_referer_path() is set to, e.g. wp-admin/plugins.php.

This introduces an inconsistency shown by QM because is_singular() reports true yet get_queried_object_id() returns no ID. It seems to me that there needs to be more granularity in the checks in bp_core_set_ajax_uri_globals and that looking at bp_ajax_action_is_registered may not be enough to discern a BuddyPress heartbeat request from ones in which BuddyPress has no interest.

Change History (7)

#1 follow-up: @imath
3 years ago

  • Component Core → Activity
  • Milestone Awaiting Review → 12.3.0

Thanks for your report. @Slaffik told me about it. I’ll try to fix it asap.

#2 in reply to: ↑ 1 @needle
3 years ago

Replying to imath:

Thanks for your report. @Slaffik told me about it. I’ll try to fix it asap.

Thanks for looking into it @imath

#3 @imath
3 years ago

  • Milestone 12.3.0 → 12.4.0

This ticket was mentioned in ​PR #247 on ​buddypress/buddypress by ​imath.


3 years ago
#4

  • Keywords has-patch added

The Query Monitor plugin is showing some notice errors about the way some specific Ajax requests were handled by the BP Rewrites API. This PR aims to remove these notices making sure the heartbeat action is about a BuddyPress context.

Trac ticket: ​https://buddypress.trac.wordpress.org/ticket/9099

#5 @imath
3 years ago

Hi @needle & @Slaffik

Could you confirm the above PR is fixing the issue with Query Monitor? Thanks in advance.

#6 @imath
3 years ago

In 13752:

Only parse heartbeat requests which relates to BuddyPress context

Props Slaffik, needle, espellcaste

See #9099 (trunk)
Closes ​https://github.com/buddypress/buddypress/pull/247

#7 @imath
3 years ago

  • Owner set to imath
  • Resolution → fixed
  • Status new → closed

In 13753:

Only parse heartbeat requests which relates to BuddyPress context

Props Slaffik, needle, espellcaste

Fixes #9099 (branch 12.0)

Note: See TracTickets for help on using tickets.