--TEST-- Automatic webroot detection --FILE-- '/horde/webroot.php'); var_dump(_detect_webroot()); $_SERVER = array('SCRIPT_URL' => '/horde/webroot.php'); var_dump(_detect_webroot()); $_SERVER = array('PHP_SELF' => '/horde/webroot.php'); var_dump(_detect_webroot()); $FILE = '/var/www/horde3/config/registry.php'; $_SERVER = array('SCRIPT_NAME' => '/webroot.php', 'PHP_SELF' => '/webroot.php'); var_dump(_detect_webroot()); $FILE = '/var/www/horde/config/registry.php'; var_dump(_detect_webroot()); $FILE = '/Users/foo/Sites/hordehead/config/registry.php'; $_SERVER = array('SCRIPT_URL' => '/~foo/hordehead/webroot.php', 'SCRIPT_NAME' => '/~foo/hordehead/webroot.php', 'PHP_SELF' => '/~foo/hordehead/webroot.php'); var_dump(_detect_webroot()); $FILE = '/var/www/html/config/registry.php'; $_SERVER = array('SCRIPT_URL' => '/webroot.php', 'SCRIPT_NAME' => '/webroot.php', 'PHP_SELF' => '/webroot.php'); var_dump(_detect_webroot()); // Windows tests $DIRECTORY_SEPARATOR = '\\'; $FILE = 'c:\inetpub\wwwroot\horde\config\registry.php'; $_SERVER = array('SCRIPT_NAME' => '/horde/webroot.php', 'PHP_SELF' => '/horde/webroot.php'); var_dump(_detect_webroot()); $FILE = 'C:\Inetpub\vhosts\example.com\subdomain\webmail\config\registry.php'; $_SERVER = array('SCRIPT_NAME' => '/webroot.php', 'PHP_SELF' => '/webroot.php'); var_dump(_detect_webroot()); ?> --EXPECT-- string(6) "/horde" string(6) "/horde" string(6) "/horde" string(0) "" string(0) "" string(15) "/~foo/hordehead" string(0) "" string(6) "/horde" string(0) ""