NO BUG: Uncaught TypeError: in in wp-content/themes/bricks/includes/integrations/dynamic-data/providers.php:151

I was trying to get conditional output working based on a custom function but no luck, even though just outputting the result in a text field worked. Then I remembered that some improvements to this had been made in 1.8 so I figured I’d take it for a spin.

I updated bricks (from 1.7.3 to 1.8) and also tried just freshly uploading the 1.8 version. Now, every time I try to save my functions.php in my child theme I get an error. At first I thought I must have messed up something but even removing everything except for the default bricks-child stuff, it just won’t let me save and the error does refer to a file in the parent theme.

Here is the full error:

Your PHP code changes were rolled back due to an error on line 151 of file wp-content/themes/bricks/includes/integrations/dynamic-data/providers.php. Please fix and try saving again.

Uncaught TypeError: str_replace(): Argument #2 ($replace) must be of type array|string, WP_Error given in wp-content/themes/bricks/includes/integrations/dynamic-data/providers.php:151
Stack trace:
#0 wp-content/themes/bricks/includes/integrations/dynamic-data/providers.php(151): str_replace()
#1 wp-includes/class-wp-hook.php(308): Bricks\Integrations\Dynamic_Data\Providers->render()
#2 wp-includes/plugin.php(205): WP_Hook->apply_filters()
#3 wp-content/themes/bricks/includes/integrations/dynamic-data/providers.php(260): apply_filters()
#4 wp-content/themes/bricks/functions.php(199): Bricks\Integrations\Dynamic_Data\Providers::render_content()
#5 wp-content/themes/bricks/includes/elements/base.php(1819): bricks_render_dynamic_data()
#6 wp-content/themes/bricks/includes/elements/base.php(1458): Bricks\Element->set_link_attributes()
#7 wp-content/themes/bricks/includes/elements/base.php(2124): Bricks\Element->set_root_attributes()
#8 wp-content/themes/bricks/includes/frontend.php(440): Bricks\Element->init()
#9 wp-content/themes/bricks/includes/elements/container.php(854): Bricks\Frontend::render_element()
#10 wp-content/themes/bricks/includes/elements/base.php(2158): Bricks\Element_Container->render()
#11 wp-content/themes/bricks/includes/frontend.php(440): Bricks\Element->init()
#12 [internal function]: Bricks\Frontend::render_element()
#13 wp-content/themes/bricks/includes/query.php(876): call_user_func_array()
#14 wp-content/themes/bricks/includes/elements/container.php(774): Bricks\Query->render()
#15 wp-content/themes/bricks/includes/elements/base.php(2158): Bricks\Element_Container->render()
#16 wp-content/themes/bricks/includes/frontend.php(440): Bricks\Element->init()
#17 wp-content/themes/bricks/includes/elements/container.php(854): Bricks\Frontend::render_element()
#18 wp-content/themes/bricks/includes/elements/base.php(2158): Bricks\Element_Container->render()
#19 wp-content/themes/bricks/includes/frontend.php(440): Bricks\Element->init()
#20 wp-content/themes/bricks/includes/elements/container.php(854): Bricks\Frontend::render_element()
#21 wp-content/themes/bricks/includes/elements/base.php(2158): Bricks\Element_Container->render()
#22 wp-content/themes/bricks/includes/frontend.php(440): Bricks\Element->init()
#23 wp-content/themes/bricks/includes/frontend.php(526): Bricks\Frontend::render_element()
#24 wp-content/themes/bricks/includes/frontend.php(775): Bricks\Frontend::render_data()
#25 wp-content/themes/bricks/page.php(7): Bricks\Frontend::render_content()
#26 wp-includes/template-loader.php(106): include('/home/935317.cl...')
#27 wp-blog-header.php(19): require_once('/home/935317.cl...')
#28 index.php(17): require('/home/935317.cl...')
#29 {main}
  thrown

Just tested this again on a fresh 1.8 install and the problem didn’t occur. I must have messed up somehwere just no clue where. Got loads of dynamic data stuff on the site with the issue, so if there is a way to figure it out without me basically removing every single dynamic data tag that would be great :slight_smile: but if there isn’t I guess I’ll have to go through all of them.

Hi @manc ,

Can you please provide more details of your custom function?
Could it be the function returns an Error?

If possible, please send a temp admin to help@bricksbuilder.io so we can take a look at your issue.
Kindly include this forum thread URL as a reference as well.

Regards,
Jenn

I tried removing all of my functions since, in theory, if any of them was causing the issue, it should’ve been able to save again. Also all the functions in there still work/output the right stuff in the frontend which makes it even weirder.

But yeah, my theory might be way off haha, will send logins in a bit :slight_smile:

Managed to narrow down the cause of the issue.

I have an ACF options page on which I have a repeater with 2 fields

  1. Taxonomy
  2. Relationship

I’ve got a query loop set to the repeater field in which I output the selected taxonomy (only 1 per repeater) as well as the posts selected in the relationship field.

This worked in 1.7.3 but as of now, the ACF taxonomy field output is what’s causing the issues. Tried switching the return formats between ID and Term Object but neither work. Previously, I had the dynamic data shortcode of the taxonomy field set as a link value and output it’s name. That is what’s throwing the error now. If I remove the shortcode from the link and try n put it into a basic text field, nothing shows.

I’ll keep investigating :slight_smile:

SOLVED

I downgraded to 1.73 and was recording a video to show the setup and how it works and show how it breaks on 1.8. I updated the Bricks through themes in the Backend and for whatever reason, it’s still working. The issue somehow happened by directly uploading 1.8 instead of updating through the Backend I guess.

Glad that has been solved.
Thanks for the update.
I will mark this topic as NO BUG then.