All add-ons currently require PHP 7.4 or greater.

On July 4th 2024 PHP 8.2 will be the new minimum requirement for all add-ons. Expect any add-on released after that date to require 8.2 or greater. Some releases may not immediately take advantage of 8.x specific features in PHP, which means you might, be able to continue using new releases in PHP 7.4, however, if you experience an error the first thing you should do is update to PHP 8.2 then create a support ticket if the error persists.

Please read about the changes to BoldMinded add-on licensing.

Ticket: Bloqs Setters & Getters error when value starts with /

Status Resolved
Add-on / Version Bloqs 5.0.14
Severity
EE Version 7.4.10

Paul Larson

Jun 24, 2024

OK, bloqs “bug” that I found in the Variable Setts & Getters …

{bloqs:set name="foo" value="bar"} that works as expected when using {bloqs:get:foo}

However, {bloqs:set name="foo" value="/bar"} seems to be ok UNTIL you try to call it with {bloqs:get:foo} at which point we get the following stack:

BoldMinded\Bloqs\Controller\TagController::replaceBlockVars(): Argument #1 ($template) must be of type string, null given, called in user/addons/bloqs/Controller/TagController.php on line 484
user/addons/bloqs/Controller/TagController.php:546

Stack Trace: Please include when reporting this error
#0 user/addons/bloqs/Controller/TagController.php(484): BoldMinded\Bloqs\Controller\TagController->replaceBlockVars()
#1 user/addons/bloqs/Controller/TagController.php(254): BoldMinded\Bloqs\Controller\TagController->updateBlockVars()
#2 user/addons/bloqs/ft.bloqs.php(734): BoldMinded\Bloqs\Controller\TagController->replace()
#3 ee/legacy/libraries/api/Api_channel_fields.php(444): Bloqs_ft->replace_tag()
#4 ee/legacy/libraries/channel_entries_parser/components/Custom_field_pair.php(180): Api_channel_fields->apply()
#5 ee/legacy/libraries/channel_entries_parser/Parser.php(288): EE_Channel_custom_field_pair_parser->replace()
#6 ee/legacy/libraries/Channel_entries_parser.php(172): EE_Channel_data_parser->parse()
#7 ee/ExpressionEngine/Addons/channel/mod.channel.php(2543): EE_Channel_parser->parse()
#8 ee/ExpressionEngine/Addons/channel/mod.channel.php(263): Channel->parse_channel_entries()
#9 ee/legacy/libraries/Template.php(1835): Channel->entries()
#10 ee/legacy/libraries/Template.php(1510): EE_Template->process_tags()
#11 ee/legacy/libraries/Template.php(625): EE_Template->tags()
#12 ee/legacy/libraries/Template.php(248): EE_Template->parse()
#13 ee/legacy/libraries/Template.php(1039): EE_Template->fetch_and_parse()
#14 ee/legacy/libraries/Template.php(671): EE_Template->process_layout_template()
#15 ee/legacy/libraries/Template.php(248): EE_Template->parse()
#16 ee/legacy/libraries/Template.php(178): EE_Template->fetch_and_parse()
#17 ee/legacy/libraries/Core.php(811): EE_Template->run_template_engine()
#18 ee/legacy/controllers/ee.php(53): EE_Core->generate_page()
#19 [internal function]: EE->index()
#20 ee/ExpressionEngine/Core/Core.php(268): call_user_func_array()
#21 ee/ExpressionEngine/Core/Core.php(124): ExpressionEngine\Core\Core->runController()
#22 ee/ExpressionEngine/Boot/boot.php(184): ExpressionEngine\Core\Core->run()
#23 httpdocs/index.php(164): require_once('...')
#23 httpdocs/index.php(164): require_once('...')
#1

BoldMinded (Brian)

Have you tried something similar with setting native Layout variables? Bloqs has almost a verbatim copy/paste of EE’s internal code that parses layout:set variables, so if it doesn’t work there, then it also doesn’t work with native tags.

#2

Paul Larson

Yes, native layout variables work perfectly. Forgot to mention we had tested that.

#3

BoldMinded (Brian)

Change line 476 of TagController to this and see if it fixes it:

$markerContent = $markerContentMatch[1] ?? '';
#4

Paul Larson

For the moment that seems to fix it. Thank you.

#5

Paul Larson

Rats - I think the issue is persisting. Quick video forthcoming.

#6

BoldMinded (Brian)

I don’t need the video, I can replicate it.

Are you hard coding the value with the forward slash or is it a value from a variable?

#7

Paul Larson

It’s set as a variable from an atom. The block parent, then calling it from a child bloq

#8

BoldMinded (Brian)

Comment has been marked private.

#9

BoldMinded (Brian)

Comment has been marked private.

#10

Paul Larson

Ok, vacation delayed this response:

Alright, I did some checking on this today to refresh my memory…

The variable setting and getting works as expected EXCEPT with the value to be set starts with a /

The suggested next and previous ids don’t work for this instance because there is a level between them. Therefore, the screenshot value works to be recalled in the submenu atom, but if I add a slash at the start, it does not work.

This is the important part of the template:

{exp:channel:entries channel="mega_menus" dynamic='no'}
    {mega_menu_builder}

        {mega_menu_container}
            <div data-block-name="mega_menu_container">
                
                    bloqs:set name="menu_page_url" value="{menu_page_url}"
                    {bloqs:set name="menu_page_url" value="{menu_page_url}"}
                
                {bloqs:children}
            </div>
        {/mega_menu_container}

        {mega_menu_column}
            <div class="col {css_class}" data-block-name="mega_menu_column">
                {bloqs:children}
            </div>
        {/mega_menu_column}

        {mega_menu_submenu}
            bloqs:get:menu_page_url = "{bloqs:get:menu_page_url}"
        {/mega_menu_submenu}

    {/mega_menu_builder}
{/exp:channel:entries}

Linked below is where the value of the variable is coming from in the entry with the blocks:

#11

BoldMinded (Brian)

Did you try that build I sent? I removed some code that was causing it to error when the value started with a /. I’ve tested and can replicate the issue locally, but with that build it works fine with or without the /.

#12

Paul Larson

Huzzah, yes it does work!

#13

BoldMinded (Brian)

Comment has been marked private.

Login to reply