Skip to content

Commit

Permalink
Merge branch 'master' into support_multiget_addressdata_filter
Browse files Browse the repository at this point in the history
  • Loading branch information
mstilkerich committed Nov 21, 2020
2 parents 6c12a73 + b903eee commit b52596e
Show file tree
Hide file tree
Showing 7 changed files with 52 additions and 10 deletions.
17 changes: 14 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,26 @@ env:
- SABRE_MYSQLUSER="root"
- SABRE_MYSQLPASS=""
- SABRE_MYSQLDSN="mysql:host=127.0.0.1;dbname=sabredav_test"
- RUN_PHPCSFIXER="TRUE"
- RUN_PHPUNIT="TRUE"
- RUN_PHPSTAN="FALSE"
matrix:
- PREFER_LOWEST="" TEST_DEPS="" REPORT_COVERAGE="TRUE" WITH_COVERAGE="--coverage-clover=coverage.xml"
- PREFER_LOWEST="--prefer-lowest" TEST_DEPS="tests/Sabre/" REPORT_COVERAGE="FALSE" WITH_COVERAGE=""

matrix:
include:
- name: 'PHP8'
dist: bionic
php: nightly
env:
- RUN_PHPCSFIXER="FALSE"
- REPORT_COVERAGE="FALSE"
- name: 'PHPStan'
php: 7.4
env:
- RUN_PHPCSFIXER="FALSE"
- RUN_PHPUNIT="FALSE"
- RUN_PHPSTAN="TRUE"
- REPORT_COVERAGE="FALSE"
- name: 'Test with streaming propfind'
Expand All @@ -43,15 +53,16 @@ before_script:
- mysql -u root -h 127.0.0.1 -e 'create database sabredav_test'
- psql -c "create database sabredav_test" -U postgres
- psql -c "create user sabredav with PASSWORD 'sabredav';GRANT ALL PRIVILEGES ON DATABASE sabredav_test TO sabredav" -U postgres
- if [ $RUN_PHPCSFIXER == "FALSE" ]; then composer remove --no-update --dev friendsofphp/php-cs-fixer; fi
- composer update $PREFER_LOWEST

addons:
postgresql: "9.5"

script:
- if [ $RUN_PHPSTAN == "FALSE" ]; then php vendor/bin/php-cs-fixer fix --dry-run --diff; fi
- if [ $RUN_PHPSTAN == "FALSE" ]; then php vendor/bin/phpunit --configuration tests/phpunit.xml $WITH_COVERAGE $TEST_DEPS; fi
- if [ $RUN_PHPSTAN == "FALSE" ]; then rm -f ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/xdebug.ini; fi
- if [ $RUN_PHPCSFIXER == "TRUE" ]; then php vendor/bin/php-cs-fixer fix --dry-run --diff; fi
- if [ $RUN_PHPUNIT == "TRUE" ]; then php vendor/bin/phpunit --configuration tests/phpunit.xml $WITH_COVERAGE $TEST_DEPS; fi
- if [ $RUN_PHPUNIT == "TRUE" ]; then rm -f ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/xdebug.ini; fi
- if [ $RUN_PHPSTAN == "TRUE" ]; then composer phpstan; fi

after_success:
Expand Down
10 changes: 9 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
ChangeLog
=========

4.1.3 (2020-11-09)
-------------------------
* #1306: Return 409 when trying to PUT a file into a non-existent collection

4.1.2 (2020-10-04)
-------------------------
* #1296: Add experimental support for PHP 8.0

4.1.1 (2020-07-13)
-------------------------
* Fix PHPdoc of Tree:move method
Expand Down Expand Up @@ -246,7 +254,7 @@ ChangeLog
[sabre/uri 1.1.0][uri] and [sabre/xml 1.4.1][xml].


3.1.5 (????-??-??)
3.1.5 (2018-10-19)
------------------

* Fixed: Creating a new calendar on some MySQL configurations caused an error.
Expand Down
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
}
],
"require": {
"php": "^7.1.0",
"php": "^7.1.0 || ^8.0",
"sabre/vobject": "^4.2.1",
"sabre/event" : "^5.0",
"sabre/xml" : "^2.0.1",
Expand All @@ -33,7 +33,7 @@
"ext-json": "*"
},
"require-dev" : {
"friendsofphp/php-cs-fixer": "^2.16.3",
"friendsofphp/php-cs-fixer": "^2.16.7",
"phpstan/phpstan": "^0.12",
"phpunit/phpunit" : "^7.5 || ^8.5 || ^9.0",
"evert/phpdoc-md" : "~0.1.0",
Expand Down
2 changes: 1 addition & 1 deletion lib/CalDAV/Schedule/Plugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -609,7 +609,7 @@ public function getSupportedPrivilegeSet(INode $node, array &$supportedPrivilege
* @param bool $modified a marker to indicate that the original object
* modified by this process
*/
protected function processICalendarChange($oldObject = null, VCalendar $newObject, array $addresses, array $ignore = [], &$modified = false)
protected function processICalendarChange($oldObject, VCalendar $newObject, array $addresses, array $ignore = [], &$modified = false)
{
$broker = new ITip\Broker();
$messages = $broker->parseEvent($newObject, $addresses, $oldObject);
Expand Down
7 changes: 6 additions & 1 deletion lib/DAV/Server.php
Original file line number Diff line number Diff line change
Expand Up @@ -1075,7 +1075,12 @@ public function createFile($uri, $data, &$etag = null)
return false;
}

$parent = $this->tree->getNodeForPath($dir);
try {
$parent = $this->tree->getNodeForPath($dir);
} catch (Exception\NotFound $e) {
throw new Exception\Conflict('Files cannot be created in non-existent collections');
}

if (!$parent instanceof ICollection) {
throw new Exception\Conflict('Files can only be created as children of collections');
}
Expand Down
2 changes: 1 addition & 1 deletion lib/DAV/Version.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,5 @@ class Version
/**
* Full version number.
*/
public const VERSION = '4.1.1';
public const VERSION = '4.1.3';
}
20 changes: 19 additions & 1 deletion tests/Sabre/DAV/HttpPutTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ public function testPutExistingIfNoneMatchStar()
*
* @depends testPut
*/
public function testPutNoParent()
public function testPutParentIsNotCollection()
{
$request = new HTTP\Request(
'PUT',
Expand All @@ -254,6 +254,24 @@ public function testPutNoParent()
$this->assertEquals(409, $response->getStatus());
}

/**
* PUT thats created in a non-existent collection should be rejected.
*
* @depends testPut
*/
public function testPutParentCollectionDoesNotExist()
{
$request = new HTTP\Request(
'PUT',
'/non-existent-collection/file2',
[],
'hello'
);

$response = $this->request($request);
$this->assertEquals(409, $response->getStatus());
}

/**
* Finder may sometimes make a request, which gets its content-body
* stripped. We can't always prevent this from happening, but in some cases
Expand Down

0 comments on commit b52596e

Please sign in to comment.