src: fix deprecations on PHP 8.2

This commit is contained in:
Franco Fichtner 2023-07-19 11:04:33 +02:00
parent efefa10b18
commit 8eaa7adfe6
8 changed files with 27 additions and 27 deletions

View File

@ -125,7 +125,7 @@ function _set_networking_interfaces_ports($probe = false)
if (!empty($iflist)) {
echo <<<EOD
Do you want to configure LAGGs now? ${yes_no_prompt}
Do you want to configure LAGGs now? {$yes_no_prompt}
EOD;
if ($interactive) {
$key = chop(fgets($fp));
@ -149,7 +149,7 @@ EOD;
}
echo <<<EOD
Do you want to configure VLANs now? ${yes_no_prompt}
Do you want to configure VLANs now? {$yes_no_prompt}
EOD;
if ($interactive) {
$key = chop(fgets($fp));
@ -356,7 +356,7 @@ EOD;
echo <<<EOD
Do you want to proceed? ${yes_no_prompt}
Do you want to proceed? {$yes_no_prompt}
EOD;
if ($interactive) {
$key = chop(fgets($fp));
@ -520,7 +520,7 @@ function lagg_setup($iflist, $fp)
WARNING: all existing LAGGs will be cleared if you proceed!
Do you want to proceed? ${yes_no_prompt}
Do you want to proceed? {$yes_no_prompt}
EOD;
if (strcasecmp(chop(fgets($fp)), "y") != 0) {
@ -578,7 +578,7 @@ EOD;
}
if ($lagg['proto'] == "lacp") {
echo "Do you want to enable LACP fast timeout? ${yes_no_prompt}";
echo "Do you want to enable LACP fast timeout? {$yes_no_prompt}";
if (strcasecmp(chop(fgets($fp)), "y") == 0) {
$lagg['lacp_fast_timeout'] = true;
@ -608,7 +608,7 @@ function vlan_setup($iflist, $fp)
WARNING: all existing VLANs will be cleared if you proceed!
Do you want to proceed? ${yes_no_prompt}
Do you want to proceed? {$yes_no_prompt}
EOD;
if (strcasecmp(chop(fgets($fp)), "y") != 0) {

View File

@ -307,7 +307,7 @@ function _interfaces_bridge_configure($bridge)
}
foreach ($ifpriority as $key => $value) {
$realif = get_real_interface($key);
mwexec("/sbin/ifconfig ${bridgeif} ifpriority {$realif} " . escapeshellarg($value));
mwexec("/sbin/ifconfig {$bridgeif} ifpriority {$realif} " . escapeshellarg($value));
}
}
if (!empty($bridge['ifpathcost'])) {
@ -321,7 +321,7 @@ function _interfaces_bridge_configure($bridge)
}
foreach ($ifpathcost as $key => $value) {
$realif = get_real_interface($key);
mwexec("/sbin/ifconfig ${bridgeif} ifpathcost {$realif} " . escapeshellarg($value));
mwexec("/sbin/ifconfig {$bridgeif} ifpathcost {$realif} " . escapeshellarg($value));
}
}
}
@ -2797,13 +2797,13 @@ INFOREQ|REBIND|RENEW|REQUEST)
for NAMESERVER in \${new_domain_name_servers}; do
ARGS="\${ARGS} -a \${NAMESERVER}"
done
/usr/local/sbin/ifctl -i ${wanif} -6nd \${ARGS}
/usr/local/sbin/ifctl -i {$wanif} -6nd \${ARGS}
ARGS=
for DOMAIN in \${new_domain_name}; do
ARGS="\${ARGS} -a \${DOMAIN}"
done
/usr/local/sbin/ifctl -i ${wanif} -6sd \${ARGS}
/usr/local/sbin/ifctl -i {$wanif} -6sd \${ARGS}
ARGS=
for PD in \${PDINFO}; do
@ -2812,7 +2812,7 @@ INFOREQ|REBIND|RENEW|REQUEST)
if [ \${REASON} != "RENEW" -a \${REASON} != "REBIND" ]; then
# cannot update since PDINFO may be incomplete in these cases
# as each PD is being handled separately via the client side
/usr/local/sbin/ifctl -i ${wanif} -6pd \${ARGS}
/usr/local/sbin/ifctl -i {$wanif} -6pd \${ARGS}
fi
FORCE=
@ -2826,9 +2826,9 @@ INFOREQ|REBIND|RENEW|REQUEST)
EXIT|RELEASE)
/usr/bin/logger -t dhcp6c "dhcp6c_script: \$REASON on {$wanif} executing"
/usr/local/sbin/ifctl -i ${wanif} -6nd
/usr/local/sbin/ifctl -i ${wanif} -6sd
/usr/local/sbin/ifctl -i ${wanif} -6pd
/usr/local/sbin/ifctl -i {$wanif} -6nd
/usr/local/sbin/ifctl -i {$wanif} -6sd
/usr/local/sbin/ifctl -i {$wanif} -6pd
/usr/local/sbin/configctl -d interface newipv6 {$wanif}
;;

View File

@ -1193,7 +1193,7 @@ function ipsec_write_keypairs()
foreach ((new \OPNsense\IPsec\IPsec())->keyPairs->keyPair->iterateItems() as $uuid => $keyPair) {
foreach ($paths as $key => $path) {
if (!empty((string)$keyPair->$key)) {
$filename = "${path}/{$uuid}.pem";
$filename = "{$path}/{$uuid}.pem";
@touch($filename);
@chmod($filename, 0600);
file_put_contents($filename, (string)$keyPair->$key);

View File

@ -1216,7 +1216,7 @@ function openvpn_gen_route_ipv6($network, $iroute = false)
if (empty($prefix)) {
$prefix = "128";
}
return "{$i}route-ipv6 ${ipv6}/${prefix}";
return "{$i}route-ipv6 {$ipv6}/{$prefix}";
}
/**

View File

@ -565,7 +565,7 @@ function system_default_route($gateway, $interface, $far = false)
}
if ($family == 'inet') {
$dynamicgw = trim(@file_get_contents("/tmp/${realif}_router") ?? '');
$dynamicgw = trim(@file_get_contents("/tmp/{$realif}_router") ?? '');
if (!empty($dynamicgw) && $gateway === $dynamicgw) {
/* special case tries to turn on far gateway when required for dynamic gateway */
list (, $network) = interfaces_primary_address($interface);
@ -604,7 +604,7 @@ function system_routing_configure($verbose = false, $interface = null, $monitor
service_log(sprintf('Setting up route%s...', empty($interface) ? 's' : " {$interface}"), $verbose);
if (!empty($interface)) {
log_msg("ROUTING: entering configure using '${interface}'", LOG_DEBUG);
log_msg("ROUTING: entering configure using '{$interface}'", LOG_DEBUG);
} else {
log_msg("ROUTING: entering configure using defaults", LOG_DEBUG);
}
@ -1139,7 +1139,7 @@ function system_login_configure($verbose = false)
if (!empty($value)) {
$new_loader_conf .= "{$param}={$value}\n";
} else {
$new_loader_conf .= "#${param}\n";
$new_loader_conf .= "#{$param}\n";
}
}
$new_loader_conf .= "\n";
@ -1170,7 +1170,7 @@ function system_login_configure($verbose = false)
/* virtual terminals */
foreach (array('ttyv0', 'ttyv1', 'ttyv2', 'ttyv3', 'ttyv4', 'ttyv5', 'ttyv6', 'ttyv7') as $virtualport) {
if (strpos($tty, $virtualport) === 0) {
fwrite($fd, "{$virtualport}\t\"/usr/libexec/getty {$console_type}\"\t\txterm\t${on_off_secure_v}\n");
fwrite($fd, "{$virtualport}\t\"/usr/libexec/getty {$console_type}\"\t\txterm\t{$on_off_secure_v}\n");
continue 2;
}
}
@ -1190,7 +1190,7 @@ function system_login_configure($verbose = false)
}
if (file_exists('/dev/xc0')) {
fwrite($fd, "xc0\t\"/usr/libexec/getty {$console_type}\"\t\txterm\t${on_off_secure_v}\n");
fwrite($fd, "xc0\t\"/usr/libexec/getty {$console_type}\"\t\txterm\t{$on_off_secure_v}\n");
}
fclose($fd);

View File

@ -873,7 +873,7 @@ class FirmwareController extends ApiMutableModelControllerBase
/* package infos are flat lists with 3 pipes as delimiter */
foreach (array('remote', 'local') as $type) {
$current = $backend->configdRun("firmware ${type}");
$current = $backend->configdRun("firmware {$type}");
$current = explode("\n", trim($current ?? ''));
foreach ($current as $line) {

View File

@ -155,10 +155,10 @@ class Config extends Singleton
}
// copy attributes to xzy@attribute key item
foreach ($xmlNode->attributes() as $AttrKey => $AttrValue) {
if (!isset($result["${xmlNodeName}@attributes"])) {
$result["${xmlNodeName}@attributes"] = [];
if (!isset($result["{$xmlNodeName}@attributes"])) {
$result["{$xmlNodeName}@attributes"] = [];
}
$result["${xmlNodeName}@attributes"][$AttrKey] = (string)$AttrValue;
$result["{$xmlNodeName}@attributes"][$AttrKey] = (string)$AttrValue;
}
}
}

View File

@ -213,10 +213,10 @@ function filter_rule_item_alias_tooltip($alias_name)
{
$alias_descr = htmlspecialchars(get_alias_description($alias_name));
$alias_name = htmlspecialchars($alias_name);
$result = "<span title=\"${alias_descr}\" data-toggle=\"tooltip\" data-html=\"true\">";
$result = "<span title=\"{$alias_descr}\" data-toggle=\"tooltip\" data-html=\"true\">";
$result .= $alias_name . "&nbsp;";
$result .= "</span>";
$result .= "<a href=\"/ui/firewall/alias/index/${alias_name}\"";
$result .= "<a href=\"/ui/firewall/alias/index/{$alias_name}\"";
$result .= " title=\"". gettext("edit alias") ."\" data-toggle=\"tooltip\">";
$result .= "<i class=\"fa fa-list\"></i>";
$result .= "</a>";