Updated Branches:
  refs/heads/develop 1b2d8801a -> f15e0cc61

LOG4PHP-207: Fix BC issue with host parameter.

Host paramter can be specified with or without mongo:// protocol prefix.
However it is prefered to specify it wouth the prefix.

Signed-off-by: Vladimir Gorej <[email protected]>
Signed-off-by: Ivan Habunek <[email protected]>


Project: http://git-wip-us.apache.org/repos/asf/logging-log4php/repo
Commit: http://git-wip-us.apache.org/repos/asf/logging-log4php/commit/f15e0cc6
Tree: http://git-wip-us.apache.org/repos/asf/logging-log4php/tree/f15e0cc6
Diff: http://git-wip-us.apache.org/repos/asf/logging-log4php/diff/f15e0cc6

Branch: refs/heads/develop
Commit: f15e0cc618a161d04cf594e77b763bd479369b0a
Parents: 1b2d880
Author: Vladimir Gorej <[email protected]>
Authored: Mon Mar 18 19:36:01 2013 +0100
Committer: Ivan Habunek <[email protected]>
Committed: Mon Mar 18 19:42:43 2013 +0100

----------------------------------------------------------------------
 src/main/php/appenders/LoggerAppenderMongoDB.php |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/logging-log4php/blob/f15e0cc6/src/main/php/appenders/LoggerAppenderMongoDB.php
----------------------------------------------------------------------
diff --git a/src/main/php/appenders/LoggerAppenderMongoDB.php 
b/src/main/php/appenders/LoggerAppenderMongoDB.php
index 8fb1db0..7486ded 100644
--- a/src/main/php/appenders/LoggerAppenderMongoDB.php
+++ b/src/main/php/appenders/LoggerAppenderMongoDB.php
@@ -264,7 +264,9 @@ class LoggerAppenderMongoDB extends LoggerAppender {
                        $clientClass = class_exists('MongoClient') ? 
'MongoClient' : 'Mongo';
                        # Connection string generation.
                        if ($this->connectionString === null) {
-                               $connectionString = sprintf('%s%s:%d', 
self::DEFAULT_MONGO_URL_PREFIX, $this->host, $this->port);
+                               $connectionString = sprintf('%s%s:%d', 
self::DEFAULT_MONGO_URL_PREFIX,
+                                                           
preg_replace('/^'.preg_quote(self::DEFAULT_MONGO_URL_PREFIX, '/').'/', '', 
$this->host),
+                                                           $this->port);
                        } else {
                                $connectionString = $this->connectionString;
                        }

Reply via email to