You've already forked wp-fedistream
revert: Restore conditional the_content filter usage
All checks were successful
Create Release Package / build-release (push) Successful in 1m1s
All checks were successful
Create Release Package / build-release (push) Successful in 1m1s
- Reverted nuclear option from v0.4.8 - get_post_data() now uses the_content filter conditionally - All other protections remain in place - Memory leak investigation to be continued later Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
14
CHANGELOG.md
14
CHANGELOG.md
@@ -7,11 +7,20 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||||||
|
|
||||||
## [Unreleased]
|
## [Unreleased]
|
||||||
|
|
||||||
|
## [0.4.9] - 2026-02-02
|
||||||
|
|
||||||
|
### Changed
|
||||||
|
|
||||||
|
- **Reverted nuclear option** - Restored conditional the_content filter usage
|
||||||
|
- `get_post_data()` now uses the_content filter only when NOT in shortcode context, NOT at depth > 1, and NOT loading page template
|
||||||
|
- All other protections remain in place (render depth, page template loading flag, main template lock, shortcode context)
|
||||||
|
- Memory leak investigation to be continued later
|
||||||
|
|
||||||
## [0.4.8] - 2026-02-02
|
## [0.4.8] - 2026-02-02
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
|
|
||||||
- **Nuclear option: NEVER apply the_content filter** - Completely removed the_content filter usage
|
- **Nuclear option: NEVER apply the_content filter** - Completely removed the_content filter usage (reverted in 0.4.9)
|
||||||
- `get_post_data()` now ALWAYS strips shortcodes and uses raw content
|
- `get_post_data()` now ALWAYS strips shortcodes and uses raw content
|
||||||
- NEVER calls `apply_filters('the_content', ...)` or `get_the_excerpt()`
|
- NEVER calls `apply_filters('the_content', ...)` or `get_the_excerpt()`
|
||||||
- FediStream posts don't need shortcode processing in their content anyway
|
- FediStream posts don't need shortcode processing in their content anyway
|
||||||
@@ -274,7 +283,8 @@ Initial release of WP FediStream - a WordPress plugin for streaming music over A
|
|||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
[Unreleased]: https://src.bundespruefstelle.ch/magdev/wp-fedistream/compare/v0.4.8...HEAD
|
[Unreleased]: https://src.bundespruefstelle.ch/magdev/wp-fedistream/compare/v0.4.9...HEAD
|
||||||
|
[0.4.9]: https://src.bundespruefstelle.ch/magdev/wp-fedistream/compare/v0.4.8...v0.4.9
|
||||||
[0.4.8]: https://src.bundespruefstelle.ch/magdev/wp-fedistream/compare/v0.4.7...v0.4.8
|
[0.4.8]: https://src.bundespruefstelle.ch/magdev/wp-fedistream/compare/v0.4.7...v0.4.8
|
||||||
[0.4.7]: https://src.bundespruefstelle.ch/magdev/wp-fedistream/compare/v0.4.6...v0.4.7
|
[0.4.7]: https://src.bundespruefstelle.ch/magdev/wp-fedistream/compare/v0.4.6...v0.4.7
|
||||||
[0.4.6]: https://src.bundespruefstelle.ch/magdev/wp-fedistream/compare/v0.4.5...v0.4.6
|
[0.4.6]: https://src.bundespruefstelle.ch/magdev/wp-fedistream/compare/v0.4.5...v0.4.6
|
||||||
|
|||||||
@@ -289,18 +289,34 @@ class TemplateLoader {
|
|||||||
// Track recursion to prevent infinite loops from shortcodes in content.
|
// Track recursion to prevent infinite loops from shortcodes in content.
|
||||||
++self::$recursion_depth;
|
++self::$recursion_depth;
|
||||||
|
|
||||||
// ALWAYS skip the_content filter to prevent any possible recursion.
|
// Skip the_content filter if:
|
||||||
// FediStream posts don't need shortcode processing in their content.
|
// 1. We're in a shortcode context (prevents recursive shortcode processing)
|
||||||
// This is the nuclear option but it guarantees no recursion.
|
// 2. We're at depth > 1 (nested data loading)
|
||||||
|
// 3. We're loading a page template
|
||||||
|
$skip_content_filter = self::$shortcode_context_depth > 0
|
||||||
|
|| self::$recursion_depth > 1
|
||||||
|
|| self::$loading_page_template;
|
||||||
|
|
||||||
|
// When skipping content filter, use raw excerpt to avoid get_the_excerpt()
|
||||||
|
// triggering the_content filter internally when generating auto-excerpts.
|
||||||
|
if ( $skip_content_filter ) {
|
||||||
$excerpt = $post->post_excerpt;
|
$excerpt = $post->post_excerpt;
|
||||||
if ( empty( $excerpt ) ) {
|
if ( empty( $excerpt ) ) {
|
||||||
// Generate a simple excerpt without triggering the_content filter.
|
// Generate a simple excerpt without triggering the_content filter.
|
||||||
$excerpt = wp_trim_words( wp_strip_all_tags( $post->post_content ), 55, '…' );
|
$excerpt = wp_trim_words( wp_strip_all_tags( $post->post_content ), 55, '…' );
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
$excerpt = get_the_excerpt( $post );
|
||||||
|
}
|
||||||
|
|
||||||
// Strip shortcodes and sanitize content - never apply the_content filter.
|
// When skipping content filter, strip shortcodes to prevent them from
|
||||||
|
// being processed by anything else that might call do_shortcode on the output.
|
||||||
|
if ( $skip_content_filter ) {
|
||||||
$content = strip_shortcodes( $post->post_content );
|
$content = strip_shortcodes( $post->post_content );
|
||||||
$content = wp_kses_post( $content );
|
$content = wp_kses_post( $content );
|
||||||
|
} else {
|
||||||
|
$content = apply_filters( 'the_content', $post->post_content );
|
||||||
|
}
|
||||||
|
|
||||||
$data = array(
|
$data = array(
|
||||||
'id' => $post->ID,
|
'id' => $post->ID,
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
* Plugin Name: WP FediStream
|
* Plugin Name: WP FediStream
|
||||||
* Plugin URI: https://src.bundespruefstelle.ch/magdev/wp-fedistream
|
* Plugin URI: https://src.bundespruefstelle.ch/magdev/wp-fedistream
|
||||||
* Description: Stream music over ActivityPub - Build your own music streaming platform for Musicians and Labels.
|
* Description: Stream music over ActivityPub - Build your own music streaming platform for Musicians and Labels.
|
||||||
* Version: 0.4.8
|
* Version: 0.4.9
|
||||||
* Requires at least: 6.4
|
* Requires at least: 6.4
|
||||||
* Requires PHP: 8.3
|
* Requires PHP: 8.3
|
||||||
* Author: Marco Graetsch
|
* Author: Marco Graetsch
|
||||||
@@ -26,7 +26,7 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|||||||
*
|
*
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
define( 'WP_FEDISTREAM_VERSION', '0.4.8' );
|
define( 'WP_FEDISTREAM_VERSION', '0.4.9' );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Plugin file path.
|
* Plugin file path.
|
||||||
|
|||||||
Reference in New Issue
Block a user