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

Graph issue. #274

Closed
microservizi opened this issue Oct 26, 2022 · 12 comments
Closed

Graph issue. #274

microservizi opened this issue Oct 26, 2022 · 12 comments

Comments

@microservizi
Copy link

All graph in application have errors.
Noted that the Apache error log report this info
PHP Fatal error: Uncaught TypeError: array_push(): Argument #1 ($array) must be of type array, null given in /var/www/html/daloradius/library/libchart/classes/Chart.php:81

Even on current live beta the issue is present

@filippolauria
Copy link
Collaborator

Hi, I am trying to reproduce the error.
Can you provide more lines of your Apache log?

@microservizi
Copy link
Author

microservizi commented Oct 28, 2022 via email

@filippolauria
Copy link
Collaborator

On my test environment (PHP 7.4 / Apache 2.4) graphs were working just fine.
Anyway, I have just pushed a fix (#275) that standardizes how data is passed to the libchart library, hoping that this could fix issues with older versions of PHP.

If this does not fix the issue I need more details to further investigate the problem,
can you provide info on your working environment?

@microservizi
Copy link
Author

microservizi commented Oct 28, 2022 via email

@microservizi
Copy link
Author

I just download the new version with the fix (#275)
and error there.

here is a full log after reboot the apache2 service

[Fri Oct 28 19:36:28.894522 2022] [mpm_prefork:notice] [pid 15521] AH00163: Apache/2.4.52 (Ubuntu) configured -- resuming normal operations
[Fri Oct 28 19:36:28.894571 2022] [core:notice] [pid 15521] AH00094: Command line: '/usr/sbin/apache2'
[Fri Oct 28 19:36:40.763629 2022] [php:error] [pid 15523] [client 172.30.3.249:56347] PHP Fatal error: Uncaught TypeError: array_push(): Argument #1 ($array) must be of type array, null given in /var/www/html/daloradius3/library/libchart/classes/Chart.php:81\nStack trace:\n#0 /var/www/html/daloradius3/library/libchart/classes/Chart.php(81): array_push()\n#1 /var/www/html/daloradius3/library/graphs-reports-online-users.php(54): Chart->addPoint()\n#2 {main}\n thrown in /var/www/html/daloradius3/library/libchart/classes/Chart.php on line 81, referer: http://172.30.101.23/daloradius3/rep-online.php?usernameOnline=
[Fri Oct 28 19:36:40.766447 2022] [php:error] [pid 15525] [client 172.30.3.249:56346] PHP Fatal error: Uncaught TypeError: array_push(): Argument #1 ($array) must be of type array, null given in /var/www/html/daloradius3/library/libchart/classes/Chart.php:81\nStack trace:\n#0 /var/www/html/daloradius3/library/libchart/classes/Chart.php(81): array_push()\n#1 /var/www/html/daloradius3/library/graphs-reports-online-nas.php(46): Chart->addPoint()\n#2 {main}\n thrown in /var/www/html/daloradius3/library/libchart/classes/Chart.php on line 81, referer: http://172.30.101.23/daloradius3/rep-online.php?usernameOnline=
[Fri Oct 28 19:36:46.174995 2022] [php:warn] [pid 15524] [client 172.30.3.249:56359] PHP Warning: Undefined variable $short_size in /var/www/html/daloradius3/library/tables-alltime-users-login.php on line 179, referer: http://172.30.101.23/daloradius3/graph-main.php
[Fri Oct 28 19:36:46.175052 2022] [php:warn] [pid 15524] [client 172.30.3.249:56359] PHP Warning: Undefined variable $size in /var/www/html/daloradius3/library/tables-alltime-users-login.php on line 179, referer: http://172.30.101.23/daloradius3/graph-main.php
[Fri Oct 28 19:36:46.175065 2022] [php:warn] [pid 15524] [client 172.30.3.249:56359] PHP Warning: Trying to access array offset on value of type null in /var/www/html/daloradius3/library/tables-alltime-users-login.php on line 179, referer: http://172.30.101.23/daloradius3/graph-main.php
[Fri Oct 28 19:36:46.187897 2022] [php:error] [pid 15524] [client 172.30.3.249:56359] PHP Fatal error: Uncaught TypeError: array_push(): Argument #1 ($array) must be of type array, null given in /var/www/html/daloradius3/library/libchart/classes/Chart.php:81\nStack trace:\n#0 /var/www/html/daloradius3/library/libchart/classes/Chart.php(81): array_push()\n#1 /var/www/html/daloradius3/library/graphs-alltime-users-login.php(71): Chart->addPoint()\n#2 {main}\n thrown in /var/www/html/daloradius3/library/libchart/classes/Chart.php on line 81, referer: http://172.30.101.23/daloradius3/graphs-alltime_logins.php?type=daily
[Fri Oct 28 19:36:47.668613 2022] [php:error] [pid 15527] [client 172.30.3.249:56368] PHP Fatal error: Uncaught TypeError: array_push(): Argument #1 ($array) must be of type array, null given in /var/www/html/daloradius3/library/libchart/classes/Chart.php:81\nStack trace:\n#0 /var/www/html/daloradius3/library/libchart/classes/Chart.php(81): array_push()\n#1 /var/www/html/daloradius3/library/graphs-alltime-traffic-upload.php(74): Chart->addPoint()\n#2 {main}\n thrown in /var/www/html/daloradius3/library/libchart/classes/Chart.php on line 81, referer: http://172.30.101.23/daloradius3/graphs-alltime_traffic_compare.php?type=daily&size=megabytes
[Fri Oct 28 19:36:47.670178 2022] [php:error] [pid 15526] [client 172.30.3.249:56360] PHP Fatal error: Uncaught TypeError: array_push(): Argument #1 ($array) must be of type array, null given in /var/www/html/daloradius3/library/libchart/classes/Chart.php:81\nStack trace:\n#0 /var/www/html/daloradius3/library/libchart/classes/Chart.php(81): array_push()\n#1 /var/www/html/daloradius3/library/graphs-alltime-traffic-download.php(74): Chart->addPoint()\n#2 {main}\n thrown in /var/www/html/daloradius3/library/libchart/classes/Chart.php on line 81, referer: http://172.30.101.23/daloradius3/graphs-alltime_traffic_compare.php?type=daily&size=megabytes

@filippolauria
Copy link
Collaborator

Ok. I think the problem is an incompatibility between the library used for rendering graphs and newer PHP version(s).
The library we use libchart v1.1.

With #276 I have update that library to the latest version (v1.3).

If the problem is still there, I think the library code (which is third-party code) should be fixed in order to work with PHP > 7.4.

@microservizi
Copy link
Author

Thank you so much for your great support
unfortunatelly there is now another error

What I do suggest is to create VM with fresh installation of UBUNTU 22.04 and install Apache2 / freeradius / mariadb / php
you will see immediate the issue.

here below the new log

[Sun Oct 30 00:33:38.761530 2022] [php:warn] [pid 4712] [client 172.30.3.249:56927] PHP Warning: Undefined variable $short_size in /var/www/html/daloradius2/library/tables-alltime-users-login.php on line 179, referer: http://172.30.101.23/daloradius2/graph-main.php
[Sun Oct 30 00:33:38.761631 2022] [php:warn] [pid 4712] [client 172.30.3.249:56927] PHP Warning: Undefined variable $size in /var/www/html/daloradius2/library/tables-alltime-users-login.php on line 179, referer: http://172.30.101.23/daloradius2/graph-main.php
[Sun Oct 30 00:33:38.761660 2022] [php:warn] [pid 4712] [client 172.30.3.249:56927] PHP Warning: Trying to access array offset on value of type null in /var/www/html/daloradius2/library/tables-alltime-users-login.php on line 179, referer: http://172.30.101.23/daloradius2/graph-main.php
[Sun Oct 30 00:33:38.777497 2022] [php:error] [pid 4712] [client 172.30.3.249:56927] PHP Fatal error: Unparenthesized a ? b : c ? d : e is not supported. Use either (a ? b : c) ? d : e or a ? b : (c ? d : e) in /var/www/html/daloradius2/library/libchart/classes/view/chart/PieChart.php on line 67, referer: http://172.30.101.23/daloradius2/graphs-alltime_logins.php?type=daily
[Sun Oct 30 00:33:50.620803 2022] [php:error] [pid 4713] [client 172.30.3.249:56946] PHP Fatal error: Unparenthesized a ? b : c ? d : e is not supported. Use either (a ? b : c) ? d : e or a ? b : (c ? d : e) in /var/www/html/daloradius2/library/libchart/classes/view/chart/PieChart.php on line 67, referer: http://172.30.101.23/daloradius2/graphs-alltime_traffic_compare.php?type=daily&size=megabytes
[Sun Oct 30 00:33:50.625676 2022] [php:error] [pid 4710] [client 172.30.3.249:56947] PHP Fatal error: Unparenthesized a ? b : c ? d : e is not supported. Use either (a ? b : c) ? d : e or a ? b : (c ? d : e) in /var/www/html/daloradius2/library/libchart/classes/view/chart/PieChart.php on line 67, referer: http://172.30.101.23/daloradius2/graphs-alltime_traffic_compare.php?type=daily&size=megabytes

@filippolauria
Copy link
Collaborator

Thank you.

With #278 I think graphs problem on PHP 8.1.2 has been resolved.
Also this PR introduced big general improvements.
Go and check it out to have more details.

Keep using/testing the "not-released feature" of this product.

@microservizi
Copy link
Author

thank you

@microservizi
Copy link
Author

Unfortunately Filippo,
problem still there.
I tried now donwloaded last version and I see below error.

[Mon Oct 31 18:27:48.298125 2022] [php:error] [pid 17359] [client 172.30.3.249:55640] PHP Fatal error: Uncaught TypeError: array_push(): Argument #1 ($array) must be of type array, null given in /var/www/html/daloradius2/library/libchart/classes/model/XYDataSet.php:44\nStack trace:\n#0 /var/www/html/daloradius2/library/libchart/classes/model/XYDataSet.php(44): array_push()\n#1 /var/www/html/daloradius2/library/graphs-alltime-users-login.php(72): XYDataSet->addPoint()\n#2 {main}\n thrown in /var/www/html/daloradius2/library/libchart/classes/model/XYDataSet.php on line 44, referer: http://172.30.101.23/daloradius2/graphs-alltime_logins.php?type=daily
[Mon Oct 31 18:27:57.031751 2022] [php:error] [pid 36216] [client 172.30.3.249:55659] PHP Fatal error: Uncaught TypeError: array_push(): Argument #1 ($array) must be of type array, null given in /var/www/html/daloradius2/library/libchart/classes/model/XYDataSet.php:44\nStack trace:\n#0 /var/www/html/daloradius2/library/libchart/classes/model/XYDataSet.php(44): array_push()\n#1 /var/www/html/daloradius2/library/graphs-alltime-users-login.php(72): XYDataSet->addPoint()\n#2 {main}\n thrown in /var/www/html/daloradius2/library/libchart/classes/model/XYDataSet.php on line 44, referer: http://172.30.101.23/daloradius2/graphs-alltime_logins.php?type=daily
[Mon Oct 31 18:28:48.141310 2022] [php:error] [pid 36218] [client 172.30.3.249:55737] PHP Fatal error: Uncaught TypeError: array_push(): Argument #1 ($array) must be of type array, null given in /var/www/html/daloradius2/library/libchart/classes/model/XYDataSet.php:44\nStack trace:\n#0 /var/www/html/daloradius2/library/libchart/classes/model/XYDataSet.php(44): array_push()\n#1 /var/www/html/daloradius2/library/graphs-alltime-users-login.php(72): XYDataSet->addPoint()\n#2 {main}\n thrown in /var/www/html/daloradius2/library/libchart/classes/model/XYDataSet.php on line 44, referer: http://172.30.101.23/daloradius2/graphs-alltime_logins.php?type=daily

@filippolauria
Copy link
Collaborator

Understood. We need more testing.
As I said, the graph library used by daloRADIUS does not receive updates.
We can plan switching to another graph library. In the meanwhile, as a workaround, I suggest you to use PHP 7 which should work fine.

@microservizi
Copy link
Author

Thank you it is working now.

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

2 participants