NO BUG: "Orphaned elements review" causes PHP Fatal Error

Browser: Chrome Version 138.0.7204.101 (Official Build) (arm64)
OS: macOS / Windows / Linux / etc.
URL: [OMITTED FOR PRIVACY]

After upgrading to Bricks 2.0, I utilized the new “Orphaned elements review”, which found a few issues on some pages/templates. After using the tool to fix these issues, I can no longer open any of the related pages/templates with the builder.

The following error is thrown on these pages (other pages/templates work just fine):

PHP Fatal error: Allowed memory size of 824180736 bytes exhausted (tried to allocate 400560128 bytes) in /[OMITTED FOR PRIVACY]/functions.php on line 4378

I unfortunately do not have a backup of these pages/templates, but I can rebuild them if I have to. I am just hoping that maybe there is a fix for this that I haven’t found yet.

I have tried:

  • Disabling all plugins
  • Only using the Bricks 2.0 parent theme
  • Increasing WP and PHP memory limit to 786 MB and 1024M respectively

System Information

Theme Information
Theme name: [OMITTED FOR PRIVACY]
Theme version: 1.1
Theme author: [OMITTED FOR PRIVACY]
Theme author URI: [OMITTED FOR PRIVACY]
Theme is child theme:
Parent theme name: Bricks
Parent theme version: 2.0
Parent theme URI: https://bricksbuilder.io/
Parent theme author URI: https://bricksbuilder.io/

WordPress Environment
Home URL: [OMITTED FOR PRIVACY]
REST API Prefix: wp-json
WP version: 6.8.1
WP debug:
WP language: en_US
WP multisite:
WP memory limit: 786 MB

Server Environment
Server info: nginx
MySQL version: 8.0.41
Postmeta table meta_value type: longtext
PHP version: 8.2.28
PHP post max size: 100M
PHP execution time limit: 43300
PHP max input vars: 10000
PHP safe mode:
PHP memory limit: 1024M
PHP max upload file size: 50M
PHP wp_remote_post: Success

Hi,
Welcome to the forum, and thanks so much for your report!

Due to privacy restrictions, I can’t see which functions.php it is, but the original functions.php of Bricks 2.0 has only 277 lines :thinking:

So the question is: what functions.php is it, and what is on line 4378?

Best regards,
timmse

Hey @timmse,

I investigated this more yesterday by debugging locally and realized I misdiagnosed the cause entirely. I filed the report before fully digging into it on my end, my bad for jumping the gun.

The fatal error was coming from WordPress core at /wp-includes/functions.php on line 4378, inside the wp_json_encode() function.

I originally thought the “Orphaned elements review” tool was to blame, but it turned out that converting my global form element into components (and then trying to edit any page with those new components) was what blew up the JSON payload size and triggered the memory exhaustion. I just happened to do both actions one after the other and made the wrong assumption.

I’m still not entirely sure why the conversion from global element to component inflated the payload so much, but for now, we can close out this thread since the issue was likely on my end.

If I run into any more issues, I’ll debug thoroughly and open a fresh report only if needed.

Thanks for your time!