Post by head_dunce » Wed May 08, 2019 5:47 am

I'm trying to modify the Twig stuff, but I don't know what the variables contain, so I assume I need to dump them.
So reading this -
https://twig.symfony.com/doc/2.x/functions/dump.html

It looks like the Twig loader is in -
/var/www/html/catalog/controller/event/theme.php

But I'm not sure if that DebugExtension is somewhere? Anyone install the Twig dump that can help?

Jim
Middle Caicos, Turks and Caicos Islands


Active Member

Posts

Joined
Thu Apr 04, 2019 11:50 pm

Post by straightlight » Wed May 08, 2019 5:48 am


The most generated errors being found on Opencart forum originates from contributed programming. The increased post counters are caused by redundancies of the same solutions that were already provided prior.


Regards,
Straightlight
Opencart.com Administrator / Quality Assurance Analyst / Programmer


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON

Post by head_dunce » Wed May 08, 2019 5:56 am

Ah, thanks!

Jim
Middle Caicos, Turks and Caicos Islands


Active Member

Posts

Joined
Thu Apr 04, 2019 11:50 pm

Post by head_dunce » Wed May 08, 2019 9:46 am

Didn't work

Code: Select all

Fatal error: Uncaught exception 'Twig_Error_Syntax' with message 'Unknown "dump" function in "__string_template__5b2a435a5d40c2041f16a317c7f3982355f9d27bc7bde73b3a0933f726f087a3" at line 26.' in /var/www/html/system/library/template/Twig/ExpressionParser.php:574 Stack trace: #0 /var/www/html/system/library/template/Twig/ExpressionParser.php(351): Twig_ExpressionParser->getFunctionNodeClass('dump', 26) #1 /var/www/html/system/library/template/Twig/ExpressionParser.php(144): Twig_ExpressionParser->getFunctionNode('dump', 26) #2 /var/www/html/system/library/template/Twig/ExpressionParser.php(84): Twig_ExpressionParser->parsePrimaryExpression() #3 /var/www/html/system/library/template/Twig/ExpressionParser.php(41): Twig_ExpressionParser->getPrimary() #4 /var/www/html/system/library/template/Twig/Parser.php(144): Twig_ExpressionParser->parseExpression() #5 /var/www/html/system/library/template/Twig/TokenParser/For.php(40): Twig_Parser->subparse(Array) #6 /var/www/html/system/library/template/Twig/Parser.php(187): Twig_TokenPar in /var/www/html/system/library/template/Twig/ExpressionParser.php on line 574

Jim
Middle Caicos, Turks and Caicos Islands


Active Member

Posts

Joined
Thu Apr 04, 2019 11:50 pm

Post by letxobnav » Wed May 08, 2019 1:34 pm

By design, the dump() function is only available in the dev and test environments, to avoid leaking sensitive information in production. In fact, trying to use the dump() function in the prod environment will result in a PHP error.

Crystal Light Centrum Taiwan
Extensions: MailQueue | SUKHR | VBoces

“Data security is paramount at [...], and we are committed to protecting the privacy of anyone who is associated with our [...]. We’ve made a lot of improvements and will continue to make them.”
When you know your life savings are gone.


User avatar
Active Member

Posts

Joined
Fri Aug 18, 2017 4:35 pm
Location - Taiwan

Post by head_dunce » Wed May 08, 2019 6:52 pm

letxobnav wrote:
Wed May 08, 2019 1:34 pm
By design, the dump() function is only available in the dev and test environments, to avoid leaking sensitive information in production. In fact, trying to use the dump() function in the prod environment will result in a PHP error.
Yes, I know. So how did you get it to work?

Jim
Middle Caicos, Turks and Caicos Islands


Active Member

Posts

Joined
Thu Apr 04, 2019 11:50 pm

Post by letxobnav » Wed May 08, 2019 7:30 pm

I didn't, I have no need to dump anything related to twig.
If I need to check what I send to twig, I dump those variables in my php error log from the controller.

Besides, I only use twig to display variables and use as little twig logic as possible, for the rest I say far away from it.

Crystal Light Centrum Taiwan
Extensions: MailQueue | SUKHR | VBoces

“Data security is paramount at [...], and we are committed to protecting the privacy of anyone who is associated with our [...]. We’ve made a lot of improvements and will continue to make them.”
When you know your life savings are gone.


User avatar
Active Member

Posts

Joined
Fri Aug 18, 2017 4:35 pm
Location - Taiwan

Post by straightlight » Wed May 08, 2019 7:38 pm

Using stored logs from PHP does not provide TWIG structures. However, you could contact the extension developer to ask how his extension works if no detailed documentation has been provided about it. As an alternative, there are also other extensions on the Marketplace you could use simply by using the Marketplace search form.

The most generated errors being found on Opencart forum originates from contributed programming. The increased post counters are caused by redundancies of the same solutions that were already provided prior.


Regards,
Straightlight
Opencart.com Administrator / Quality Assurance Analyst / Programmer


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON

Post by head_dunce » Thu May 09, 2019 12:11 am

Figured it out.
Edit this file -
catalog/controller/event/theme.php

$config = array('autoescape' => false);
to
$config = array('autoescape' => false,'debug' => true,);

after this line
$this->twig = new \Twig_Environment($loader, $config);]
add this line
$this->twig->addExtension(new \Twig_Extension_Debug());

Jim
Middle Caicos, Turks and Caicos Islands


Active Member

Posts

Joined
Thu Apr 04, 2019 11:50 pm
Who is online

Users browsing this forum: No registered users and 10 guests