Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Frontend debug toolbar doesn't display for entries that use checkbox fields #3034

Closed
lukeyouell opened this issue Jun 27, 2018 · 7 comments

Comments

Projects
None yet
3 participants
@lukeyouell
Copy link

commented Jun 27, 2018

Description

The debug toolbar fails to load on the frontend if the entry displays checkbox field values.

I use these in the <head> of my templates, which means that the toolbar fails to load on every page.

The error looks to be associated with the tag query parameter value.

Exception &#039;UnexpectedValueException&#039; with message &#039;Error at offset 0 of 2 bytes&#039; 

in /Users/luke/Sites/foobar/vendor/yiisoft/yii2-debug/controllers/DefaultController.php:166

Stack trace:
#0 [internal function]: ArrayObject-&gt;unserialize(&#039;[]&#039;)
#1 /Users/luke/Sites/foobar/vendor/yiisoft/yii2-debug/controllers/DefaultController.php(166): unserialize(&#039;a:15:{s:7:&quot;flas...&#039;)
#2 /Users/luke/Sites/foobar/vendor/yiisoft/yii2-debug/controllers/DefaultController.php(103): yii\debug\controllers\DefaultController-&gt;loadData(&#039;5b334d5358a92&#039;, 5)
#3 [internal function]: yii\debug\controllers\DefaultController-&gt;actionToolbar(&#039;5b334d5358a92&#039;)
#4 /Users/luke/Sites/foobar/vendor/yiisoft/yii2/base/InlineAction.php(57): call_user_func_array(Array, Array)
#5 /Users/luke/Sites/foobar/vendor/yiisoft/yii2/base/Controller.php(157): yii\base\InlineAction-&gt;runWithParams(Array)
#6 /Users/luke/Sites/foobar/vendor/yiisoft/yii2/base/Module.php(528): yii\base\Controller-&gt;runAction(&#039;toolbar&#039;, Array)
#7 /Users/luke/Sites/foobar/vendor/craftcms/cms/src/web/Application.php(282): yii\base\Module-&gt;runAction(&#039;debug/default/t...&#039;, Array)
#8 /Users/luke/Sites/foobar/vendor/craftcms/cms/src/web/Application.php(530): craft\web\Application-&gt;runAction(&#039;debug/default/t...&#039;, Array)
#9 /Users/luke/Sites/foobar/vendor/craftcms/cms/src/web/Application.php(266): craft\web\Application-&gt;_processActionRequest(Object(craft\web\Request))
#10 /Users/luke/Sites/foobar/vendor/yiisoft/yii2/base/Application.php(386): craft\web\Application-&gt;handleRequest(Object(craft\web\Request))
#11 /Users/luke/Sites/foobar/public/index.php(21): yii\base\Application-&gt;run()
#12 /Users/luke/.composer/vendor/laravel/valet/server.php(147): require(&#039;/Users/lukeyoue...&#039;)
#13 {main}

Steps to reproduce

  1. Create an entry that uses a checkbox field
  2. Enable the debug toolbar on the frontend
  3. Visit the entry (the checkbox fields have to be outputted in the template)

Additional info

  • Craft version: 3.0.13.1
  • PHP version: 7.2.6
@lukeyouell

This comment has been minimized.

Copy link
Author

commented Jun 27, 2018

I've had it pointed out to me that this might not be caused by the checkbox field itself, but rather the join twig filter.

This is the code that when commented out, leads to the debug toolbar being shown:

<meta name="robots" content="{{ robots|join(', ') }}">

@naboo

This comment has been minimized.

Copy link

commented Jun 27, 2018

I've had the exact same behaviour happen to me. For me it was when using the .contains() function on the checkbox field. Like this: {% if category.enabledFilters.contains('surfaceTreatments') %}.

@brandonkelly

This comment has been minimized.

Copy link
Member

commented Jun 27, 2018

Can you guys inspect the raw page source (not just the "Elements" tab in Chrome), and run it through https://validator.w3.org/#validate_by_input to ensure it’s valid?

@lukeyouell

This comment has been minimized.

Copy link
Author

commented Jun 27, 2018

@brandonkelly the HTML is valid.

The error can be replicated by viewing the request url directly:

index.php?p=actions/debug/default/toolbar&tag=5b33921a9c5fc

If I replace the tag value with the value set in the CP it works.

@brandonkelly

This comment has been minimized.

Copy link
Member

commented Jun 27, 2018

Can you send the serialized data for one of the requests that isn’t working? (You can find the data in storage/runtime/debug/) support@craftcms.com

@lukeyouell

This comment has been minimized.

Copy link
Author

commented Jun 27, 2018

@brandonkelly

This comment has been minimized.

Copy link
Member

commented Jun 30, 2018

Thanks @lukeyouell! Got this fixed for the next release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.