Skip to:
Content

BuddyPress.org

Opened 10 years ago

Closed 10 years ago

#5803 closed enhancement (fixed)

Query activity items by date

Reported by: r-a-y's profile r-a-y Owned by: r-a-y's profile r-a-y
Milestone: 2.1 Priority: normal
Severity: normal Version:
Component: Activity Keywords: has-patch
Cc:

Description

Was playing around with WP_Date_Query for a plugin and spent a bit of time working up a patch for the activity component.

WP_Date_Query is available since WP 3.7, but we support down to WP 3.6, so I've wrapped our extended BP_Date_Query class around a conditional.

Patch includes unit tests. Maybe we can sneak this into 2.1?

Attachments (2)

5803.01.patch (10.8 KB) - added by r-a-y 10 years ago.
5803.sans-destructor.patch (681 bytes) - added by r-a-y 10 years ago.

Download all attachments as: .zip

Change History (11)

@r-a-y
10 years ago

#1 @boonebgorges
10 years ago

Wow! A nice surprise. And it's pleasantly surprising to see how easy it was to integrate. I say go with it for 2.1.

#2 @r-a-y
10 years ago

  • Owner set to r-a-y
  • Resolution set to fixed
  • Status changed from new to closed

In 8787:

Add ability to query activity items by date.

This commit:

  • Introduces the BP_Date_Query class. This class extends WP_Date_Query, which will enable us to easily add support to query various BuddyPress items by date.
  • Adds a new 'date_query' parameter to BP_Activity_Activity::get(). This parameter utilizes the new BP_Date_Query class and is an example of how to use the class in BuddyPress. (Will add support for the Groups component in a later commit.)
  • Adds unit tests.

Due to the dependency on the WP_Date_Query class, this functionality is
only available in WordPress 3.7+.

Fixes #5803.

#3 @r-a-y
10 years ago

In 8789:

Split up activity 'date_query' unit tests.

Attempts to fix issues with the 'zend_mm_heap corrupted' message outputting
on PHP 5.2 and WP master:
https://travis-ci.org/buddypress/BuddyPress/jobs/32239701

See #5803.

#4 @djpaul
10 years ago

In 8795:

Another attempt at fixing the date_query unit tests failures on PHP 5.2 and WordPress trunk.

See #5803 and https://travis-ci.org/buddypress/BuddyPress/jobs/32239701

#5 @DJPaul
10 years ago

  • Resolution fixed deleted
  • Status changed from closed to reopened

So after some investigation leading to r8795, the deconstructor was causing these tests to fail. At a PHP level, one of two error messages were observed by me in a local PHP 5.2 dev environment, running WordPress trunk.

  • zend_mm_heap corrupted
  • ALERT - linked list corrupt on efree() - heap corruption detected (attacker 'REMOTE_ADDR not set', file '/vagrant/wordpress/src/wp-includes/plugin.php', line 281)

Rolling back to older *recent* versions of WordPress trunk didn't fix the problem, but the fact that it's *not* happening on the 3.7/3.8/3.9 branches of WordPress suggest something has changed in 4.0/trunk regarding the management of actions/filters, that only reveals itself when in a PHP 5.2 environment. I have not diff'd the 3.9 branch against trunk to see if there are any obvious changes.

During debugging on WordPress trunk in the unit tests introduced by R-a-y for this change, I observed that I was unable to put any kind of logging in the __deconstruct method, otherwise the PHP crashed with a segfault.

This ticket was mentioned in IRC in #buddypress-dev by paulgibbs. View the logs.


10 years ago

#7 @DJPaul
10 years ago

Oh, and we should check if we're worried about not removing that action. R-a-y said he thinks it will probably be OK to leave as-is.

#8 @r-a-y
10 years ago

Rolling back to older *recent* versions of WordPress trunk didn't fix the problem, but the fact that it's *not* happening on the 3.7/3.8/3.9 branches of WordPress suggest something has changed in 4.0/trunk regarding the management of actions/filters, that only reveals itself when in a PHP 5.2 environment. I have not diff'd the 3.9 branch against trunk to see if there are any obvious changes.

Yay for finding obscuro bugs! Nay for me trying to be too fancy with the destruct method.

Oh, and we should check if we're worried about not removing that action. R-a-y said he thinks it will probably be OK to leave as-is.

It's safe to leave it, but I've also added a patch if we need to remove our filter.

#9 @DJPaul
10 years ago

  • Resolution set to fixed
  • Status changed from reopened to closed

I forgot to reference this ticket in the r8796 commit message:
---

Revert r8795; instead, fix the tests by skipping them if running in a PHP environment < 5.3.

The https://core.trac.wordpress.org/changeset/29251 change in WordPress trunk/4.0's unit test suite surfaces a bug in PHP 5.2 environments which causes segfaults with _destruct() for static class variables. See https://bugs.php.net/bug.php?id=51822.

As the new tests are only failing in PHP 5.2.17 with WP trunk (at revision 29466 at time of writing), we've decided to fix by requiring the date_query unit tests run only in PHP 5.3+ environments.

Note: See TracTickets for help on using tickets.