From 9953d5c10c622b059758f359812502c26fd1c1c9 Mon Sep 17 00:00:00 2001
From: Aleksander Machniak <alec@alec.pl>
Date: Fri, 06 Nov 2015 02:33:32 -0500
Subject: [PATCH] Add workaround for https://bugs.php.net/bug.php?id=70757 (#1490582)

---
 program/lib/Roundcube/rcube.php |    7 ++++++-
 CHANGELOG                       |    1 +
 2 files changed, 7 insertions(+), 1 deletions(-)

diff --git a/CHANGELOG b/CHANGELOG
index 9c197e6..48ab5b3 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,6 +1,7 @@
 CHANGELOG Roundcube Webmail
 ===========================
 
+- Add workaround for https://bugs.php.net/bug.php?id=70757 (#1490582)
 - Fix duplicate messages in list and wrong count after delete (#1490572)
 - Fix so Installer requires PHP5
 - Make brute force attacks harder by re-generating security token on every failed login (#1490549)
diff --git a/program/lib/Roundcube/rcube.php b/program/lib/Roundcube/rcube.php
index 2335761..13356f2 100644
--- a/program/lib/Roundcube/rcube.php
+++ b/program/lib/Roundcube/rcube.php
@@ -524,8 +524,13 @@
         // use database for storing session data
         $this->session = new rcube_session($this->get_dbh(), $this->config);
 
+        $path = $_SERVER['SCRIPT_NAME'];
+        if (strpos($path, '://')) {
+            $path = parse_url($path, PHP_URL_PATH); // #1490582
+        }
+
         $this->session->register_gc_handler(array($this, 'gc'));
-        $this->session->set_secret($this->config->get('des_key') . dirname($_SERVER['SCRIPT_NAME']));
+        $this->session->set_secret($this->config->get('des_key') . dirname($path));
         $this->session->set_ip_check($this->config->get('ip_check'));
 
         if ($this->config->get('session_auth_name')) {

--
Gitblit v1.9.1