Loading...
 
Skip to main content

Error in PluginMatcher.php causing memory leakage and thus the fatal error: Allowed memory size of X bytes exhausted (tried to allocate X bytes).

Status
Closed
Subject
Error in PluginMatcher.php causing memory leakage and thus the fatal error: Allowed memory size of X bytes exhausted (tried to allocate X bytes).
Version
6.x
Category
  • Error
Feature
Wiki Plugin (extends basic syntax)
Submitted by
edwinbennink
Lastmod by
edwinbennink
Rating
(0)
Description

I discovered an error in the PluginMatcher.php, which parses text of a wikipage and searches for opening and closing tags. Saving a file with these tags often gave the known error:

Fatal error: Allowed memory size of 67108864 bytes exhausted (tried to allocate 77 bytes) in /usr/local/httpd/htdocs/tiki-6.2/lib/core/WikiParser/PluginMatcher.php on line 69

Looking at the size of the wiki-page (which was quite small), the problem was not in the memory_limit size in php.ini, which was set to 64MB.

Closing tags could not always be found (when it contained a nested tag), such that a cascade occurred (due to the recursive function call), resulting in an enormous amount of memory-use.

Solution

Remove the "+ 1" in line 106 in the file <tikiwikiroot>/lib/core/WikiParser/PluginMatcher.php:

Replace in line 106:
$lookupStart = $candidate + 1;
With:
$lookupStart = $candidate;

Importance
9 high
Priority
45
Demonstrate Bug on Tiki 19+
Demonstrate Bug (older Tiki versions)
Ticket ID
3831
Created
Monday 21 March, 2011 16:57:54 UTC
by edwinbennink
LastModif
Wednesday 25 January, 2012 17:16:23 UTC


Show PHP error messages