Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Zend_Form_Element::filterName issue #17

Open
JonTJ opened this issue Jan 23, 2017 · 2 comments
Open

Zend_Form_Element::filterName issue #17

JonTJ opened this issue Jan 23, 2017 · 2 comments
Labels

Comments

@JonTJ
Copy link

JonTJ commented Jan 23, 2017

Hi there

Im having trouble with hydration - isValid always returns false as it thinks the value is empty. Zend_Form_Element::filterName() filters out '-' characters when setting the element name, obviously this is an issue as Google renders the element on the page with the '-' characters (g-recaptcha-response becomes grecaptcharesponse). Is there a known work around for this short of extending the Zend_Form_Element class to include the '-' character in the list of allowed name characters?

Many thanks!
Jon

@JonTJ
Copy link
Author

JonTJ commented Jan 24, 2017

adding the following method to ..\Form\Element\Recaptcha fixes this issue:

public function filterName($value, $allowBrackets = false)
{
$charset = '^a-zA-Z0-9\-_\x7f-\xff';
if ($allowBrackets) {
$charset .= '\[\]';
}
return preg_replace('/[' . $charset . ']/', '', (string) $value);
}

@JonTJ JonTJ closed this as completed Jan 24, 2017
@JonTJ JonTJ reopened this Jan 24, 2017
@cgsmith
Copy link
Owner

cgsmith commented Feb 4, 2017

Hi @JonTJ - thanks for the find and fix. Would you like to make a pull request? I can push this out once that is done.

@cgsmith cgsmith added the bug label Feb 4, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants