?

User tests: Successful: Unsuccessful:

avatar Kubik-Rubik
Kubik-Rubik
13 Jun 2014

Related to
[bug] [33848] Fix fatal error when sending contact form (#3763)

How to test

  • Use Joomla! version 2.5.22 and create a contact - set a link to the contact with a form in the menu
  • Fill out the form with some sample data (but correct email address), activate the checkbox "Send copy to yourself" and click on send
  • You will never receive a copy of this email because the value of this checkbox input field is empty
  • Add patch and try it again
avatar Kubik-Rubik Kubik-Rubik - open - 13 Jun 2014
avatar zero-24
zero-24 - comment - 13 Jun 2014

@Kubik-Rubik i can confirm the issue and the fix :+1:

avatar Bakual
Bakual - comment - 13 Jun 2014

I'm thinking that we should just revert the actual check in the controller and fix it there. It's not necessary a given that any contact form uses JForm to create that checkbox.
HTML Checkboxes are a funny thing. The value of the checkbox actually doesn't matter at all. You have to check if they are submitted, not if they contain a value. The value is only relevant if you have multiple checkboxes with the same name.
On a sidenote, that's actually done wrong in 3.x as well...

avatar Kubik-Rubik
Kubik-Rubik - comment - 14 Jun 2014

@Bakual

I think that a value parameter should be used in a checkbox field and so we can use this solution to fix the bug!

Yes, we could also only optimize the if statement. Instead of checking !empty($data['contact_email_copy']) we could just check whether this request variable is set at all isset($data['contact_email_copy']). If the checkbox is selected, then the request variable is set with an empty value. With the current check this can never be true without providing a value. In Joomla! 3.x the value is set to 1, so the initial fix does work there.

avatar roland-d
roland-d - comment - 14 Jun 2014

Just before I test, should I test the value 1 or the proposed controller change? Confused.

avatar Bakual
Bakual - comment - 14 Jun 2014

I would use isset personally. Mainly because we don't really know where the form is coming from. It may well be an override (or even a module) which doesn't use JForm and thus would still be broken.
I don't want to risk another broken thing :)
The XML change can of course be kept as well. It's always better :)

avatar Kubik-Rubik
Kubik-Rubik - comment - 14 Jun 2014

@Bakual Correct, updated the PR.
@roland-d Now you can test the whole PR. :-) Thanks!

avatar roland-d
roland-d - comment - 15 Jun 2014

@test: After applying the patch, I do get a copy of the message sent via the contact form.

JC tracker moved to RTC.

avatar Bakual Bakual - reference | 09e8d05 - 23 Jun 14
avatar Bakual
Bakual - comment - 23 Jun 2014

Merged with 09e8d05

avatar Bakual Bakual - change - 23 Jun 2014
Status New Closed
Closed_Date 0000-00-00 00:00:00 2014-06-23 13:58:49
avatar Bakual Bakual - close - 23 Jun 2014
avatar Bakual Bakual - close - 23 Jun 2014
avatar Kubik-Rubik Kubik-Rubik - head_ref_deleted - 20 Jun 2015

Add a Comment

Login with GitHub to post a comment