@karlitschek 
Using $_SESSION will not work in master - you need to use \OC::$session