Advertisement:

Author Topic: Bug in parser_bbc() function ?  (Read 3856 times)

Offline Mizar

  • Newbie
  • *
  • Posts: 9
Bug in parser_bbc() function ?
« on: October 14, 2005, 08:43:32 AM »
I have posted recently a topic about a problem in the display of topic containing à letter.

I modify the function parse_bbc() in /source/subs.php

Code: [Select]
// The idea is, find words xx long, and then replace them with xx + space + more.
if (strlen($data) > $modSettings['fixLongWords'])
{
// This is done in a roundabout way because $breaker has "long words" :P.
$data = strtr($data, array($breaker => '< >', '&nbsp;' => "\xA0"));
$data = preg_replace(
'/(?<=[>;:!? \xA0\]()]|^)([\w\.]{' . $modSettings['fixLongWords'] . ',})/e',
"preg_replace('/(.{" . ($modSettings['fixLongWords'] - 1) . "})/', '\\\$1< >', '\$1')",
$data);
$data = strtr($data, array('< >' => $breaker, "\xA0" => '&nbsp;'));
}

changing all occurencies of:

Code: [Select]
xA0
with

Code: [Select]
x00A0
Now all my à  letter remain à also when the text is longer than $modSettings['fixLongWords']

P.S.
I don't know if this is valid for all. In my utf-8 forum work good.

Bye

Offline taka

  • Semi-Newbie
  • *
  • Posts: 15
Re: Bug in parser_bbc() function ?
« Reply #1 on: January 02, 2006, 02:28:21 PM »
Unfortunately, it's not working as expected.  See following document:

http://us3.php.net/manual/en/language.constants.php [nofollow]

Your code means three characters, null char, 'A' and '0'.  The bug is in the string literal which hardcoded '\xA0' in there.  The right fix is to remove that character. 

Offline SacmaliK

  • Full Member
  • ***
  • Posts: 644
  • Gender: Male
  • Türk Evladı Uyuma Uyan 30 Kupona Alınmadı Bu Vatan
    • Ocak Turk
Re: Bug in parser_bbc() function ?
« Reply #2 on: October 01, 2006, 01:30:42 PM »
Code: [Select]
// This is done in a roundabout way because $breaker has "long words" :P.
$data = strtr($data, array($breaker => '< >', '&nbsp;' => $context['utf8'] ? "\xC2\xA0" : "\xA0"));
$data = preg_replace(
'~(?<=[>;:!? ' . ($context['utf8'] ? '\x{C2A0}' : '\xA0') . '\]()]|^)([\w\.]{' . $modSettings['fixLongWords'] . ',})~e' . ($context['utf8'] ? 'u' : ''),
"preg_replace('/(.{" . ($modSettings['fixLongWords'] - 1) . '})/' . ($context['utf8'] ? 'u' : '') . "', '\\\$1< >', '\$1')",
$data);
$data = strtr($data, array('< >' => $breaker, $context['utf8'] ? "\xC2\xA0" : "\xA0" => '&nbsp;'));


I While the message send fatal error  :'(

$data = strtr($data, array($breaker => '< >', '&nbsp;' => $context['utf8'] ? "\xC2\xA0" : "\xA0"));

Is there the mistake?
My Mods
Veoh Bbc Tag:here
Topic get Keywords:here
...

Offline codenaught

  • SMF Friend
  • SMF Super Hero
  • *
  • Posts: 14,653
  • Gender: Male
  • Formerly Known As akabugeyes
Re: Bug in parser_bbc() function ?
« Reply #3 on: October 03, 2006, 05:12:23 PM »
I don't see any parse error in the code you posted. Are you sure this change is even needed? This topic was started nearly a year ago and when I tested out posting long words with just "à" in them I didn't see any problems.
Dev Consultant
Former SMF Doc Coordinator

Offline karag8z

  • Newbie
  • *
  • Posts: 4
Re: Bug in parser_bbc() function ?
« Reply #4 on: January 29, 2009, 06:19:49 AM »
bendeki hata images hack eklemelerini kaldırınca çözüldü. popup url + pop up image duruyor. images hack entegrasyonunu nasıl çözerim bilmem ama