From 2b515174eb67dc816e28dd46b7485ed110504760 Mon Sep 17 00:00:00 2001 From: Jasper Frumau Date: Mon, 24 Nov 2025 09:24:40 +0700 Subject: [PATCH] Infinite Recursion Bug --- CHANGELOG.md | 10 ++++++++++ app/setup.php | 18 +++++------------- style.css | 2 +- 3 files changed, 16 insertions(+), 14 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 08cf0cf..b5b1c4d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,16 @@ All notable changes to the Nynaeve theme will be documented in this file. For project-wide changes (infrastructure, tooling, cross-cutting concerns), see the [project root CHANGELOG.md](../../../../../CHANGELOG.md). +## [2.0.12] - 2025-11-24 + +### Fixed +- **Infinite Recursion Bug**: Fixed critical error caused by `query` filter in `setup.php` + - **Root cause**: Filter called `$wpdb->query()` which triggered the same filter again, causing infinite recursion + - **Error**: "Maximum call stack size reached. Infinite recursion?" in `class-wpdb.php` + - **Solution**: Simplified filter to just return empty string for WooCommerce duplicate key queries + - WooCommerce handles missing indexes gracefully, so queries don't need to be executed at all + - Prevents stack overflow on all page loads + ## [2.0.11] - 2025-11-22 ### Fixed diff --git a/app/setup.php b/app/setup.php index ed6b2c2..7b20099 100644 --- a/app/setup.php +++ b/app/setup.php @@ -328,26 +328,18 @@ class="text-center w-full px-4 py-3 bg-indigo-600 flex items-center * Suppress WooCommerce duplicate key database errors * These errors are harmless - they occur when WooCommerce tries to add indexes that already exist * This prevents them from cluttering debug.log + * + * Note: We simply return empty string for these queries - WooCommerce handles + * duplicate key errors gracefully, so we don't need to execute them at all. */ add_filter('query', function ($query) { - global $wpdb; - // Suppress duplicate key errors for known WooCommerce indexes if ( strpos($query, 'ADD KEY `session_expiry`') !== false || strpos($query, 'ADD INDEX woo_idx_comment_date_type') !== false ) { - // Check if the index already exists before attempting to add it - $suppress_errors = $wpdb->suppress_errors(); - $wpdb->suppress_errors(true); - - // Execute the query (it will fail silently if index exists) - $result = $wpdb->query($query); - - // Restore error suppression state - $wpdb->suppress_errors($suppress_errors); - - // Return empty to prevent the original query from running + // Return empty to skip this query entirely + // WooCommerce handles missing indexes gracefully return ''; } diff --git a/style.css b/style.css index 343f016..9ab6fdb 100644 --- a/style.css +++ b/style.css @@ -2,7 +2,7 @@ Theme Name: Nynaeve Theme URI: https://imagewize.com Description: Modern WordPress theme built on Sage 11 with reusable custom blocks using WordPress native tools and the Roots.io stack. -Version: 2.0.11 +Version: 2.0.12 Author: Jasper Frumau Author URI: https://magewize.com Text Domain: nynaeve