Use / instead of an empty string as cookie path
Use / instead of an empty string as cookie path

When an empty string is used as cookie path PHP will assign the current directory as cookie path.

This means when an user had installed an ownCloud under "/", which is mapped to an empty string in \OC::$WEBROOT, and accessed it the cookie was set to values such as "/index.php/apps/files" since the web browser assumed this to be a directory. This means that multiple encryption cookies were set for the same domain resulting in potential havoc.

With this patch the path will be set to "/" in case an empty web root is installed which makes the cookie accessible to the whole domain.

To test this setup multiple ownCloud instances on the same domain under different ports and have both installed under "/", then try to login in both of it and previously this can in some cases lead to a lockout of the user.

Note that this affects the cookies that the browsers do sent and thus to test this you need to clear all cookies from your browser previously. I consider this an acceptable behaviour for now since this code is only in master.

Fixes https://github.com/owncloud/core/issues/18919

nextcloud/server,bluelml/core,pmattern/server,pollopolea/core,pmattern/server,IljaN/core,sharidas/core,andreas-p/nextcloud-server,whitekiba/server,pollopolea/core,pixelipo/server,andreas-p/nextcloud-server,jbicha/server,sharidas/core,cernbox/core,Ardinis/server,bluelml/core,whitekiba/server,owncloud/core,Ardinis/server,Ardinis/server,andreas-p/nextcloud-server,cernbox/core,whitekiba/server,xx621998xx/server,lrytz/core,jbicha/server,cernbox/core,nextcloud/server,michaelletzgus/nextcloud-server,IljaN/core,xx621998xx/server,bluelml/core,owncloud/core,Ardinis/server,lrytz/core,cernbox/core,jbicha/server,pmattern/server,pixelipo/server,pollopolea/core,IljaN/core,michaelletzgus/nextcloud-server,xx621998xx/server,nextcloud/server,endsguy/server,pollopolea/core,pixelipo/server,pmattern/server,pollopolea/core,michaelletzgus/nextcloud-server,Ardinis/server,andreas-p/nextcloud-server,jbicha/server,endsguy/server,owncloud/core,whitekiba/server,whitekiba/server,jbicha/server,michaelletzgus/nextcloud-server,IljaN/core,phil-davis/core,sharidas/core,xx621998xx/server,owncloud/core,pmattern/server,lrytz/core,andreas-p/nextcloud-server,endsguy/server,nextcloud/server,cernbox/core,lrytz/core,pixelipo/server,lrytz/core,endsguy/server,sharidas/core,pixelipo/server,endsguy/server,xx621998xx/server,IljaN/core,owncloud/core,bluelml/core,bluelml/core,sharidas/core