WillyXJ/facileManager

[BUG] Uncaught TypeError in POST to server /buildconf.php

Closed this issue · 5 comments

fM Version : 4.6.1
fmDNS Version : 6.0.3

In raising this issue, I confirm the following (please check boxes, eg [X]):

  • I have read and understood the contributors guide.
  • I have checked that the bug-fix I am reporting can be replicated, or that the feature I am suggesting isn't already present.
  • I have checked that the issue I'm posting isn't already reported.
  • I have checked that the issue I'm posting isn't already solved and no duplicates exist in closed issues and opened issues
  • I have checked the pull requests tab for existing solutions/implementations to my issue/suggestion.

(BUG | ISSUE) Expected Behavior:

Client should be able to call /buildconf.php endpoint at fM server (POST /buildconf.php)

(BUG | ISSUE) Actual Behavior:

  • Client: client/facileManager/fmDNS/client.php buildconf fails silently with exit code 1
  • Server: POST to server /buildconf.php fails with http/500
  • Server: PHP logs error:
    [php:error] PHP Fatal error: Uncaught TypeError: array_unique(): Argument #1 ($array) must be of type array, null given in /var/www/facileManager/fm-modules/fmDNS/classes/class_buildconf.php:739\nStack trace:\n#0 /var/www/facileManager/fm-modules/fmDNS/classes/class_buildconf.php(739): array_unique()\n#1 /var/www/facileManager/fm-modules/shared/pages/buildconf.php(52): fm_module_buildconf->buildServerConfig()\n#2 /var/www/facileManager/index.php(57): include('...')\n#3 {main}\n thrown in /var/www/facileManager/fm-modules/fmDNS/classes/class_buildconf.php on line 739

(BUG | ISSUE) Steps to reproduce:

  • Debian 12 (Bookworm)
  • PHP 8.2.7
  • Apache 2.4.57
  • Fresh install on server
  • Fresh install on client
  • Register client successfully using http
  • Build config for the client -> fails silently in UI (with http/500 and PHP error in logs)

How are your zones look like in UI?

Looking at the code, this fatal error would only occur if there are no zones to build. A workaround until a fix is released is to build at least one zone.

There are only localhost zones and their reverse provided by default install.

I can confirm that workaround of creating at least one valid zone on fresh install works.

This is now fixed in fmDNS 6.0.4 and later.