sabre-io/http

Uncaught Error: Class 'Sabre\HTTP\URLUtil' not found

Offerel opened this issue · 9 comments

If using release 5.0.0 with sabre/uri 2.1.0 and sabre/event 5.0.3 i get the following error " Uncaught Error: Class 'Sabre\HTTP\URLUtil' not found".

did you clone the repo or use composer? Please list instructions and maybe a code snippet.

I'm damn sure this is a local issue on your installation.

I used sabreDAV 3.2.2 from the release.tar.gz of GitHub. Then I loaded the latest release.tar.gz of sabre/uri and sabre/event from GitHub and overwrote the directories of sabreDAV 3.2.2. Up to and including sabre/http 4.2.4 this also worked.

I can't install composer on my Rasperry Pi. If I use the package from the Raspbian repository, the version seems to be out of date. So at least corresponding error messages. Attempts to build Composer from source don't work either, here the felt billions of dependencies are not fulfilled and I should install additional programs, but I don't want to do that at all.

the directory of /var/www/sabredav_3.22/vendor/sabre looks like this:

drwxrwxr-x 5 www-data www-data 4096 Feb 15  2017 dav
lrwxrwxrwx 1 www-data www-data   55 Aug  7 07:49 event -> /var/www/sabredav_3.22/vendor/sabre/event-5.0.3
drwxrwxr-x 6 www-data www-data 4096 Feb 15  2017 event-3.0.0
drwxr-xr-x 6 www-data www-data 4096 Jun 10  2017 event-5.0.2
drwxrwxr-x 4 www-data www-data 4096 Mär  5 14:55 event-5.0.3
lrwxrwxrwx 1 www-data www-data   54 Aug  7 07:50 http -> /var/www/sabredav_3.22/vendor/sabre/http-4.2.4
drwxrwxr-x 6 www-data www-data 4096 Feb 15  2017 http-4.2.2
drwxr-xr-x 6 www-data www-data 4096 Jun 12  2017 http-4.2.3
drwxrwxr-x 6 www-data www-data 4096 Feb 23 12:10 http-4.2.4
drwxrwxr-x 6 www-data www-data 4096 Jun  4 23:27 http-5.0.0
lrwxrwxrwx 1 www-data www-data   53 Aug  7 07:48 uri -> /var/www/sabredav_3.22/vendor/sabre/uri-2.1.1
drwxrwxr-x 4 www-data www-data 4096 Feb 15  2017 uri-1.2.0
drwxr-xr-x 4 www-data www-data 4096 Dez  7  2016 uri-2.1.0
drwxrwxr-x 4 www-data www-data 4096 Feb 20  2017 uri-2.1.1
lrwxrwxrwx 1 www-data www-data   49 Aug  7 07:22 vobject -> /var/www/sabredav_3.22/vendor/sabre/vobject-4.1.6
drwxrwxr-x 6 www-data www-data 4096 Feb 15  2017 vobject-4.1.2
drwxr-xr-x 6 www-data www-data 4096 Okt 18  2017 vobject-4.1.3
drwxrwxr-x 6 www-data www-data 4096 Apr 20 09:22 vobject-4.1.6
lrwxrwxrwx 1 www-data www-data   53 Aug  7 07:22 xml -> /var/www/sabredav_3.22/vendor/sabre/xml-2.1.0
drwxrwxr-x 5 www-data www-data 4096 Feb 15  2017 xml-1.5.0
drwxr-xr-x 5 www-data www-data 4096 Nov 16  2016 xml-2.0.0
drwxrwxr-x 5 www-data www-data 4096 Feb  8 12:00 xml-2.1.0

as you can see, I use symlinks, so that i can always switch to a older version of the library's. for testing, i use the standard dav/examples/groupwareserver.php file. The only change i made there, is to change database to MySQL and the $baseUri value to fit my needs. If I have use the symlink to http-4.2.4, it works as expected. I can use my existing data in the database. But if i change the symlink to http-5.0.0 i get the above error.

Here is my groupwareserver.php file with the changes i made. i have removed the comments to keep the file smaller:

$baseUri = '/sabre/groupwareserver.php';

date_default_timezone_set('Europe/Berlin');

$pdo = new PDO('mysql:dbname='.$db_name.';host='.$db_host, $db_user, $db_password);
$pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);


function exception_error_handler($errno, $errstr, $errfile, $errline) {
    throw new ErrorException($errstr, 0, $errno, $errfile, $errline);
}
set_error_handler("exception_error_handler");

require_once '../vendor/autoload.php';

$authBackend = new \Sabre\DAV\Auth\Backend\Apache();
$principalBackend = new \Sabre\DAVACL\PrincipalBackend\PDO($pdo);
$carddavBackend = new \Sabre\CardDAV\Backend\PDO($pdo);
$caldavBackend = new \Sabre\CalDAV\Backend\PDO($pdo);

$nodes = [
    new \Sabre\CalDAV\Principal\Collection($principalBackend),
    new \Sabre\CalDAV\CalendarRoot($principalBackend, $caldavBackend),
    new \Sabre\CardDAV\AddressBookRoot($principalBackend, $carddavBackend),
];

$server = new \Sabre\DAV\Server($nodes);
if (isset($baseUri)) $server->setBaseUri($baseUri);

$server->addPlugin(new \Sabre\DAV\Auth\Plugin($authBackend));
$server->addPlugin(new \Sabre\DAV\Browser\Plugin());
$server->addPlugin(new \Sabre\DAV\Sync\Plugin());
$server->addPlugin(new \Sabre\DAV\Sharing\Plugin());
$server->addPlugin(new \Sabre\DAVACL\Plugin());
$server->addPlugin(new \Sabre\CalDAV\Plugin());
$server->addPlugin(new \Sabre\CalDAV\Schedule\Plugin());
$server->addPlugin(new \Sabre\CalDAV\SharingPlugin());
$server->addPlugin(new \Sabre\CalDAV\ICSExportPlugin());
$server->addPlugin(new \Sabre\CardDAV\Plugin());
$server->addPlugin(new \Sabre\CardDAV\VCFExportPlugin());
$server->exec();

Why can't you use composer? Just download the composer.phar from the Website: getcomposer.org

I have downloaded composer.phar to /tmp and called it now with "sudo -u www-data php /tmp/composer.phar install" in the directory where i have unpacked sabre/http. It starts to install things, where i dont know what they are for. For example:

  - Installing symfony/stopwatch (v3.4.14): Downloading (100%)
  - Installing symfony/process (v3.4.14): Downloading (100%)
  - Installing symfony/finder (v3.4.14): Downloading (100%)
  - Installing symfony/polyfill-ctype (v1.9.0): Downloading (100%)
  - Installing symfony/filesystem (v3.4.14): Downloading (100%)
  - Installing symfony/event-dispatcher (v3.4.14): Downloading (100%)
  - Installing psr/log (1.0.2): Downloading (100%)
  - Installing symfony/debug (v3.4.14): Downloading (100%)
  - Installing symfony/polyfill-mbstring (v1.9.0): Downloading (100%)
  - Installing symfony/console (v3.4.14): Downloading (100%)
  - Installing sebastian/diff (1.4.3): Downloading (100%)
  - Installing friendsofphp/php-cs-fixer (v1.11.8): Downloading (100%)

I have killed this process now, since I really don't want any unknown things on my server. Is there no other way to install sabre/http as this composer thing? I didn't want to use this.

you are installing development dependencies - use --no-dev option - see https://getcomposer.org/doc/03-cli.md#install-i

Ok, many thx for that info. I will try this next. In the meantime, i have cloned sabre/http 4.2.4 and overwritten the directory with the files in 5.0.0. This seems to work also, but i try your switch to.

Is there a way to check, which version of the components like sabre/http, sabre/event, etc. is actual used by sabre/dav? Maybe some http request or command line parameter or anything else?

Is there a way to check, which version of the components like sabre/http, sabre/event, etc. is actual used by sabre/dav? Maybe some http request or command line parameter or anything else?

this is exactly the job of composer. composer is a dependency manager and pulls in compatible versions of depending libraries.

I'm closing this for now. Enjoy!

evert commented

@Offerel you don't need to actually install all packages individually, you can just install the sabre/dav package. the Composer command will automatically install its depdendencies. Just read composer.json to see which versions it needs.

Many thx for the helping hand. i should really check composer and it's parameters for the future work.