From 9f754494e74396469ff6ceb34ece25b088756ffa Mon Sep 17 00:00:00 2001
From: Aleksander Machniak <alec@alec.pl>
Date: Fri, 23 Aug 2013 13:06:15 -0400
Subject: [PATCH] Fix unquoted path in PREG expression on Windows (#1489290)

---
 CHANGELOG                           |    1 +
 program/lib/Roundcube/bootstrap.php |   11 +++++++----
 2 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/CHANGELOG b/CHANGELOG
index 44afccd..1d1149d 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,6 +1,7 @@
 CHANGELOG Roundcube Webmail
 ===========================
 
+- Fix unquoted path in PREG expression on Windows (#1489290)
 - Fix replacement variables in user-specific base_dn in some LDAP requests (#1489279)
 - Fix image scaling issues when image has only one dimension smaller than the limit (#1489274)
 - Fix issue where uploaded photo was lost when contact form did not validate (#1489274)
diff --git a/program/lib/Roundcube/bootstrap.php b/program/lib/Roundcube/bootstrap.php
index 3f4d2c3..5d5a223 100644
--- a/program/lib/Roundcube/bootstrap.php
+++ b/program/lib/Roundcube/bootstrap.php
@@ -84,10 +84,13 @@
 }
 
 // make sure the Roundcube lib directory is in the include_path
-$rcube_include_path = realpath(RCUBE_LIB_DIR . '..');
-$sep = PATH_SEPARATOR;
-if (!preg_match("!(^|$sep)$rcube_include_path($sep|\$)!", ini_get('include_path'))) {
-    set_include_path(ini_get('include_path') . PATH_SEPARATOR . $rcube_include_path);
+$rcube_path = realpath(RCUBE_LIB_DIR . '..');
+$sep        = PATH_SEPARATOR;
+$regexp     = "!(^|$sep)" . preg_quote($rcube_path, '!') . "($sep|\$)!";
+$path       = ini_get('include_path');
+
+if (!preg_match($regexp, $path)) {
+    set_include_path($path . PATH_SEPARATOR . $rcube_path);
 }
 
 // Register autoloader

--
Gitblit v1.9.1