diff --git a/inc/auth/punbb.class.php b/inc/auth/punbb.class.php
index 9a380728a274f1eaff023241e240ba8219c371e9..71959910f7d024a16baee92bcbef43cc344ce202 100644
--- a/inc/auth/punbb.class.php
+++ b/inc/auth/punbb.class.php
@@ -9,6 +9,13 @@
  */
 
 if(!defined('PUN_ROOT')) define('PUN_ROOT', DOKU_INC.'../forum/');
+if(get_magic_quotes_gpc()){
+  nice_die('Sorry the punbb auth backend requires the PHP option
+  <a href="http://www.php.net/manual/en/ref.info.php#ini.magic-quotes-gpc">magic_quotes_gpc</a>
+  to be disabled for proper operation. Either setup your PHP install accordingly or
+  choose a different auth backend.');
+}
+
 require_once PUN_ROOT.'include/common.php';
 require_once DOKU_INC.'inc/auth/mysql.class.php';
 
diff --git a/inc/init.php b/inc/init.php
index 31ad8d37cca02e1016feedda0e2aa02e121d7935..fc7e5abec8e424b63ef32f515db4a7e6c19d0cc3 100644
--- a/inc/init.php
+++ b/inc/init.php
@@ -60,13 +60,14 @@
   }
 
   // kill magic quotes
-  if (get_magic_quotes_gpc()) {
+  if (get_magic_quotes_gpc() && !defined('MAGIC_QUOTES_STRIPPED')) {
     if (!empty($_GET))    remove_magic_quotes($_GET);
     if (!empty($_POST))   remove_magic_quotes($_POST);
     if (!empty($_COOKIE)) remove_magic_quotes($_COOKIE);
     if (!empty($_REQUEST)) remove_magic_quotes($_REQUEST);
     if (!empty($_SESSION)) remove_magic_quotes($_SESSION);
     @ini_set('magic_quotes_gpc', 0);
+    define('MAGIC_QUOTES_STRIPPED',1);
   }
   @set_magic_quotes_runtime(0);
   @ini_set('magic_quotes_sybase',0);