diff --git a/git-tools/hooks/prepare-commit-msg b/git-tools/hooks/prepare-commit-msg
new file mode 100755
index 0000000000..284354081e
--- /dev/null
+++ b/git-tools/hooks/prepare-commit-msg
@@ -0,0 +1,24 @@
+#!/bin/sh
+#
+# A hook to add [$branch] to the beginning of a commit message
+# if certain conditions are met.
+#
+# This is a prepare-commit-msg hook.
+#
+# To install this you can either copy or symlink it to
+# $GIT_DIR/hooks, example:
+#
+# ln -s ../../git-tools/hooks/prepare-commit-msg \\
+# .git/hooks/prepare-commit-msg
+#
+# Make sure it is executable.
+
+# strip off ref: refs/heads/
+branch="$(cat $GIT_DIR/HEAD | sed 's/ref: refs\/heads\///g')"
+
+# * only run when normal commit is made (without -m or -F;
+# not a merge, etc.)
+# * also make sure the branch name begins with bug/
+if [ "$2" = "" ] && [ $(echo "$branch" | grep -e '^bug/') ]; then
+ echo "[$branch] $(cat $1)" > "$1"
+fi
diff --git a/phpBB/docs/CHANGELOG.html b/phpBB/docs/CHANGELOG.html
index e54c4fd9bb..7b8d8f63f2 100644
--- a/phpBB/docs/CHANGELOG.html
+++ b/phpBB/docs/CHANGELOG.html
@@ -101,6 +101,8 @@
[Fix] Minor language fixes. (Bug #54855)
[Fix] Parsing urls in signatures properly uses config settings. (Bug #57105)
[Fix] Allow multibyte keys in request_var(). (Bug #51555)
+ [Fix] Prevent wrong tar archive type detection. (Bug #12531)
+ [Fix] Correct redirection after login to forum not in web root (Bug #58755)
[Feature] Support for Microsoft's Native SQL Server Driver for PHP (Bug #57055 - Patch by Chris Pucci at Microsoft)
diff --git a/phpBB/includes/functions_compress.php b/phpBB/includes/functions_compress.php
index f17c780a65..f422eaa8c1 100644
--- a/phpBB/includes/functions_compress.php
+++ b/phpBB/includes/functions_compress.php
@@ -502,8 +502,8 @@ class compress_tar extends compress
function compress_tar($mode, $file, $type = '')
{
$type = (!$type) ? $file : $type;
- $this->isgz = (strpos($type, '.tar.gz') !== false || strpos($type, '.tgz') !== false) ? true : false;
- $this->isbz = (strpos($type, '.tar.bz2') !== false) ? true : false;
+ $this->isgz = preg_match('#(\.tar\.gz|\.tgz)$#', $type);
+ $this->isbz = preg_match('#\.tar\.bz2$#', $type);
$this->mode = &$mode;
$this->file = &$file;
diff --git a/phpBB/includes/session.php b/phpBB/includes/session.php
index b3f9edb0cf..2e4e7ccd34 100644
--- a/phpBB/includes/session.php
+++ b/phpBB/includes/session.php
@@ -83,7 +83,7 @@ class session
$query_string = trim(implode('&', $use_args));
// basenamed page name (for example: index.php)
- $page_name = basename($script_name);
+ $page_name = (substr($script_name, -1, 1) == '/') ? '' : basename($script_name);
$page_name = urlencode(htmlspecialchars($page_name));
// current directory within the phpBB root (for example: adm)