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

Profields Table: accessing empty text field throws an error (report cancelled, error is caused by Twig module) #1827

Closed
hiboudev opened this issue Oct 10, 2023 · 1 comment

Comments

@hiboudev
Copy link

hiboudev commented Oct 10, 2023

EDIT I didn't look at stack trace... This error is caused by Twig extension, so I close the report.

Short description of the issue

Accessing an empty Text field inside a Profields Table throws this error:

Look out… Erreur fatale: Uncaught Error: An exception has been thrown during the rendering of a template ("Method TableRow::reason does not exist or is not callable in this context").
#0 src-processwire\vendor\twig\twig\src\Template.php(367): Twig\Template->displayWithErrorHandling(Array, Array)
#1 src-processwire\vendor\twig\twig\src\Template.php(379): Twig\Template->display(Array)
#2 src-processwire\vendor\twig\twig\src\TemplateWrapper.php(40): Twig\Template->render(Array, Array)
#3 src-processwire\vendor\twig\twig\src\Extension\CoreExtension.php(1347): Twig\TemplateWrapper->render(Array)
#4 src-processwire\site\assets\cache\TemplateEngineTwig_compile\8a\8a22dcf5304fc7aba24e035ffbf589d2.php(61): twig_include(Object(Twig\Environment), Array, 'fragments/race/...', Array)

If the field has a value, no error is thrown.

Expected behavior

Getting an empty string.

Actual behavior

Getting an error.

Steps to reproduce the issue

  1. Create a Profields Table field with several fields including one Text field,
  2. In the page using this Table, add a row and keep the Text field empty.
  3. In PHP, loop over the Table rows, accessing the Text field value.

Setup/Environment

  • ProcessWire version: 3.0.228
  • (Optional) PHP version: 8.1
@hiboudev hiboudev changed the title Profields Table: accessing empty text field throws an error Profields Table: accessing empty text field throws an error (report cancelled, it's caused by Twig module) Oct 10, 2023
@hiboudev
Copy link
Author

Error happens only from Twig.

@hiboudev hiboudev changed the title Profields Table: accessing empty text field throws an error (report cancelled, it's caused by Twig module) Profields Table: accessing empty text field throws an error (report cancelled, error is caused by Twig module) Oct 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant