Page 1 of 1

Report Designer PHP Error

Posted: Sat Feb 15, 2025 12:45 pm
by vario
I cannot edit layout of some reports as I get a blank page in Report Designer and a PHP error at the server:

Code: Select all

[Sat Feb 15 11:27:37.393068 2025] [php:error] [pid 37201:tid 37201] [client 192.168.1.34:57166] PHP Fatal error:  Allowed memory size of 134217728 bytes exhausted (tried to allocate 106955480 bytes) in /var/www/forte/core/nucommon.php(1471) : eval()'d code on line 35, referer: https://myhostname/forte/index.php
I have tried increasing memory_limit in php.ini from its value of 128M up to 1024M but still get the same error though the size of allocation increases:

Code: Select all

[Wed Feb 12 19:51:10.002016 2025] [php:error] [pid 38893:tid 38893] [client 192.168.1.34:47182] PHP Fatal error:  Allowed memory size of 1073741824 bytes exhausted (tried to allocate 534774264 bytes) in /var/www/forte/core/nucommon.php(1471) : eval()'d code on line 45, referer: https://myhostname/forte/index.php
I'm not sure what has changed to cause this. Here's my "Version Info:

Database: Arch Linux 11.7.2-MariaDB
PHP: 8.4.3
nuBuilder DB: V.4.5-2024.06.08.00
nuBuilder Files: V.4.5-2024.06.08.04

Neil.

Re: Report Designer PHP Error

Posted: Sat Feb 15, 2025 1:24 pm
by kev1n
Hi,

This could either be due to the used PHP version (try an older version) or update nuBuilder, which uses newer versions of TCPDF.

Re: Report Designer PHP Error

Posted: Sun Feb 16, 2025 7:16 am
by vario
Have upgraded but the PHP error persists.

I don't want to downgrade my PHP so will put up with old report layout temporarily until a solution can be found!

EDIT: The report uses a procedure to make the report table and this is the cause of the error somehow. I replaced the report procedure with a nuSQL table - then I was able to edit the layout with Report Designer, and switch back to the procedure. So some progress at least!

Re: Report Designer PHP Error

Posted: Sun Feb 16, 2025 11:37 am
by vario
I have managed to find the problem. There is a "for" in the procedure which is being run until memory is exhausted. Nothing wrong with the code I think (other than the usual stylistic objections) as it runs perfectly well as a report, just the eval() before launching Report Designer appears to be causing this.

Code: Select all

for ($yr = $toYr; $yr >= $fromYr; $yr--) $sql .= " union all " . str_replace('?', 'ticket_' . $yr, $usql);
$fromYr and $toYr take their values from hash variables.

Re: Report Designer PHP Error

Posted: Sun Feb 16, 2025 11:50 pm
by kev1n
The information provided is somewhat vague because it doesn't specify the actual values of $fromYr and $toYr. To debug this, use nuDebug() to inspect their values and ensure they are properly initialised.

Re: Report Designer PHP Error

Posted: Mon Feb 17, 2025 8:38 am
by vario
They have no values yet, I am trying to open the Report Designer so why is the loop even running?

Re: Report Designer PHP Error

Posted: Mon Feb 17, 2025 9:49 am
by kev1n
The report builder can use a table, Nu-SQL, or a procedure as its data source. It relies on the underlying SQL to determine the available fields.

Since you're using a procedure, ensure that it runs without loops. If variables are initialised via Hash Cookies, make sure they are also initialised when no Hash Cookies are set (E.g. check if a HK is set and if not, use a default value)

Re: Report Designer PHP Error

Posted: Mon Feb 17, 2025 10:11 am
by vario
OK thanks, all sorted now. My first time using a loop in a report procedure!