mirror of
https://github.com/lkddi/Xboard.git
synced 2026-04-24 03:57:27 +08:00
fix: replace raw array access with data_get() to prevent Undefined array key
- Migrate $protocol_settings['key'] to data_get($protocol_settings, 'key') across General, SingBox, Shadowrocket, Surfboard, QuantumultX - Prevents PHP 8 Undefined array key fatal errors when optional protocol_settings fields are missing - Same class of bug that caused #735
This commit is contained in:
@@ -76,7 +76,7 @@ class Shadowrocket extends AbstractProtocol
|
||||
$str = str_replace(
|
||||
['+', '/', '='],
|
||||
['-', '_', ''],
|
||||
base64_encode("{$protocol_settings['cipher']}:{$password}")
|
||||
base64_encode(data_get($protocol_settings, 'cipher') . ":{$password}")
|
||||
);
|
||||
$addr = Helper::wrapIPv6($server['host']);
|
||||
|
||||
@@ -98,7 +98,7 @@ class Shadowrocket extends AbstractProtocol
|
||||
'remark' => $server['name'],
|
||||
'alterId' => 0
|
||||
];
|
||||
if ($protocol_settings['tls']) {
|
||||
if (data_get($protocol_settings, 'tls')) {
|
||||
$config['tls'] = 1;
|
||||
if (data_get($protocol_settings, 'tls_settings')) {
|
||||
if (!!data_get($protocol_settings, 'tls_settings.allow_insecure'))
|
||||
@@ -352,7 +352,7 @@ class Shadowrocket extends AbstractProtocol
|
||||
}
|
||||
$params['insecure'] = data_get($protocol_settings, 'tls.allow_insecure');
|
||||
if (isset($protocol_settings['hop_interval'])) {
|
||||
$params['keepalive'] = $protocol_settings['hop_interval'];
|
||||
$params['keepalive'] = data_get($protocol_settings, 'hop_interval');
|
||||
}
|
||||
if (isset($server['ports'])) {
|
||||
$params['mport'] = $server['ports'];
|
||||
|
||||
Reference in New Issue
Block a user