SMF Development > Fixed or Bogus Bugs
long words and many smilies
blar:
see in test board for oversized
and many smilies => Fatal error: Maximum execution time of 30 seconds exceeded in Subs.php on line 999
don't use ereg_, don't use preg_ for smilies
str_replace or strtr are faster
Hans v. M.:
I got this warning too:
Fatal error: Maximum execution time of 30 seconds exceeded in /home/simple/public_html/community/Sources/Subs.php on line 999
when opening this thread from an alertmail:
http://www.simplemachines.org/community/index.php?threadid=346;start=new
Joseph:
blar, although we appreciate the comments, there are flaws with your assertions.
The reason we don't use str_replace or strtr for smilies is because of the customizability of them and problems caused with special characters. For example - lets say you end a bracketed phrase with a special character- something like &2345;) - the ; ) would then be translated to ;) and the special character would not be displayed. Similarly say you had a URL where it had index.php?C=you;D=me in it - then the ; D would be translated to ;D
Similarly, using the code you provided will break long lines of code - for example imagine someone was linking to a long URL using an image which also had a long URL - the addresses would be be split at 80 characters and break the code.
Please, keep up the suggestions though :)
Grudge:
Hopefully this is on topic
Will the problem in SE where smilies that say, start a word but don't end it are translated into the image. This is very hard to explain so I'll show it :D
On my board many people like to type up *made up* smilies. For example people will type :owned: . However, YABB SE will always turn the
--- Code: ---:o
--- End code ---
bit into an image making the typing look silly. there should be checks that the image has nothing either side of it (ie a whitespace either side, or, if at the beginning or end of a post - no character)
It can't be very hard to do and would be a nice fix :)
Joel:
You could use str_replace if you simply required a space before each smilie. When you click a smilie to insert it into your post it puts a space first, and 99% of people that manually type smileys put a space between preceding text and a smilie anyway. It seems like this solution wouldn't cause problems with things like URLs or even bracketed phrases. The only common situation (that I can think of) where this doesn't work is if you start a new line with a smilie without a preceding space. I don't think that's a major problem, though, and people will catch on quickly to something this simple.
As it stands (at least in YSE), you take a pretty significant performance hit -- particularly with lots of smilies or high traffic forums -- to accomodate a very small number of people.
I'm might be (probably am) missing a fairly obvious problem here, but I've done this on the YSE forums I run and it works just great.
Navigation
[0] Message Index
[#] Next page
Go to full version