<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title><![CDATA[PunBB Forums — parser.php - tags, that musn't be closed.]]></title>
		<link>https://punbb.informer.com/forums/topic/26336/parserphp-tags-that-musnt-be-closed/</link>
		<atom:link href="https://punbb.informer.com/forums/feed/rss/topic/26336/" rel="self" type="application/rss+xml" />
		<description><![CDATA[The most recent posts in parser.php - tags, that musn't be closed..]]></description>
		<lastBuildDate>Sat, 19 Oct 2013 09:39:56 +0000</lastBuildDate>
		<generator>PunBB</generator>
		<item>
			<title><![CDATA[Re: parser.php - tags, that musn't be closed.]]></title>
			<link>https://punbb.informer.com/forums/post/150548/#p150548</link>
			<description><![CDATA[<p>Install this extension: <a href="http://dev.poldrag.katowice.pl/distfiles/punbb/om_close_tag_test.zip">om_close_tag_test.zip</a>. It adds the tag &quot;username&quot;, which will be replaced by the name of user displaying the forum.</p><p>Now try to write a message like this:<br /></p><div class="codebox"><pre><code>Hello [username]! Your name is [username], right?</code></pre></div><p>And the following error will be displayed:<br /></p><div class="codebox"><pre><code>[username] was opened within itself, this is not allowed</code></pre></div>]]></description>
			<author><![CDATA[null@example.com (keeshii)]]></author>
			<pubDate>Sat, 19 Oct 2013 09:39:56 +0000</pubDate>
			<guid>https://punbb.informer.com/forums/post/150548/#p150548</guid>
		</item>
		<item>
			<title><![CDATA[Re: parser.php - tags, that musn't be closed.]]></title>
			<link>https://punbb.informer.com/forums/post/150476/#p150476</link>
			<description><![CDATA[<p><strong>keeshi,</strong> can you make example for non-closed tag?</p>]]></description>
			<author><![CDATA[null@example.com (dimkalinux)]]></author>
			<pubDate>Tue, 15 Oct 2013 07:48:29 +0000</pubDate>
			<guid>https://punbb.informer.com/forums/post/150476/#p150476</guid>
		</item>
		<item>
			<title><![CDATA[parser.php - tags, that musn't be closed.]]></title>
			<link>https://punbb.informer.com/forums/post/150247/#p150247</link>
			<description><![CDATA[<p>I tried to add to bbcode some new tags, which don&#039;t have closing element. I added name of tag to array $tags_open and not to $tags_closed, but parser keep telling me, that I haven&#039;t closed my new tag during validation.</p><p>I suggest to change this fragment of code in parser.php:<br /></p><div class="codebox"><pre><code>@@ -480,13 +486,16 @@
             }
 
             if (in_array($current_tag, array_keys($tags_limit_bbcode)))
                 $limit_bbcode = $tags_limit_bbcode[$current_tag];
 
-            $open_tags[] = $current_tag;
-            $open_args[] = $current_arg;
-            $opened_tag++;
+            // add open_tags to stack only if they must be closed.
+            if (!in_array($current_tag, $tags_opened) || in_array($current_tag, $tags_closed)) {
+                $open_tags[] = $current_tag;
+                $open_args[] = $current_arg;
+                $opened_tag++;
+            }
             $new_text .= $current;
             continue;
         }
     }</code></pre></div><p>This did the trick for me.</p><p>I know that arrays $tags_open and $tags_closed are equal, but now it is hard to make an extension, which adds non-closing tags into bbcode.</p>]]></description>
			<author><![CDATA[null@example.com (keeshii)]]></author>
			<pubDate>Tue, 17 Sep 2013 19:00:28 +0000</pubDate>
			<guid>https://punbb.informer.com/forums/post/150247/#p150247</guid>
		</item>
	</channel>
</rss>
