From b04a190d960a260703e65e9ed4a951cb083e4e61 Mon Sep 17 00:00:00 2001
From: Michael Hamann <michael@content-space.de>
Date: Sun, 2 Dec 2012 23:58:38 +0100
Subject: [PATCH] XHTML renderer: bind section id counter to the renderer
 instance

This changes the previously static lastsecid into an instance variable,
this leads to consistent section edit ids when the xhtml renderer is
used more than once in a request. This makes it possible for test cases
to know the exact section edit id for an instruction array.
---
 inc/parser/xhtml.php | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/inc/parser/xhtml.php b/inc/parser/xhtml.php
index b4e78a530..68b92ca43 100644
--- a/inc/parser/xhtml.php
+++ b/inc/parser/xhtml.php
@@ -30,6 +30,7 @@ class Doku_Renderer_xhtml extends Doku_Renderer {
     var $toc = array();   // will contain the Table of Contents
 
     var $sectionedits = array(); // A stack of section edit data
+    private $lastsecid = 0; // last section edit id, used by startSectionEdit
 
     var $headers = array();
     var $footnotes = array();
@@ -50,9 +51,8 @@ class Doku_Renderer_xhtml extends Doku_Renderer {
      * @author Adrian Lang <lang@cosmocode.de>
      */
     public function startSectionEdit($start, $type, $title = null) {
-        static $lastsecid = 0;
-        $this->sectionedits[] = array(++$lastsecid, $start, $type, $title);
-        return 'sectionedit' . $lastsecid;
+        $this->sectionedits[] = array(++$this->lastsecid, $start, $type, $title);
+        return 'sectionedit' . $this->lastsecid;
     }
 
     /**
-- 
GitLab