Further fixes for PHP 8.1

I don't know why this only show up in the gitlab runners. I have PHP 8.1
locally.
This commit is contained in:
Andrew Ruthven 2022-02-13 01:04:47 +13:00
parent 1c77febeb1
commit 02af0c58ee
5 changed files with 14 additions and 7 deletions

View File

@ -561,8 +561,10 @@ EOSQL;
$params[':request_path'] = $this->path;
}
$qry = new AwlQuery( $sql, $params );
if ( $qry->Exec('caldav',__LINE__,__FILE__) && $permission_result = $qry->Fetch() )
$this->privileges |= bindec($permission_result->perm);
if ( $qry->Exec('caldav',__LINE__,__FILE__) && $permission_result = $qry->Fetch() ) {
$perm = $permission_result->perm;
if (isset($perm)) $this->privileges |= bindec($permission_result->perm);
}
dbg_error_log( 'caldav', 'Restricted permissions for user accessing someone elses hierarchy: %s', decbin($this->privileges) );
if ( isset($this->ticket) && $this->ticket->MatchesPath($this->path) ) {

View File

@ -474,7 +474,7 @@ EOSQL;
$this->collection->type = 'schedule-'. $matches[3]. 'box';
else
$this->collection->type = 'collection';
if ( strlen($row->external_url) > 8 ) {
if ( isset($row->external_url) && strlen($row->external_url) > 8 ) {
$this->_is_external = true;
if ( $row->external_type == 'calendar' )
$this->collection->type = 'calendar';

View File

@ -174,7 +174,8 @@ function process_ace( $grantor, $by_principal, $by_collection, $ace ) {
case 'DAV::authenticated':
$principal_type = 'authenticated';
if ( bindec($grantor->GetProperty('default_privileges')) == $privileges ) break; // There is no change, so skip it
$grant_default_privs = $grantor->GetProperty('default_privileges');
if ( isset($grant_default_privs) && bindec($grant_default_privs) == $privileges ) break; // There is no change, so skip it
$sqlparms = array( ':privileges' => $privileges );
if ( isset($by_collection) ) {
$sql = 'UPDATE collection SET default_privileges=:privileges::INT::BIT(24) WHERE collection_id=:by_collection';

View File

@ -210,7 +210,8 @@ function handle_schedule_request( $ical ) {
dbg_error_log( "PUT", "not delivering to owner" );
continue;
}
if ( $attendee->GetParameterValue ( 'PARTSTAT' ) != 'NEEDS-ACTION' || preg_match ( '/^[35]\.[3-9]/', $attendee->GetParameterValue ( 'SCHEDULE-STATUS' ) ) ) {
$schedule_status = $attendee->GetParameterValue ( 'SCHEDULE-STATUS' );
if ( $attendee->GetParameterValue ( 'PARTSTAT' ) != 'NEEDS-ACTION' || (isset($schedule_status) && preg_match ( '/^[35]\.[3-9]/', $schedule_status ) ) ) {
dbg_error_log( "PUT", "attendee %s does not need action", $attendee_email );
continue;
}
@ -1430,7 +1431,7 @@ function write_resource( DAVResource $resource, $caldav_data, DAVResource $colle
if (strcmp($dtstart, $olddtstart)) $modified = true;
$dtend = $first->GetPValue('DTEND');
$olddtend = $oldfirst->GetPValue('DTEND');
if (strcmp($dtend, $olddtend)) $modified = true;
if (isset($dtend) && isset($olddtend) && strcmp($dtend, $olddtend)) $modified = true;
$duration = $first->GetPValue('DURATION');
$oldduration = $oldfirst->GetPValue('DURATION');
$organizer = $vcal->GetOrganizer();
@ -1468,7 +1469,7 @@ function write_resource( DAVResource $resource, $caldav_data, DAVResource $colle
$calitem_params[':due'] = $due;
$dtstart = $first->GetPValue('DTSTART');
if ( empty($dtstart) ) $dtstart = $due;
if (preg_match("/^1[0-8][0-9][0-9][01][0-9][0-3][0-9]$/", $dtstart))
if (isset($dtstart) && preg_match("/^1[0-8][0-9][0-9][01][0-9][0-3][0-9]$/", $dtstart))
$dtstart = $dtstart . "T000000Z";
$calitem_params[':dtstart'] = $dtstart;

View File

@ -171,6 +171,9 @@ OR (first_instance_start IS NOT NULL AND ($new_cond))
$search = $v->GetContent();
$negate = $v->GetAttribute("negate-condition");
$collation = $v->GetAttribute("collation");
if (! isset($collation)) {
$collation = '';
}
switch( strtolower($collation) ) {
case 'i;octet':
$comparison = 'LIKE';