Skip to content

Commit 832e9d0

Browse files
authored
fix: PHP Warnings in Management Settings (#1805)
<!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Bug Fixes** * Enhanced remote access configuration handling to gracefully manage missing or undefined parameter values. * Improved overall system stability through safer default handling of optional settings that may not be present. <sub>✏️ Tip: You can customize this high-level summary in your review settings.</sub> <!-- end of auto-generated comment: release notes by coderabbit.ai -->
1 parent 31af99e commit 832e9d0

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

plugin/source/dynamix.unraid.net/usr/local/emhttp/plugins/dynamix.my.servers/Connect.page

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,9 @@ $passwd_result = exec('/usr/bin/passwd --status root');
3737
$boolWebUIAuth = $isRegistered && (($passwd_result !== false) && (substr($passwd_result, 0, 6) == 'root P'));
3838

3939
// Helper to determine the current value for the remote access input
40-
$dynamicRemoteAccessType = $myServersFlashCfg['remote']['dynamicRemoteAccessType'];
41-
$upnpEnabled = $myServersFlashCfg['remote']['upnpEnabled'] === 'yes';
42-
$wanaccessEnabled = $myServersFlashCfg['remote']['wanaccess'] === 'yes';
40+
$dynamicRemoteAccessType = $myServersFlashCfg['remote']['dynamicRemoteAccessType'] ?? null;
41+
$upnpEnabled = ($myServersFlashCfg['remote']['upnpEnabled'] ?? null) === 'yes';
42+
$wanaccessEnabled = ($myServersFlashCfg['remote']['wanaccess'] ?? null) === 'yes';
4343

4444
$currentRemoteAccessValue = 'OFF';
4545
if ($dynamicRemoteAccessType === 'STATIC') {
@@ -68,7 +68,7 @@ div.shade-gray{background-color:#121510;margin-top:10px;padding:8px 0 3px 0}
6868
</style>
6969
<script>
7070
const hasMyUnraidNetCert = <?=($hasMyUnraidNetCert ? 'true' : 'false')?>;
71-
const wanAccessOrg = "<?=$myServersFlashCfg['remote']['wanaccess']?>";
71+
const wanAccessOrg = "<?=$myServersFlashCfg['remote']['wanaccess'] ?? null?>";
7272

7373
function registerServer(button) {
7474

@@ -196,7 +196,7 @@ function dnsCheckServer(button) {
196196
} else {
197197
swal({
198198
title: "Oops",
199-
text: "<?=sprintf(_("The Unraid server is unreachable from outside your network. Be sure you have configured your router to forward port") . " <strong style='font-weight: bold'>%u/TCP</strong> " . _("to the Unraid server at") . " <strong style='font-weight: bold'>%s</strong> " . _("port") . " <strong style='font-weight: bold'>%u</strong>", $myServersFlashCfg['remote']['wanport'], htmlspecialchars($eth0['IPADDR:0']??''), $var['PORTSSL']??443)?>",
199+
text: "<?=sprintf(_("The Unraid server is unreachable from outside your network. Be sure you have configured your router to forward port") . " <strong style='font-weight: bold'>%u/TCP</strong> " . _("to the Unraid server at") . " <strong style='font-weight: bold'>%s</strong> " . _("port") . " <strong style='font-weight: bold'>%u</strong>", $myServersFlashCfg['remote']['wanport']??"", htmlspecialchars($eth0['IPADDR:0']??''), $var['PORTSSL']??443)?>",
200200
type: "error",
201201
html: true,
202202
confirmButtonText: "_(Ok)_"

plugin/source/dynamix.unraid.net/usr/local/emhttp/plugins/dynamix.plugin.manager/include/UnraidCheck.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ public function getIgnoredReleases()
108108
* Note: CURLINFO_HEADER_OUT exposes request headers (not response headers) for curl_getinfo
109109
* @return string|false $out The fetched content
110110
*/
111-
private function safe_http_get_contents(string $url, array $opts = [], array &$getinfo = NULL) {
111+
private function safe_http_get_contents(string $url, array $opts = [], ?array &$getinfo = NULL) {
112112
// Use system http_get_contents if it exists
113113
if (function_exists('http_get_contents')) {
114114
return http_get_contents($url, $opts, $getinfo);

0 commit comments

Comments
 (0)