PHP-Markdown & PHP 5.1 Fix

Today influenced.net’s host has had its PHP module upgraded from version 4.x to 5.1.1.. this broke a couple of things, most notably PHP-Markdown

I proceeded to download the latest version of PHP-Markdown but still, the issue remained..

The fix was to modify the _DoCodeBlocks function as follows:

function _DoCodeBlocks($text) {
#
#   Process Markdown `<pre><code>` blocks.
#
global $md_tab_width;

$text = preg_replace_callback('{
(?:nn|A)
((?:(?:[ ]{'.$md_tab_width.'}|t).*n+)+)
((?=^[ ]{0,'.$md_tab_width.'}S)|Z)
}xm',
'_DoCodeBlocks_callback', $text);

return $text;
}

I don’t exactly know why this change worked, it seems something wasn’t being escaped properly

Leave a Reply