Download & Extend

Video tag doesn't work after more than 5 cyrillic letters in the body

Project:FlashVideo
Version:6.x-1.5-rc2
Component:Code
Category:bug report
Priority:normal
Assigned:Unassigned
Status:needs review

Issue Summary

This is kind of bizarre.

The self referencing [video] tag works well, but when used with node or index parameters, it displays "video not available". The bug happens only if the tag is preceded with more than 5 Cyrillic letters.

This works:

Some latin text
[video:node=100:index=0]

This falis:

Some измешан text
[video:node=100:index=0]

This works:

Некој miksed text
[video:node=100:index=0]

Comments

#1

Well... crap. And here I am about to try and test this on a site with Russian as the default language...

#2

Status:active» needs review

The bug comes from use of single-byte strpos and substr_replace functions on multi-byte strings.

Because there is no multi-byte substr_replace function built in PHP, I included in the patch one that I found in the User Contributed Notes on http://www.php.net/substr_replace.

AttachmentSize
flash_mb.patch 4.27 KB

#3

Does this work for non-multi-byte character configurations? Can anyone verify?

#4

It should work, the configuration is irrelevant, the affected functions apply to the body text. But i don't have any non utf-8 installation to check.

#5

At first glance, this looks like a fairly lengthy function just to do string replacement. Is there really no existing method of doing this without maintaining our own custom function for it?

#6

I noticed that I forgot to replace one occurrence of substr_replace, so here is an update patch.

AttachmentSize
flash_mb2.patch 3.56 KB

#7

I've analyzed the code and found a way to fix it without the added function. The thing is, I'm not sure if it's worse to maintain one extra function or this mash-up of single-byte and multi-byte string pointers that brings to memory the long forgotten horrors of C++.

AttachmentSize
flash_mb3.patch 2 KB
nobody click here