View Issue Details

This bug affects 1 person(s).
 2
IDProjectCategoryView StatusLast Update
19894Bug reportsOtherpublic2024-12-18 17:51
Reportertassoman Assigned To 
PrioritynoneSeverityminor 
Status newResolutionopen 
Product Version6.6.x 
Summary19894: Calling "__tostring" method on a "SimpleXMLElement" object is not allowed
Description

While editing new theme by hands, I tried to dump(aSurveyInfo) variable.

Version is 6.8.2+241203 (missing product version in bug tracker)

Twig\Sandbox\SecurityNotAllowedMethodError

Calling "tostring" method on a "SimpleXMLElement" object is not allowed in "string_template__b85a9d86339e4b676595fbe968ac295f" at line 234.

Steps To Reproduce

Steps to reproduce

  1. create new survey theme extending fruity_twentythree
  2. enable config debug = 1
  3. add config variable 'force_xmlsettings_for_survey_rendering' => true,
  4. add {{ dump(aSurveyInfo) }} code inside global layout template

Expected result

I wanted to dump survey data

Actual result

error stacktrace, see attached image

Tagstheme, twig
Attached Files
Bug heat2
Complete LimeSurvey version number (& build)6.8.2+241203
I will donate to the project if issue is resolvedNo
BrowserAny
Database type & versionMysql 5.7.x
Server OS (if known)
Webserver software & version (if known)
PHP Version8.2.26

Users monitoring this issue

There are no users monitoring this issue.

Activities

tassoman

tassoman

2024-12-18 17:13

reporter   ~81659

Found this on PHP Manual (about PHP 8.x)
https://www.php.net/manual/en/language.oop5.magic.php#object.tostring

tassoman

tassoman

2024-12-18 17:51

reporter   ~81660

By removing force_xmlsettings_for_survey_rendering configuration, I got a similar error. That's because confinguration is an object.


Twig\Sandbox\SecurityNotAllowedMethodError
Calling "tostring" method on a "TemplateConfiguration" object is not allowed in "string_template__b85a9d86339e4b676595fbe968ac295f" at line 234.

To debug like this, i usually do var_export($var, true); https://www.php.net/manual/en/function.var-export.php
Maybe dump() function can ignore __toString() special method and use the var_export() function?
Also print_r($var, true); has the same behaviour https://www.php.net/manual/en/function.print-r.php

Issue History

Date Modified Username Field Change
2024-12-16 17:15 tassoman New Issue
2024-12-16 17:15 tassoman File Added: Screenshot 2024-12-16 at 17-08-45 Twig_Sandbox_SecurityNotAllowedMethodError.png
2024-12-16 17:17 tassoman Tag Attached: twig
2024-12-16 17:17 tassoman Tag Attached: theme
2024-12-18 17:13 tassoman Note Added: 81659
2024-12-18 17:13 tassoman Bug heat 0 => 2
2024-12-18 17:51 tassoman Note Added: 81660