Merge pull request #107 from Deutscher-Tischfussballbund/fix/64_division_by_zero

Fix: add division by zero check, return zero instead of exception
This commit is contained in:
MarvinF
2025-06-30 18:55:47 +02:00
committed by GitHub
3 changed files with 7 additions and 1 deletions
+2
View File
@@ -0,0 +1,2 @@
This is no official release!
The Release and the release notes will be generated by github actions
@@ -2323,6 +2323,10 @@ function mp_mult_($p1, $p2): float|int
*/
function mp_div_($p1, $p2): float|int
{
if ($p2 == 0) {
Log::add("Division by zero detected in mp_div_: divisor was 0. Returning 0 as fallback.", Log::WARNING, "com_sportsmanager");
return 0;
}
return $p1 / $p2;
}
@@ -40,7 +40,7 @@ function addOnLoad($function): void
<?php
}
function SportsManagerURL($weitereParameter = null, $ssl = 0): ?string
function SportsManagerURL($weitereParameter = "", $ssl = 0): ?string
{
$urlPath = handleFilter($weitereParameter);
$joomlaBaseUrl = Uri::getInstance()->toString([