froxlor / Froxlor

The server administration software for your needs - The official Froxlor development Git repository
http://www.froxlor.org
GNU General Public License v2.0
1.62k stars 455 forks source link

Making the default domain an alias domain results in an undefined offset in TrafficCron.php for v2.1.3 #1221

Closed chrschn closed 7 months ago

chrschn commented 7 months ago

Describe the bug When I make the default domain mycustomer.server.hoster.tld an alias of my-customer.de, the nightly traffic cronjob produces the following PHP notice:

PHP Notice:  Undefined offset: 6 in /var/www/html/froxlor/lib/Froxlor/Cron/Traffic/TrafficCron.php on line 168

The warning points to this line. I queried the database to find the customer whose standard subdomain has ID 6 and queried the subdomains:

SELECT `id`, `domain`, `customerid`, `parentdomainid`, `speciallogfile`  FROM `panel_domains` WHERE `aliasdomain` IS NULL AND `email_only` <> '1' AND `customerid` = 3;
+----+----------------------------+------------+----------------+----------------+
| id | domain                     | customerid | parentdomainid | speciallogfile |
+----+----------------------------+------------+----------------+----------------+
|  7 | my-customer.de             |          3 |              0 |              1 |
|  8 | my-customer-alias.de       |          3 |              0 |              0 |
|  9 | my-customer-other-alias.de |          3 |              0 |              0 |
+----+----------------------------+------------+----------------+----------------+

Note that there's no subdomain with ID 6. However, in the Froxlor domain list, there's the additional domain mycustomer.server.hoster.tld, which is not returned by the query above. This domain is marked as an alias of domain my-customer.de. When I remove the alias (i.e., set it to "no alias"), then the query above also returns the domain with ID 6:

SELECT `id`, `domain`, `customerid`, `parentdomainid`, `speciallogfile`  FROM `panel_domains` WHERE `aliasdomain` IS NULL AND `email_only` <> '1' AND `customerid` = 3;
+----+------------------------------+------------+----------------+----------------+
| id | domain                       | customerid | parentdomainid | speciallogfile |
+----+------------------------------+------------+----------------+----------------+
|  6 | mycustomer.server.hoster.tld |          3 |              0 |              0 |
|  7 | my-customer.de               |          3 |              0 |              1 |
|  8 | my-customer-alias.de         |          3 |              0 |              0 |
|  9 | my-customer-other-alias.de   |          3 |              0 |              0 |
+----+------------------------------+------------+----------------+----------------+

System information

Expected behavior The traffic cronjob should work without warnings with any alias setting, or it should not allow configurations which result in warnings.

Additional context The alias setting for the standard domain was enabled for a long time on this server., but this warning started to appear after Froxlor was updated from 2.1.2-1 to 2.1.3-1.

d00p commented 7 months ago

known and fixed for upcoming version see commit https://github.com/Froxlor/Froxlor/commit/4073984fd7391386ab8bbccc913755c646049d86

chrschn commented 7 months ago

Thanks!