I decided to upgrade my web server containers to PHP 7 but ran into a problem with WordPress, all articles had no text. The problem seemed to be within the plugin CodeColorer since disabling it resolved the problem

PHP Warning:  preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead in /var/www/wp-content/plugins/codecolorer/codecolorer-core.php on line 50

In wp-content/plugins/codecolorer/codecolorer-core.php locate this code block:

  /** Search content for code tags and replace it */
  function BeforeHighlightCodeBlock($content) {
    $content = preg_replace('#(\s*)\[cc([^\s\]_]*(?:_[^\s\]]*)?)([^\]]*)\](.*?)\[/cc\2\](\s*)#sie', '$this->PerformHighlightCodeBlock(\'\\4\', \'\\3\', $content, \'\\2\', \'\\1\', \'\\5\');', $content);
    $content = preg_replace('#(\s*)\<code(.*?)\>(.*?)\</code\>(\s*)#sie', '$this->PerformHighlightCodeBlock(\'\\3\', \'\\2\', $content, \'\', \'\\1\', \'\\4\');', $content);

    return $content;
  }

and replace it with this

  /** Search content for code tags and replace it */
  function BeforeHighlightCodeBlock($content) {
    $content = preg_replace_callback('#(\s*)\[cc([^\s\]_]*(?:_[^\s\]]*)?)([^\]]*)\](.*?)\[/cc\2\](\s*)#si', function($matches){
      return $this->PerformHighlightCodeBlock($matches[4], $matches[3], $matches[2], $matches[1], $matches[5]);
    }, $content);
    $content = preg_replace_callback('#(\s*)\<code(.*?)\>(.*?)\</code\>(\s*)#si', function($matches){
      return $this->PerformHighlightCodeBlock($matches[3], $matches[2], '', $matches[1], $matches[4]);
    }, $content);

    return $content;
  }

It would of course make sense to find a replacement for CodeColorer since it does not seem to be maintained but that would probably also mean having to edit all old articles.

Nowhere.dk has been using a lot of different software over the years (handwritten HTML files, home brewed CMS and various other CMS’es).

Since I started this blog (again) I’ve been running Nanoblogger, a nice, small bash based blogging framework. But even if it has been working okay it is very limited in function (hence nano I guess). So I decided to switch to a new blog engine.

The choice is: WordPress. Why? Because it has a large user base, easy to extend (more than 5000 plugins) and easy to make look like you want (lots and lots of themes). The downside is that it is PHP based and requires MySQL which might be a problem for my underpowered server.

Anyway, I’ve done a log of testing before going live with the new software. All article links should still work. Old comments have been imported to the new system.