mirror of
https://gitlab.com/davical-project/davical.git
synced 2026-08-29 18:26:05 +00:00
Ensure we have an array, and there is a value.
Resolves this warning in PHP 8.2: Warning: Undefined array key 0 in /usr/share/davical/inc/iSchedule.php on line 218 Warning: Trying to access array offset on null in /usr/share/davical/inc/iSchedule.php on line 218
This commit is contained in:
parent
cb2e4523f3
commit
62441f7705
@ -209,26 +209,22 @@ class iSchedule
|
||||
$len = 3; // some country code tlds should have 3 components
|
||||
if ( $this->domain == 'mycaldav' || $this->domain == 'altcaldav' )
|
||||
$len = 1;
|
||||
|
||||
while ( count ( $parts ) >= $len )
|
||||
{
|
||||
$r = dns_get_record ( '_ischedules._tcp.' . implode ( '.', $parts ) , DNS_SRV );
|
||||
if ($r == false)
|
||||
$r = Array();
|
||||
|
||||
{
|
||||
if (is_array($r) && count($r) > 0) {
|
||||
$remote_server = $r [ 0 ] [ 'target' ];
|
||||
$remote_port = $r [ 0 ] [ 'port' ];
|
||||
$this->remote_ssl = true;
|
||||
break;
|
||||
}
|
||||
if ( ! isset ( $remote_server ) )
|
||||
{
|
||||
$r = dns_get_record ( '_ischedule._tcp.' . implode ( '.', $parts ) , DNS_SRV );
|
||||
if ($r == false)
|
||||
$r = Array();
|
||||
|
||||
if ( 0 < count ( $r ) )
|
||||
{
|
||||
if ( ! isset ( $remote_server ) ) {
|
||||
$r = dns_get_record ( '_ischedule._tcp.' . implode ( '.', $parts ) , DNS_SRV );
|
||||
|
||||
if (is_array($r) && count($r) > 0) {
|
||||
$remote_server = $r [ 0 ] [ 'target' ];
|
||||
$remote_port = $r [ 0 ] [ 'port' ];
|
||||
break;
|
||||
@ -236,6 +232,7 @@ class iSchedule
|
||||
}
|
||||
array_shift ( $parts );
|
||||
}
|
||||
|
||||
if ( ! isset ( $remote_server ) )
|
||||
{
|
||||
if ( $this->try_anyway == true )
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user