Hack: temporarily disabled PCRE recursion for Win32 in the paragraph block tag parser until a better parser can be written/adapted
authordan
Wed, 11 Nov 2009 23:44:10 -0500
changeset 1134 4fdd92da4fe8
parent 1133 6e51ca5e29eb
child 1135 56c0abbdad3e
Hack: temporarily disabled PCRE recursion for Win32 in the paragraph block tag parser until a better parser can be written/adapted
includes/wikiengine/parse_mediawiki.php
--- a/includes/wikiengine/parse_mediawiki.php	Mon Nov 09 09:18:29 2009 -0500
+++ b/includes/wikiengine/parse_mediawiki.php	Wed Nov 11 23:44:10 2009 -0500
@@ -219,6 +219,14 @@
     
     $tokens = array();
     $rand_id = sha1(microtime() . mt_rand());
+    
+    // Temporary hack to fix crashes under win32. Sometime I'll write a loop based
+    // parser for this whole section. Maybe. Perhaps the Apache folks will fix their
+    // Windows binaries first.
+    if ( PHP_OS == 'WIN32' || PHP_OS == 'WINNT' )
+    {
+      $regex = str_replace("(?: (?R) | .*? )*", "(?: .*? )", $regex);
+    }
     if ( preg_match_all($regex, $text, $matches) )
     {
       foreach ( $matches[0] as $i => $match )
@@ -234,7 +242,7 @@
     }
     
     // die('<pre>' . htmlspecialchars($text) . '</pre>');
-    
+	
     RenderMan::tag_unstrip('_paragraph_bypass', $text, $_nw, true);
     
     // This is potentially a hack. It allows the parser to stick in <_paragraph_bypass> tags