Json_decode_html size limit - Twig template

Your software
My Mautic version is: v4.1.2
My PHP version is: PHP Version 7.4.26
My Database type and version is: Ver 15.1 Distrib 10.5.13-MariaDB, for debian-linux-gnu (x86_64) using readline 5.2

Your problem
My problem is:

I have been using twig templates in my emails to access the data sent in the body via POST request.

I use the function “json_decode_html” to achieve this, example:

{% set orderEncoded = attribute(tokens, ‘{order}’) %}
{% set order = orderEncoded| json_decode_html %}

In my emails, I use the for loop to be able to map my arrays of objects without problems, but I have noticed a peculiarity and that is when my array of objects is very large, I cannot access them and I receive the error "500 Internal Server Error " when making the post request.

This only happens if I try to access the properties of the object, so it has made me think about it.

One of the conclusions I’m having is that the “json_decode_html” function has a limit size, but I’m not sure about it.

If anyone could help me or has had the same problem I will really appreciate it.

Thanks

These errors are showing in the log:

NOTE: What is shown in the logs has nothing to do with my problem

[2022-04-05 12:55:03] mautic.NOTICE: Symfony\Component\Console\Exception\RuntimeException: Too many arguments, expected arguments “command”. (uncaught exception) at /var/www/html/mautic/vendor/symfony/console/Input/ArgvInput.php line 172 while running console command mautic:maintenance:cleanup
[2022-04-05 12:55:03] mautic.WARNING: Command mautic:maintenance:cleanup exited with status code 1
[2022-04-05 12:56:04] mautic.NOTICE: Symfony\Component\Console\Exception\RuntimeException: Too many arguments, expected arguments “command”. (uncaught exception) at /var/www/html/mautic/vendor/symfony/console/Input/ArgvInput.php line 172 while running console command mautic:maintenance:cleanup
[2022-04-05 12:56:04] mautic.WARNING: Command mautic:maintenance:cleanup exited with status code 1
[2022-04-05 12:57:03] mautic.NOTICE: Symfony\Component\Console\Exception\RuntimeException: Too many arguments, expected arguments “command”. (uncaught exception) at /var/www/html/mautic/vendor/symfony/console/Input/ArgvInput.php line 172 while running console command mautic:maintenance:cleanup
[2022-04-05 12:57:03] mautic.WARNING: Command mautic:maintenance:cleanup exited with status code 1
[2022-04-05 12:58:04] mautic.NOTICE: Symfony\Component\Console\Exception\RuntimeException: Too many arguments, expected arguments “command”. (uncaught exception) at /var/www/html/mautic/vendor/symfony/console/Input/ArgvInput.php line 172 while running console command mautic:maintenance:cleanup
[2022-04-05 12:58:04] mautic.WARNING: Command mautic:maintenance:cleanup exited with status code 1
[2022-04-05 12:59:03] mautic.NOTICE: Symfony\Component\Console\Exception\RuntimeException: Too many arguments, expected arguments “command”. (uncaught exception) at /var/www/html/mautic/vendor/symfony/console/Input/ArgvInput.php line 172 while running console command mautic:maintenance:cleanup
[2022-04-05 12:59:03] mautic.WARNING: Command mautic:maintenance:cleanup exited with status code 1
[2022-04-05 13:00:03] mautic.NOTICE: Symfony\Component\Console\Exception\RuntimeException: Too many arguments, expected arguments “command”. (uncaught exception) at /var/www/html/mautic/vendor/symfony/console/Input/ArgvInput.php line 172 while running console command mautic:maintenance:cleanup
[2022-04-05 13:00:03] mautic.WARNING: Command mautic:maintenance:cleanup exited with status code 1
[2022-04-05 13:01:04] mautic.NOTICE: Symfony\Component\Console\Exception\RuntimeException: Too many arguments, expected arguments “command”. (uncaught exception) at /var/www/html/mautic/vendor/symfony/console/Input/ArgvInput.php line 172 while running console command mautic:maintenance:cleanup
[2022-04-05 13:01:04] mautic.WARNING: Command mautic:maintenance:cleanup exited with status code 1
[2022-04-05 13:02:03] mautic.NOTICE: Symfony\Component\Console\Exception\RuntimeException: Too many arguments, expected arguments “command”. (uncaught exception) at /var/www/html/mautic/vendor/symfony/console/Input/ArgvInput.php line 172 while running console command mautic:maintenance:cleanup
[2022-04-05 13:02:03] mautic.WARNING: Command mautic:maintenance:cleanup exited with status code 1
[2022-04-05 13:03:04] mautic.NOTICE: Symfony\Component\Console\Exception\RuntimeException: Too many arguments, expected arguments “command”. (uncaught exception) at /var/www/html/mautic/vendor/symfony/console/Input/ArgvInput.php line 172 while running console command mautic:maintenance:cleanup
[2022-04-05 13:03:04] mautic.WARNING: Command mautic:maintenance:cleanup exited with status code 1
[2022-04-05 13:04:03] mautic.NOTICE: Symfony\Component\Console\Exception\RuntimeException: Too many arguments, expected arguments “command”. (uncaught exception) at /var/www/html/mautic/vendor/symfony/console/Input/ArgvInput.php line 172 while running console command mautic:maintenance:cleanup
[2022-04-05 13:04:03] mautic.WARNING: Command mautic:maintenance:cleanup exited with status code 1
[2022-04-05 13:05:03] mautic.NOTICE: Symfony\Component\Console\Exception\RuntimeException: Too many arguments, expected arguments “command”. (uncaught exception) at /var/www/html/mautic/vendor/symfony/console/Input/ArgvInput.php line 172 while running console command mautic:maintenance:cleanup
[2022-04-05 13:05:03] mautic.WARNING: Command mautic:maintenance:cleanup exited with status code 1
[2022-04-05 13:06:04] mautic.NOTICE: Symfony\Component\Console\Exception\RuntimeException: Too many arguments, expected arguments “command”. (uncaught exception) at /var/www/html/mautic/vendor/symfony/console/Input/ArgvInput.php line 172 while running console command mautic:maintenance:cleanup
[2022-04-05 13:06:04] mautic.WARNING: Command mautic:maintenance:cleanup exited with status code 1
[2022-04-05 13:07:03] mautic.NOTICE: Symfony\Component\Console\Exception\RuntimeException: Too many arguments, expected arguments “command”. (uncaught exception) at /var/www/html/mautic/vendor/symfony/console/Input/ArgvInput.php line 172 while running console command mautic:maintenance:cleanup
[2022-04-05 13:07:03] mautic.WARNING: Command mautic:maintenance:cleanup exited with status code 1
[2022-04-05 13:08:04] mautic.NOTICE: Symfony\Component\Console\Exception\RuntimeException: Too many arguments, expected arguments “command”. (uncaught exception) at /var/www/html/mautic/vendor/symfony/console/Input/ArgvInput.php line 172 while running console command mautic:maintenance:cleanup
[2022-04-05 13:08:04] mautic.WARNING: Command mautic:maintenance:cleanup exited with status code 1
[2022-04-05 13:09:03] mautic.NOTICE: Symfony\Component\Console\Exception\RuntimeException: Too many arguments, expected arguments “command”. (uncaught exception) at /var/www/html/mautic/vendor/symfony/console/Input/ArgvInput.php line 172 while running console command mautic:maintenance:cleanup
[2022-04-05 13:09:03] mautic.WARNING: Command mautic:maintenance:cleanup exited with status code 1
[2022-04-05 13:10:03] mautic.NOTICE: Symfony\Component\Console\Exception\RuntimeException: Too many arguments, expected arguments “command”. (uncaught exception) at /var/www/html/mautic/vendor/symfony/console/Input/ArgvInput.php line 172 while running console command mautic:maintenance:cleanup
[2022-04-05 13:10:03] mautic.WARNING: Command mautic:maintenance:cleanup exited with status code 1
[2022-04-05 13:11:04] mautic.NOTICE: Symfony\Component\Console\Exception\RuntimeException: Too many arguments, expected arguments “command”. (uncaught exception) at /var/www/html/mautic/vendor/symfony/console/Input/ArgvInput.php line 172 while running console command mautic:maintenance:cleanup
[2022-04-05 13:11:04] mautic.WARNING: Command mautic:maintenance:cleanup exited with status code 1
[2022-04-05 13:12:03] mautic.NOTICE: Symfony\Component\Console\Exception\RuntimeException: Too many arguments, expected arguments “command”. (uncaught exception) at /var/www/html/mautic/vendor/symfony/console/Input/ArgvInput.php line 172 while running console command mautic:maintenance:cleanup
[2022-04-05 13:12:03] mautic.WARNING: Command mautic:maintenance:cleanup exited with status code 1
[2022-04-05 13:13:03] mautic.NOTICE: Symfony\Component\Console\Exception\RuntimeException: Too many arguments, expected arguments “command”. (uncaught exception) at /var/www/html/mautic/vendor/symfony/console/Input/ArgvInput.php line 172 while running console command mautic:maintenance:cleanup
[2022-04-05 13:13:03] mautic.WARNING: Command mautic:maintenance:cleanup exited with status code 1
[2022-04-05 13:14:04] mautic.NOTICE: Symfony\Component\Console\Exception\RuntimeException: Too many arguments, expected arguments “command”. (uncaught exception) at /var/www/html/mautic/vendor/symfony/console/Input/ArgvInput.php line 172 while running console command mautic:maintenance:cleanup
[2022-04-05 13:14:04] mautic.WARNING: Command mautic:maintenance:cleanup exited with status code 1

Steps I have tried to fix the problem:

I have performed the test using two payloads with the same structure and values, one with more repeated values than the other.

The behavior: The payload that has less content works.

Hey, @kuzmany do you have an idea, what the solution is?
Thx.