PHP validation issue

kinkaz

Member
Hey there,

I have a form containing two elements (email, confirmation email). I've set a php validation on the confirmation email field. Code is following :

$jinput = JFactory::getApplication()->input;
$email = $jinput->get('mytablename___email', 'default value', 'string');
return $data == $email;

The validation is working : if the email adresses are the same, data is stored and I get the usual success message. When the two adresses are different, I have my error message (the one I set : the email adresses must match), but additionally I get this error :
Debug: Caught exception on php validation of mytablename ___check_email: syntax error, unexpected '!' in Unknown on line 21

The validation is the only php code i've set in that form.

What did I do wrong ?

Thanks and have a great day
 
Do you have error reporting at max in J!'s global settings?

Looks like there's some kind of warning being generated prior to where we catch and report any errors in the eval'ed code, but without more error logging, almost impossible to tell where it's coming from.

So if it isn't already, make sure PHP's error reporting is at max, and set to display.

-- hugh
 
Thanks for your answer,

I just set error reporting to max and in my php settings, "Display errors" was already set to "On".

I tried again, and now I get another error message :
An error has occurred with a calculated field - please inform the web-site owner.
Debug: Caught exception on php validation of mytablename___check_email: Undefined offset: 0

Note that the error message I got before about the syntax error is no longer displayed... o_O

Does this new error message make more sense .. ?
 
Are you running the latest joomla3 GitHub?
There was a fix addressing this (or a similar) error in calc elements (some elements - probably migrated from Fabrik2 - were calculating the calculated string again).
 
Yes, I'm running on the latest version. I just cleared my browser's cache and I no longer see the error without the fabrik debug mode... (I forgot to say that it was displayed even without the debug mode).

If I set the fabrik debug mode again, I get my first error again.

Anyway, my form is submitted and I don't see the error anymore (without debug mode) : fine for me :)

Thanks for your time
 
Yeah I think those notices are false positives, in that your php statement returns false, which our error checking was catching as being an error. I thought I had fixed this though
 
We are in need of some funding.
More details.

Thank you.

Members online

No members online now.
Back
Top