We build. You grow.

Get best community software here

Start a social network, a fan-site, an education project with oxwall - free opensource community software

[Needs confirmation] Solution for Join Form fields bug | Forum

Nickolay
Nickolay Mar 12 '15
Hi,


As discussed in this thread (and also here and here) I also expirienced strange behaviour in Join Form on a client website (it also happend on local development machine and dev-server too).

So I dug deeper and here's what I found: when generating fake fields' names and css classes for <tr> a lot of times there were collisions in "random" strings, so that real fields become hidden (because some fake one had the same class) and sometimes form did not submit because required field names were just the same and were rendered of wrong type. Here are some examples:






So as it was clear to be randomness issue I replaced 2 lines in JoinForm::addFakeQuestions() method (\ow_system_plugins\base\controllers\join.php):


$randName = UTIL_String::getRandomString(rand(5, 16), 2);

$question['trClass'] = uniqid('ow_'.rand(0, 99999999999));


with random generation using openssl_random_pseudo_bytes() function:


$randName = rtrim(strtr(base64_encode(openssl_random_pseudo_bytes(rand(5, 16))), '+/', '-_'), '=');

$question['trClass'] = 'ow_'.rtrim(strtr(base64_encode(openssl_random_pseudo_bytes(rand(17, 21))), '+/', '-_'), '=');


And it really had the job done - no more problems with Join Form. So I think it's worth checking for Oxwall Devs. Hope this little investigation helps.

The Forum post is edited by Nickolay Mar 17 '15
Nickolay
Nickolay Mar 14 '15
A lack of feedback from Dev/Support Team isn't that "inspiring"(

Something like "Oook, we'll look into it.." would be enough for me to have faith in future releases.

ross Team
ross Mar 15 '15
We have passed our report to Oxwall developers, as soon as we get reply, I'll get back to you. Thanks. 
ross Team
ross Mar 16 '15
Nickolay, thank you for the fix, it will be introduced in the next update of the software. 
S. Bourdon
S. Bourdon Mar 16 '15
Hi!


I'm using version 1.6.0 and the original code is as follows:


$randName = uniqid(rand(0, 99999999999));

$question['trClass'] = uniqid('ow_'.rand(0, 99999999999));


Should I update it with the proposed fix or leave it like that?


Thank you very much for your support!

ross Team
ross Mar 16 '15
Yes, you can apply this fix for 1.6 version. 
Nickolay
Nickolay Mar 17 '15
Great, I'm glad it was helpful.