Validation problem ??

rbuelund

Member
Hi

I get this errror on my form with fields that contain validation:

Warning
: stristr() expects parameter 1 to be string, array given in /home/xxxxx/public_html/components/com_fabrik/models/element.php on line 1043

What is that ?
 
The closest occurence of the 'stristr' funcion I can fin is about 20 lines away in the current code, on 1067. Which means the code around there has changed since your version.

Can you try updating to the latest github, and see if the problem goes away?

-- hugh
 
Update

I just updated from github and as you can see in the attached image the Warning is still there.
 

Attachments

  • Warning.jpg
    Warning.jpg
    73.7 KB · Views: 289
Cookie ??

I don't know if this has anything to do with the warning, but I can see that when i press the send button a cookie is placed on my computer with the name: 42:7:0 and the content:0+0+E+4+A+5

When i try to access the page again i get and 406 error until I erase that specific cookie from my browser - then I can acces the site again!!??
 
Get stristr warning when no input in the captcha field

I'm getting the same problem - it happens when no input is put into the captcha field and then the submit button is clicked.

I get the normal 'Some parts of your form have not been correctly filled in' error, but I also get the 'Warning: stristr() expects parameter 1 to be string, array given in /home/hibtrain/public_html/components/com_fabrik/models/element.php on line 1067'

I've recently updated to the latest, 3.0.7, on github and the problem seems to have started happening then.

I'm getting the warning when I use a captcha field on a form, on both standard and recaptcha. I've tried recreating the field and it makes no difference. I've updated to the latest capctha on the svn but that makes no difference except it has an earlier release number on it. I've tried changing the field type on the database (text/varchar).
 

Attachments

  • captchaproblem.jpg
    captchaproblem.jpg
    212.8 KB · Views: 291
@rbueland - thank you for doing the github update. This confirmed that the error was where I thought it might be, as it now matches the line number in my code.

I just committed this "fix":

https://github.com/Fabrik/fabrik/commit/85f0c44275150736062732c2b5ef2ffc0dea6e5d

... to github. I think the problem may be a little more deep seated, in that some elements may be generating arrays or null values as defaults during the validation phase, but this should at least get rid of that warning.

@Suzzi can you confirm whether this update fixes your issue?

-- hugh
 
Hi Hugh

I put that change in (I just copied and pasted it directly into the element.php file, I assume you didn't make any other line changes? :
- if (!stristr($default, 'return'))
+ if (is_string($default) && !stristr($default, 'return'))


I now get this error:

Warning: stripslashes() expects parameter 1 to be string, array given in /home/hibtrain/public_html/components/com_fabrik/models/element.php on line 1075

regards,
Suzzi
 
Ack phfffft. Yeah, I thought it might just kick the problem a little bit down the road. Can you do this. Just before that line you changed, put:

PHP:
if (!is_string($default)) {
   var_dump($default);exit;
}

... and paste the var_dump output here? Then remove those lines.

Oh, if you site is live, and other people are using other forms ... don't do this!

-- hugh
 
Notice

Just a notice - the problem moved to the exact same place for me :)

This comes as output, when I insert the line above:

array(1) { [0]=> string(2) "42" }

Regards
 
To get rid of the warnings you can set Joomla error reporting (Global configuration/Server) to none (which doesn't solve the underlying problem!)
 
Hi, I got this working, sorry for the delay in replying I thought I had noted my changes here. It's been a while, but I did a whole load of changes to try and get it working and I think I eventually got it working by recreating the list from scratch. I didn't make any change to the database.

My captcha field on the database is 'text', null is default.
Also I made did this: in 'edit element->List view settings-> always render is set to yes.
 
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top