MyBB Community Forums
[F] <) and >) converted to smilies [R] [C-Michael83] - Printable Version

+- MyBB Community Forums (https://community.mybb.com)
+-- Forum: Community Archive (https://community.mybb.com/forum-106.html)
+--- Forum: Archived Forums (https://community.mybb.com/forum-143.html)
+---- Forum: Archived Development and Support (https://community.mybb.com/forum-155.html)
+----- Forum: Archived Bug Reports (https://community.mybb.com/forum-74.html)
+------ Forum: MyBB 1.4.2 (https://community.mybb.com/forum-100.html)
+------ Thread: [F] <) and >) converted to smilies [R] [C-Michael83] (/thread-39329.html)



[F] <) and >) converted to smilies [R] [C-Michael83] - Michael S. - 2008-10-20

If you use
<) or >)
inside a post the wink smilie is shown.

Example:
<) >)


RE: <) and >) converted to smilies - Ryan Gordon - 2008-10-20

We replace < and > with &lt; and &gt; so when you do that it sees &lt;) and &gt;) and it matches the ";)" part which is causing the problem. I guess we just fix the code to correctly check if there is a preceding html entity before

if(is_array($this->smilies_cache))
		{
			foreach($this->smilies_cache as $find => $replace)
			{
				$find = $this->parse_html($find);
				if(version_compare(PHP_VERSION, "5.1.0", ">="))
				{
					$message = preg_replace("#(?<=[^&;\"])".preg_quote($find,"#")."(?=.\W|\"|\W.|\W$)#si", $replace, $message, $remaining, $replacements);
					$remaining -= $replacements;
					if($remaining <= 0)
					{
						break; // Reached the limit
					}
				}
				else
				{
					$message = preg_replace("#(?<=[^&;\"])".preg_quote($find,"#")."(?=.\W|\"|\W.|\W$)#si", $replace, $message, $remaining);
				}
			}
		}

inc/class_parser.php


RE: <) and >) converted to smilies - Nexus - 2008-10-25

I don't see the problem in this to be honest.......unless u want to show a pizza slice, u wont post < ) and it wont make it <)


RE: <) and >) converted to smilies - Ryan Gordon - 2008-10-26

I could be doing....

(i.e. </html>)



[F] <) and >) converted to smilies [R] - Ryan Gordon - 2008-10-31

Thank you for your bug report.

This bug has been fixed in our internal code repository. Please note that the problem will not be fixed here until these forums are updated.

With regards,
MyBB Group


RE: [F] <) and >) converted to smilies [R] - Ryan Gordon - 2008-10-31

Find in inc/class_parser.php

if(version_compare(PHP_VERSION, "5.1.0", ">="))
				{
					$message = preg_replace("#(?<=[^&;\"])".preg_quote($find,"#")."(?=.\W|\"|\W.|\W$)#si", $replace, $message, $remaining, $replacements);
					$remaining -= $replacements;
					if($remaining <= 0)
					{
						break; // Reached the limit
					}
				}
				else
				{
					$message = preg_replace("#(?<=[^&;\"])".preg_quote($find,"#")."(?=.\W|\"|\W.|\W$)#si", $replace, $message, $remaining);
				}

and replace with

$find = preg_quote($find, "#");
				// Fix issues for smileys starting with a ";"
				if($find{0} == ";")
				{
					$find = "(?<!&gt|&lt|&amp)".$find;
				}
				
				if(version_compare(PHP_VERSION, "5.1.0", ">="))
				{
					$message = preg_replace("#(?<=[^\"])".$find."(?=.\W|\"|\W.|\W$)#si", $replace, $message, $remaining, $replacements);
					$remaining -= $replacements;
					if($remaining <= 0)
					{
						break; // Reached the limit
					}
				}
				else
				{
					$message = preg_replace("#(?<=[^\"])".$find."(?=.\W|\"|\W.|\W$)#si", $replace, $message, $remaining);
				}