The doEdit() call needs to parse and reuses $wgParser, which is already in use so it probably breaks the state of it. Maybe you could use a DeferredUpdate to actually to the edits, or do them via an api.php request, or stash $wgParser, replace it with a new one before doing the edit and then swap it back.
In any case doing edits on tag parse could be kind of slow (e.g. someone does a page preview with hundreds of tags in it). One might want to limit that somehow.
-- View this message in context: http://wikimedia.7.x6.nabble.com/Is-WikiPage-doEdit-dangerous-in-a-parser-ta... Sent from the Wikipedia Developers mailing list archive at Nabble.com.