mirror of
https://gitlab.com/davical-project/davical.git
synced 2026-03-13 08:00:15 +00:00
Improve on SQL syntax fix to keep logging working, and add regression test.
Closes #279.
This commit is contained in:
parent
6e6ff6b115
commit
be60ec1778
@ -86,13 +86,16 @@ function SqlFilterFragment( $filter, $components, $property = null, $parameter =
|
||||
dbg_error_log("calquery", "Processing $tag into SQL - %d, '%s', %d\n", count($components), $property, isset($parameter) );
|
||||
|
||||
$not_defined = "";
|
||||
$not_defined_log = "";
|
||||
switch( $tag ) {
|
||||
case 'urn:ietf:params:xml:ns:caldav:is-not-defined':
|
||||
$not_defined = "not"; // then fall through to IS-DEFINED case
|
||||
$not_defined = "not "; // for SQL
|
||||
$not_defined_log = "not-"; // for logging
|
||||
// then fall through to IS-DEFINED case
|
||||
case 'urn:ietf:params:xml:ns:caldav:is-defined':
|
||||
if ( isset( $parameter ) ) {
|
||||
$need_post_filter = true;
|
||||
dbg_error_log("calquery", "Could not handle 'is-%sdefined' on property %s, parameter %s in SQL", $not_defined, $property, $parameter );
|
||||
dbg_error_log("calquery", "Could not handle 'is-%sdefined' on property %s, parameter %s in SQL", $not_defined_log, $property, $parameter );
|
||||
return false; // Not handled in SQL
|
||||
}
|
||||
if ( isset( $property ) ) {
|
||||
@ -114,7 +117,7 @@ function SqlFilterFragment( $filter, $components, $property = null, $parameter =
|
||||
default:
|
||||
$property_defined_match = "LIKE '_%'"; // i.e. contains a single character or more
|
||||
}
|
||||
$sql .= sprintf( "AND %s %s %s ", $property, $not_defined, $property_defined_match );
|
||||
$sql .= sprintf( "AND %s %s%s ", $property, $not_defined, $property_defined_match );
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
@ -0,0 +1,10 @@
|
||||
HTTP/1.1 207 Multi-Status
|
||||
Date: Dow, 01 Jan 2000 00:00:00 GMT
|
||||
DAV: 1, 2, 3, access-control, calendar-access, calendar-schedule
|
||||
DAV: extended-mkcol, bind, addressbook, calendar-auto-schedule, calendar-proxy
|
||||
ETag: "07474790757c5e1b526ce4901889d6d3"
|
||||
Content-Length: 68
|
||||
Content-Type: text/xml; charset="utf-8"
|
||||
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<multistatus xmlns="DAV:"/>
|
||||
37
testing/tests/regression-suite/0966-REPORT-not-defined.test
Normal file
37
testing/tests/regression-suite/0966-REPORT-not-defined.test
Normal file
@ -0,0 +1,37 @@
|
||||
#
|
||||
# not-defined REPORT
|
||||
#
|
||||
# Regression test for https://gitlab.com/davical-project/davical/-/issues/279
|
||||
#
|
||||
# Returns nothing, but at least we don't get a fatal error now.
|
||||
# XXX: Changed to be a test that returns records
|
||||
#
|
||||
TYPE=REPORT
|
||||
URL=http://regression.host/caldav.php/user1/home/
|
||||
HEADER=Content-Type: text/xml; charset="UTF-8"
|
||||
HEADER=Depth: 0
|
||||
HEAD
|
||||
|
||||
|
||||
BEGINDATA
|
||||
<?xml version='1.0' encoding='utf-8'?>
|
||||
<C:calendar-query xmlns:D="DAV:" xmlns:C="urn:ietf:params:xml:ns:caldav">
|
||||
<D:prop>
|
||||
<C:calendar-data/>
|
||||
</D:prop>
|
||||
<C:filter>
|
||||
<C:comp-filter name="VCALENDAR">
|
||||
<C:comp-filter name="VTODO">
|
||||
<C:prop-filter name="COMPLETED">
|
||||
<C:is-not-defined/>
|
||||
</C:prop-filter>
|
||||
<C:prop-filter name="STATUS">
|
||||
<C:is-not-defined/>
|
||||
</C:prop-filter>
|
||||
</C:comp-filter>
|
||||
</C:comp-filter>
|
||||
</C:filter>
|
||||
</C:calendar-query>
|
||||
ENDDATA
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user