diff --git a/_test/tests/inc/auth_nameencode.test.php b/_test/tests/inc/auth_nameencode.test.php
index da9f31f9037f342fee1d3bc26547dfed3c244e16..074155486850da2dc0d4fa6c6e9105c28121365d 100644
--- a/_test/tests/inc/auth_nameencode.test.php
+++ b/_test/tests/inc/auth_nameencode.test.php
@@ -19,6 +19,18 @@ class auth_nameencode_test extends DokuWikiTest {
         $this->assertEquals(auth_nameencode($in),$out);
     }
 
+    function test_apostrophe(){
+        $in  = 'hey\'you';
+        $out = 'hey%27you';
+        $this->assertEquals(auth_nameencode($in),$out);
+    }
+
+    function test_backslash(){
+        $in  = 'hey\\you';
+        $out = 'hey%5cyou';
+        $this->assertEquals(auth_nameencode($in),$out);
+    }
+
     function test_complex(){
         $in  = 'hey $ you !$%! foo ';
         $out = 'hey%20%24%20you%20%21%24%25%21%20foo%20';
diff --git a/_test/tests/inc/mailer.test.php b/_test/tests/inc/mailer.test.php
index 3a89413b4ff49ea929f5af732669c8c0d6a3d2f2..bac0c39ba0bdf497383445cf23b73ba62e63c336 100644
--- a/_test/tests/inc/mailer.test.php
+++ b/_test/tests/inc/mailer.test.php
@@ -50,8 +50,8 @@ class mailer_test extends DokuWikiTest {
         // set a bunch of test headers
         $mail->setHeader('test-header','bla');
         $mail->setHeader('to','A valid ASCII name <test@example.com>');
-        $mail->setHeader('from',"Thös ne\needs\x00serious cleaning$§%.");
-        $mail->setHeader('bad',"Thös ne\needs\x00serious cleaning$§%.",false);
+        $mail->setHeader('from',"Thös ne\needs\x00serious cleaning\$§%.");
+        $mail->setHeader('bad',"Thös ne\needs\x00serious cleaning\$§%.",false);
         $mail->setHeader("weird\n*+\x00foo.-_@bar?",'now clean');
 
         // are they set?
@@ -63,7 +63,7 @@ class mailer_test extends DokuWikiTest {
         $this->assertArrayHasKey('From',$headers);
         $this->assertEquals('Ths neeedsserious cleaning.',$headers['From']);
         $this->assertArrayHasKey('Bad',$headers);
-        $this->assertEquals("Thös ne\needs\x00serious cleaning$§%.",$headers['Bad']);
+        $this->assertEquals("Thös ne\needs\x00serious cleaning\$§%.",$headers['Bad']);
         $this->assertArrayHasKey('Weird+foo.-_@bar',$headers);
 
         // unset a header again
diff --git a/_test/tests/inc/parserutils_set_metadata_during_rendering.test.php b/_test/tests/inc/parserutils_set_metadata_during_rendering.test.php
index f08785ca25c645dc114e70e6987e9f012d2087ba..18660553d577f99d60afbcdeaf6ff849bcf2c4db 100644
--- a/_test/tests/inc/parserutils_set_metadata_during_rendering.test.php
+++ b/_test/tests/inc/parserutils_set_metadata_during_rendering.test.php
@@ -80,7 +80,7 @@ class parserutils_set_metadata_during_rendering_test extends DokuWikiTest {
     }
 
     // wrapper function for the fake plugin controller, return $this for the fake syntax of this test
-    function &load($type,$name,$new=false,$disabled=false){
+    function load($type,$name,$new=false,$disabled=false){
         if ($name == 'parserutils_test') {
             return $this;
         } else {
diff --git a/_test/tests/inc/subscription.test.php b/_test/tests/inc/subscription.test.php
index 333400576ed49f074da1623b36bac7cfa5b566a5..34a7b9e4bc581136bbaa3a6e7bb2d68b7f73605a 100644
--- a/_test/tests/inc/subscription.test.php
+++ b/_test/tests/inc/subscription.test.php
@@ -237,7 +237,7 @@ class MockupSubscription extends Subscription {
         return parent::buildregex($user, $style, $data);
     }
 
-    protected function send($subscriber_mail, $subject, $id, $template, $trep, $hrep = null) {
+    protected function send($subscriber_mail, $subject, $id, $template, $trep, $hrep = null, $headers = array()) {
         $this->mails[] = $subscriber_mail;
         return true;
     }
diff --git a/inc/JpegMeta.php b/inc/JpegMeta.php
index ba6a2b5bb2176696215cfb58e213f03d57c889e8..947407a48b92be4c2930f03b6cc0c96091928321 100644
--- a/inc/JpegMeta.php
+++ b/inc/JpegMeta.php
@@ -975,7 +975,7 @@ class JpegMeta {
 
             if ($capture) {
                 if ($length)
-                    $this->_markers[$count]['data'] =& fread($this->_fp, $length);
+                    $this->_markers[$count]['data'] = fread($this->_fp, $length);
                 else
                     $this->_markers[$count]['data'] = "";
             }
diff --git a/inc/actions.php b/inc/actions.php
index bf124c88709ce81857b04c357988fa9c6ca09cb8..5a59d852d730d8bd63f7ef2ebdd473c766016048 100644
--- a/inc/actions.php
+++ b/inc/actions.php
@@ -164,7 +164,8 @@ function act_dispatch(){
                 $pluginlist = plugin_list('admin');
                 if (in_array($page, $pluginlist)) {
                     // attempt to load the plugin
-                    if ($plugin =& plugin_load('admin',$page) !== null){
+
+                    if (($plugin = plugin_load('admin',$page)) !== null){
                         /** @var DokuWiki_Admin_Plugin $plugin */
                         if($plugin->forAdminOnly() && !$INFO['isadmin']){
                             // a manager tried to load a plugin that's for admins only
diff --git a/inc/auth.php b/inc/auth.php
index 36fc7d0865e38ebbeb84dfa6c935449c59f8ca21..0d42c86737d79a4e87868906737d3f80881e067d 100644
--- a/inc/auth.php
+++ b/inc/auth.php
@@ -139,10 +139,10 @@ function auth_loadACL() {
     $out = array();
     foreach($acl as $line) {
         $line = trim($line);
-        if($line{0} == '#') continue;
+        if(empty($line) || ($line{0} == '#')) continue; // skip blank lines & comments
         list($id,$rest) = preg_split('/\s+/',$line,2);
 
-        // substitue user wildcard first (its 1:1)
+        // substitute user wildcard first (its 1:1)
         if(strstr($line, '%USER%')){
             // if user is not logged in, this ACL line is meaningless - skip it
             if (!isset($_SERVER['REMOTE_USER'])) continue;
@@ -808,14 +808,14 @@ function auth_nameencode($name, $skip_group = false) {
 
     if(!isset($cache[$name][$skip_group])) {
         if($skip_group && $name{0} == '@') {
-            $cache[$name][$skip_group] = '@'.preg_replace(
-                '/([\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f])/e',
-                "'%'.dechex(ord(substr('\\1',-1)))", substr($name, 1)
+            $cache[$name][$skip_group] = '@'.preg_replace_callback(
+                '/([\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f])/',
+                'auth_nameencode_callback', substr($name, 1)
             );
         } else {
-            $cache[$name][$skip_group] = preg_replace(
-                '/([\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f])/e',
-                "'%'.dechex(ord(substr('\\1',-1)))", $name
+            $cache[$name][$skip_group] = preg_replace_callback(
+                '/([\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f])/',
+                'auth_nameencode_callback', $name
             );
         }
     }
@@ -823,6 +823,10 @@ function auth_nameencode($name, $skip_group = false) {
     return $cache[$name][$skip_group];
 }
 
+function auth_nameencode_callback($matches) {
+    return '%'.dechex(ord(substr($matches[1],-1)));
+}
+
 /**
  * Create a pronouncable password
  *
diff --git a/inc/common.php b/inc/common.php
index 866e0aaddf396c7c12b83748e62733eaf1bbf186..32771285b20bdf2acdc7a53ad257e8c115b4bf69 100644
--- a/inc/common.php
+++ b/inc/common.php
@@ -64,7 +64,7 @@ function getSecurityToken() {
  */
 function checkSecurityToken($token = null) {
     global $INPUT;
-    if(!$_SERVER['REMOTE_USER']) return true; // no logged in user, no need for a check
+    if(empty($_SERVER['REMOTE_USER'])) return true; // no logged in user, no need for a check
 
     if(is_null($token)) $token = $INPUT->str('sectok');
     if(getSecurityToken() != $token) {
@@ -474,13 +474,13 @@ function ml($id = '', $more = '', $direct = true, $sep = '&amp;', $abs = false)
 
     if(is_array($more)) {
         // add token for resized images
-        if($more['w'] || $more['h'] || $isexternalimage){
+        if(!empty($more['w']) || !empty($more['h']) || $isexternalimage){
             $more['tok'] = media_get_token($id,$more['w'],$more['h']);
         }
         // strip defaults for shorter URLs
         if(isset($more['cache']) && $more['cache'] == 'cache') unset($more['cache']);
-        if(!$more['w']) unset($more['w']);
-        if(!$more['h']) unset($more['h']);
+        if(empty($more['w'])) unset($more['w']);
+        if(empty($more['h'])) unset($more['h']);
         if(isset($more['id']) && $direct) unset($more['id']);
         $more = buildURLparams($more, $sep);
     } else {
diff --git a/inc/html.php b/inc/html.php
index a13c9e58c2dabdf0a8709beff209c1e3556fd591..bbe29e3714fce66aba6d5a1c8958df9770baf79c 100644
--- a/inc/html.php
+++ b/inc/html.php
@@ -1661,7 +1661,7 @@ function html_admin(){
     global $ID;
     global $INFO;
     global $conf;
-    /** @var auth_basic $auth */
+    /** @var DokuWiki_Auth_Plugin $auth */
     global $auth;
 
     // build menu of admin functions from the plugins that handle them
@@ -1669,7 +1669,7 @@ function html_admin(){
     $menu = array();
     foreach ($pluginlist as $p) {
         /** @var DokuWiki_Admin_Plugin $obj */
-        if($obj =& plugin_load('admin',$p) === null) continue;
+        if(($obj = plugin_load('admin',$p)) === null) continue;
 
         // check permissions
         if($obj->forAdminOnly() && !$INFO['isadmin']) continue;
diff --git a/inc/indexer.php b/inc/indexer.php
index 378abb36057f1518bb612be3599832e7a94bbac6..658fb966b83df219e1cba8814e07da197b217a4d 100644
--- a/inc/indexer.php
+++ b/inc/indexer.php
@@ -1017,8 +1017,9 @@ class Doku_Indexer {
                 return false;
             }
         }
-        if ($conf['dperm'])
+        if (!empty($conf['dperm'])) {
             chmod($lock, $conf['dperm']);
+        }
         return $status;
     }
 
diff --git a/inc/init.php b/inc/init.php
index 248d27b9ca6e4e947d97f86bbd03906c655ba005..a937b934df938b7efc4a1a5f6b1ce0dcff1f021f 100644
--- a/inc/init.php
+++ b/inc/init.php
@@ -288,7 +288,7 @@ function init_files(){
             $fh = @fopen($file,'a');
             if($fh){
                 fclose($fh);
-                if($conf['fperm']) chmod($file, $conf['fperm']);
+                if(!empty($conf['fperm'])) chmod($file, $conf['fperm']);
             }else{
                 nice_die("$file is not writable. Check your permissions settings!");
             }
diff --git a/inc/io.php b/inc/io.php
index 4bd7c3364de3dd390349666d85d07a979e4916ae..eff0279acf81acf4d9f02851059edead1c531c57 100644
--- a/inc/io.php
+++ b/inc/io.php
@@ -393,7 +393,7 @@ function io_mkdir_p($target){
             return io_mkdir_ftp($dir);
         }else{
             $ret = @mkdir($target,$conf['dmode']); // crawl back up & create dir tree
-            if($ret && $conf['dperm']) chmod($target, $conf['dperm']);
+            if($ret && !empty($conf['dperm'])) chmod($target, $conf['dperm']);
             return $ret;
         }
     }
diff --git a/inc/mail.php b/inc/mail.php
index d0ea651bf78367f7fc2c39694b4941da1fa571b2..0b60c0a5b28d85763cff14560dfb6b19935b72d0 100644
--- a/inc/mail.php
+++ b/inc/mail.php
@@ -284,10 +284,9 @@ function mail_quotedprintable_encode($sText,$maxlen=74,$bEmulate_imap_8bit=true)
         // for EBCDIC safeness encode !"#$@[\]^`{|}~,
         // for complete safeness encode every character :)
         if ($bEmulate_imap_8bit)
-            $sRegExp = '/[^\x20\x21-\x3C\x3E-\x7E]/e';
+            $sRegExp = '/[^\x20\x21-\x3C\x3E-\x7E]/';
 
-        $sReplmt = 'sprintf( "=%02X", ord ( "$0" ) ) ;';
-        $sLine = preg_replace( $sRegExp, $sReplmt, $sLine );
+        $sLine = preg_replace_callback( $sRegExp, 'mail_quotedprintable_encode_callback', $sLine );
 
         // encode x09,x20 at lineends
         {
@@ -330,3 +329,6 @@ function mail_quotedprintable_encode($sText,$maxlen=74,$bEmulate_imap_8bit=true)
     return implode(MAILHEADER_EOL,$aLines);
 }
 
+function mail_quotedprintable_encode_callback($matches){
+    return sprintf( "=%02X", ord ( $matches[0] ) ) ;
+}
diff --git a/inc/pageutils.php b/inc/pageutils.php
index bf79daa7d7afd924332ad9579d613080e34f9ff9..60f326e042faca94a9d44d33eca7dc443adeab8a 100644
--- a/inc/pageutils.php
+++ b/inc/pageutils.php
@@ -396,7 +396,7 @@ function resolve_id($ns,$id,$clean=true){
 
     // if the id starts with a dot we need to handle the
     // relative stuff
-    if($id{0} == '.'){
+    if($id && $id{0} == '.'){
         // normalize initial dots without a colon
         $id = preg_replace('/^(\.+)(?=[^:\.])/','\1:',$id);
         // prepend the current namespace
diff --git a/inc/parser/handler.php b/inc/parser/handler.php
index 1de981b4842436d39eab4bbc256558b88e1facc3..8ae9912096ff82052a3a8c9a2595118e72a306dd 100644
--- a/inc/parser/handler.php
+++ b/inc/parser/handler.php
@@ -70,7 +70,7 @@ class Doku_Handler {
      */
     function plugin($match, $state, $pos, $pluginname){
         $data = array($match);
-        $plugin =& plugin_load('syntax',$pluginname);
+        $plugin = plugin_load('syntax',$pluginname);
         if($plugin != null){
             $data = $plugin->handle($match, $state, $pos, $this);
         }
@@ -653,8 +653,8 @@ function Doku_Handler_Parse_Media($match) {
 
     //parse width and height
     if(preg_match('#(\d+)(x(\d+))?#i',$param,$size)){
-        ($size[1]) ? $w = $size[1] : $w = null;
-        ($size[3]) ? $h = $size[3] : $h = null;
+        !empty($size[1]) ? $w = $size[1] : $w = null;
+        !empty($size[3]) ? $h = $size[3] : $h = null;
     } else {
         $w = null;
         $h = null;
@@ -1432,6 +1432,7 @@ class Doku_Handler_Table {
 class Doku_Handler_Block {
     var $calls = array();
     var $skipEol = false;
+    var $inParagraph = false;
 
     // Blocks these should not be inside paragraphs
     var $blockOpen = array(
diff --git a/inc/parserutils.php b/inc/parserutils.php
index 56161af444b6b4349e3f7d2a3e823d010c398707..b67daaabb69371e38c3940bd9d5bdc7ccc2cdb0e 100644
--- a/inc/parserutils.php
+++ b/inc/parserutils.php
@@ -625,7 +625,8 @@ function & p_get_renderer($mode) {
     $rclass = "Doku_Renderer_$rname";
 
     if( class_exists($rclass) ) {
-        return new $rclass();
+        $Renderer = new $rclass();
+        return $Renderer;
     }
 
     // try default renderer first:
@@ -641,10 +642,7 @@ function & p_get_renderer($mode) {
         $Renderer = new $rclass();
     }else{
         // Maybe a plugin/component is available?
-        list($plugin, $component) = $plugin_controller->_splitName($rname);
-        if (!$plugin_controller->isdisabled($plugin)){
-            $Renderer =& $plugin_controller->load('renderer',$rname);
-        }
+        $Renderer = $plugin_controller->load('renderer',$rname);
 
         if(!isset($Renderer) || is_null($Renderer)){
             msg("No renderer '$rname' found for mode '$mode'",-1);
diff --git a/inc/plugincontroller.class.php b/inc/plugincontroller.class.php
index 33d8c92cd89a7cd45c06cc5693ecf963aac11214..d80cd4c9e0d6674688e4f0aab0f75735c142b9ea 100644
--- a/inc/plugincontroller.class.php
+++ b/inc/plugincontroller.class.php
@@ -249,7 +249,7 @@ class Doku_Plugin_Controller {
                 $backup = $file.'.bak';
                 if (@file_exists($backup)) @unlink($backup);
                 if (!@copy($file,$backup)) return false;
-                if ($conf['fperm']) chmod($backup, $conf['fperm']);
+                if (!empty($conf['fperm'])) chmod($backup, $conf['fperm']);
             }
             //check if can open for writing, else restore
             return io_saveFile($file,$out);
diff --git a/inc/search.php b/inc/search.php
index cd36feeab3593a2474ce5108cfebbd053608508e..c2d31b9598c610bfb7cb783cfb2be220abc8e767 100644
--- a/inc/search.php
+++ b/inc/search.php
@@ -111,7 +111,7 @@ function search_index(&$data,$base,$file,$type,$lvl,$opts){
     $opts = array(
         'pagesonly' => true,
         'listdirs' => true,
-        'listfiles' => !$opts['nofiles'],
+        'listfiles' => empty($opts['nofiles']),
         'sneakyacl' => $conf['sneaky_index'],
         // Hacky, should rather use recmatch
         'depth' => preg_match('#^'.preg_quote($file, '#').'(/|$)#','/'.$opts['ns']) ? 0 : -1
@@ -377,7 +377,7 @@ function search_universal(&$data,$base,$file,$type,$lvl,$opts){
     }
 
     // check ACL
-    if(!$opts['skipacl']){
+    if(empty($opts['skipacl'])){
         if($type == 'd'){
             $item['perm'] = auth_quickaclcheck($item['id'].':*');
         }else{
@@ -389,17 +389,17 @@ function search_universal(&$data,$base,$file,$type,$lvl,$opts){
 
     // are we done here maybe?
     if($type == 'd'){
-        if(!$opts['listdirs']) return $return;
-        if(!$opts['skipacl'] && $opts['sneakyacl'] && $item['perm'] < AUTH_READ) return false; //neither list nor recurse
-        if($opts['dirmatch'] && !preg_match('/'.$opts['dirmatch'].'/',$file)) return $return;
-        if($opts['nsmatch'] && !preg_match('/'.$opts['nsmatch'].'/',$item['ns'])) return $return;
+        if(empty($opts['listdirs'])) return $return;
+        if(empty($opts['skipacl']) && !empty($opts['sneakyacl']) && $item['perm'] < AUTH_READ) return false; //neither list nor recurse
+        if(!empty($opts['dirmatch']) && !preg_match('/'.$opts['dirmatch'].'/',$file)) return $return;
+        if(!empty($opts['nsmatch']) && !preg_match('/'.$opts['nsmatch'].'/',$item['ns'])) return $return;
     }else{
-        if(!$opts['listfiles']) return $return;
-        if(!$opts['skipacl'] && $item['perm'] < AUTH_READ) return $return;
-        if($opts['pagesonly'] && (substr($file,-4) != '.txt')) return $return;
-        if(!$opts['showhidden'] && isHiddenPage($item['id'])) return $return;
-        if($opts['filematch'] && !preg_match('/'.$opts['filematch'].'/',$file)) return $return;
-        if($opts['idmatch'] && !preg_match('/'.$opts['idmatch'].'/',$item['id'])) return $return;
+        if(empty($opts['listfiles'])) return $return;
+        if(empty($opts['skipacl']) && $item['perm'] < AUTH_READ) return $return;
+        if(!empty($opts['pagesonly']) && (substr($file,-4) != '.txt')) return $return;
+        if(empty($opts['showhidden']) && isHiddenPage($item['id'])) return $return;
+        if(!empty($opts['filematch']) && !preg_match('/'.$opts['filematch'].'/',$file)) return $return;
+        if(!empty($opts['idmatch']) && !preg_match('/'.$opts['idmatch'].'/',$item['id'])) return $return;
     }
 
     // still here? prepare the item
diff --git a/inc/subscription.php b/inc/subscription.php
index ecbc9ef19e7c470eafe240f161438d5283cfaf44..ddf2f39e6ca9ac8101c72a2961715333976dbf26 100644
--- a/inc/subscription.php
+++ b/inc/subscription.php
@@ -62,7 +62,7 @@ class Subscription {
             return false;
         }
 
-        if($conf['dperm']) chmod($lock, $conf['dperm']);
+        if(!empty($conf['dperm'])) chmod($lock, $conf['dperm']);
         return true;
     }
 
diff --git a/inc/template.php b/inc/template.php
index c08767e526d392df23bcd66df77871df2ad744ff..b42c9d934158ba8bc4566c09bf7f1f3dbe98aab1 100644
--- a/inc/template.php
+++ b/inc/template.php
@@ -223,7 +223,7 @@ function tpl_toc($return = false) {
             if(in_array($class, $pluginlist)) {
                 // attempt to load the plugin
                 /** @var $plugin DokuWiki_Admin_Plugin */
-                $plugin =& plugin_load('admin', $class);
+                $plugin = plugin_load('admin', $class);
             }
         }
         if( ($plugin !== null) && (!$plugin->forAdminOnly() || $INFO['isadmin']) ) {
@@ -257,7 +257,7 @@ function tpl_admin() {
         if(in_array($class, $pluginlist)) {
             // attempt to load the plugin
             /** @var $plugin DokuWiki_Admin_Plugin */
-            $plugin =& plugin_load('admin', $class);
+            $plugin = plugin_load('admin', $class);
         }
     }
 
@@ -401,7 +401,7 @@ function tpl_metaheaders($alt = true) {
     // make $INFO and other vars available to JavaScripts
     $json   = new JSON();
     $script = "var NS='".$INFO['namespace']."';";
-    if($conf['useacl'] && $_SERVER['REMOTE_USER']) {
+    if($conf['useacl'] && !empty($_SERVER['REMOTE_USER'])) {
         $script .= "var SIG='".toolbar_signature()."';";
     }
     $script .= 'var JSINFO = '.$json->encode($JSINFO).';';
@@ -680,12 +680,12 @@ function tpl_get_action($type) {
             }
             break;
         case 'register':
-            if($_SERVER['REMOTE_USER']) {
+            if(!empty($_SERVER['REMOTE_USER'])) {
                 return false;
             }
             break;
         case 'resendpwd':
-            if($_SERVER['REMOTE_USER']) {
+            if(!empty($_SERVER['REMOTE_USER'])) {
                 return false;
             }
             break;
@@ -1412,7 +1412,7 @@ function tpl_actiondropdown($empty = '', $button = '&gt;') {
     echo '<div class="no">';
     echo '<input type="hidden" name="id" value="'.$ID.'" />';
     if($REV) echo '<input type="hidden" name="rev" value="'.$REV.'" />';
-    if ($_SERVER['REMOTE_USER']) {
+    if (!empty($_SERVER['REMOTE_USER'])) {
         echo '<input type="hidden" name="sectok" value="'.getSecurityToken().'" />';
     }
 
@@ -1794,7 +1794,7 @@ function tpl_classes() {
         'dokuwiki',
         'mode_'.$ACT,
         'tpl_'.$conf['template'],
-        $_SERVER['REMOTE_USER'] ? 'loggedIn' : '',
+        !empty($_SERVER['REMOTE_USER']) ? 'loggedIn' : '',
         $INFO['exists'] ? '' : 'notFound',
         ($ID == $conf['start']) ? 'home' : '',
     );
diff --git a/lib/exe/detail.php b/lib/exe/detail.php
index 7aae08f7657c89b3f9100fce6db833993c3b9c56..e3c81d877f5346e9ec50cd19ec64fda0cff3e927 100644
--- a/lib/exe/detail.php
+++ b/lib/exe/detail.php
@@ -9,7 +9,9 @@ $ID   = cleanID($INPUT->str('id'));
 // this makes some general infos available as well as the info about the
 // "parent" page
 $INFO = array_merge(pageinfo(),mediainfo());
-trigger_event('DETAIL_STARTED', $tmp=array());
+
+$tmp = array();
+trigger_event('DETAIL_STARTED', $tmp);
 
 //close session
 session_write_close();
diff --git a/lib/exe/mediamanager.php b/lib/exe/mediamanager.php
index d9e4a6b04e7e5b9202ca72ed33de724f34d1b1ed..d94a24c744a0404ed77167d58c583615d65b4fd9 100644
--- a/lib/exe/mediamanager.php
+++ b/lib/exe/mediamanager.php
@@ -34,7 +34,8 @@
     $JSINFO = array('id' => '', 'namespace' => '');
     $AUTH = $INFO['perm'];    // shortcut for historical reasons
 
-    trigger_event('MEDIAMANAGER_STARTED',$tmp=array());
+    $tmp = array();
+    trigger_event('MEDIAMANAGER_STARTED', $tmp);
     session_write_close();  //close session
 
     // do not display the manager if user does not have read access
diff --git a/lib/plugins/action.php b/lib/plugins/action.php
index 04b4f07a6458243ea1f0370282187d9125b87131..4b5eef60a8b7e23ce3517158dd7524b7952dd05f 100644
--- a/lib/plugins/action.php
+++ b/lib/plugins/action.php
@@ -17,7 +17,7 @@ class DokuWiki_Action_Plugin extends DokuWiki_Plugin {
     /**
      * Registers a callback function for a given event
      */
-    function register(Doku_Event_Handler $controller) {
+    public function register(Doku_Event_Handler $controller) {
         trigger_error('register() not implemented in '.get_class($this), E_USER_WARNING);
     }
 }
diff --git a/lib/plugins/config/settings/config.class.php b/lib/plugins/config/settings/config.class.php
index 1d2173706d3dbab33867579547348241a90d0495..a5a11cda17fdadd6cfbd26e4674c0d297a4a37f6 100644
--- a/lib/plugins/config/settings/config.class.php
+++ b/lib/plugins/config/settings/config.class.php
@@ -794,7 +794,7 @@ if (!class_exists('setting_numericopt')) {
 if (!class_exists('setting_onoff')) {
     class setting_onoff extends setting_numeric {
 
-        function html(&$plugin) {
+        function html(&$plugin, $echo = false) {
             $value = '';
             $disable = '';
 
@@ -830,7 +830,7 @@ if (!class_exists('setting_multichoice')) {
     class setting_multichoice extends setting_string {
         var $_choices = array();
 
-        function html(&$plugin) {
+        function html(&$plugin, $echo = false) {
             $value = '';
             $disable = '';
             $nochoice = '';
diff --git a/lib/plugins/config/settings/extra.class.php b/lib/plugins/config/settings/extra.class.php
index d0f99fa8ff7b3eb3130813fdee305b9d45bb8eab..83de802a3b94714f90ce94a6c185e58d4b5dcc81 100644
--- a/lib/plugins/config/settings/extra.class.php
+++ b/lib/plugins/config/settings/extra.class.php
@@ -176,7 +176,7 @@ if (!class_exists('setting_renderer')) {
             $format = $this->_format;
 
             foreach (plugin_list('renderer') as $plugin) {
-                $renderer =& plugin_load('renderer',$plugin);
+                $renderer = plugin_load('renderer',$plugin);
                 if (method_exists($renderer,'canRender') && $renderer->canRender($format)) {
                     $this->_choices[] = $plugin;
 
diff --git a/lib/plugins/info/syntax.php b/lib/plugins/info/syntax.php
index 5d969d7a215a573596c2459b177e346eb00eebe9..f8c6eb4847645d4c38629d0ecbbae4882dd47196 100644
--- a/lib/plugins/info/syntax.php
+++ b/lib/plugins/info/syntax.php
@@ -58,6 +58,7 @@ class syntax_plugin_info extends DokuWiki_Syntax_Plugin {
      */
     function render($format, Doku_Renderer &$renderer, $data) {
         if($format == 'xhtml'){
+            /** @var Doku_Renderer_xhtml $renderer */
             //handle various info stuff
             switch ($data[0]){
                 case 'syntaxmodes':
@@ -142,8 +143,6 @@ class syntax_plugin_info extends DokuWiki_Syntax_Plugin {
      * uses some of the original renderer methods
      */
     function _helpermethods_xhtml(Doku_Renderer &$renderer){
-        global $lang;
-
         $plugins = plugin_list('helper');
         foreach($plugins as $p){
             if (!$po = plugin_load('helper',$p)) continue;
@@ -251,10 +250,11 @@ class syntax_plugin_info extends DokuWiki_Syntax_Plugin {
     /**
      * Adds a TOC item
      */
-    function _addToTOC($text, $level, Doku_Renderer_xhtml &$renderer){
+    function _addToTOC($text, $level, Doku_Renderer &$renderer){
         global $conf;
 
         if (($level >= $conf['toptoclevel']) && ($level <= $conf['maxtoclevel'])){
+            /** @var $renderer Doku_Renderer_xhtml */
             $hid  = $renderer->_headerToLink($text, 'true');
             $renderer->toc[] = array(
                 'hid'   => $hid,
diff --git a/lib/plugins/plugin/classes/ap_info.class.php b/lib/plugins/plugin/classes/ap_info.class.php
index b3826b9447635ede2d5865905988169907c2324f..89b78fa2db3888864519baec0bfdda10a435c3d4 100644
--- a/lib/plugins/plugin/classes/ap_info.class.php
+++ b/lib/plugins/plugin/classes/ap_info.class.php
@@ -14,7 +14,7 @@ class ap_info extends ap_manage {
         usort($component_list, array($this,'component_sort'));
 
         foreach ($component_list as $component) {
-            if (($obj = &plugin_load($component['type'],$component['name'],false,true)) === null) continue;
+            if (($obj = plugin_load($component['type'],$component['name'],false,true)) === null) continue;
 
             $compname = explode('_',$component['name']);
             if($compname[1]){
diff --git a/lib/tpl/dokuwiki/tpl_header.php b/lib/tpl/dokuwiki/tpl_header.php
index 19d165059212c3f1f3ffde944de269d752bd1113..a2bfd4346fba7c52450592836ae5c171cff97f2f 100644
--- a/lib/tpl/dokuwiki/tpl_header.php
+++ b/lib/tpl/dokuwiki/tpl_header.php
@@ -41,7 +41,7 @@ if (!defined('DOKU_INC')) die();
                 <h3 class="a11y"><?php echo $lang['user_tools']; ?></h3>
                 <ul>
                     <?php
-                        if ($_SERVER['REMOTE_USER']) {
+                        if (!empty($_SERVER['REMOTE_USER'])) {
                             echo '<li class="user">';
                             tpl_userinfo(); /* 'Logged in as ...' */
                             echo '</li>';