Skip to content

Conversation

@wsergent
Copy link

Updated code to CakePHP suggested alternatives to avoid Deprecation warnings

@wsergent
Copy link
Author

wsergent commented Dec 17, 2018

Further, the documentation (https://captcha.com/doc/php/cakephp-captcha.html) needs to be updated (not in Repo):
$this->Form->input should be $this->Form->control

$isHuman = captcha_validate($this->request->data['CaptchaCode']); should now be $isHuman = captcha_validate($this->getRequest()->getData('CaptchaCode'));

unset($this->request->data['CaptchaCode']); needs to be updated. However, standard practice is not to unset getRequest() items - see this stackoverflow for more info: https://stackoverflow.com/questions/44993792/how-to-unset-request-data-in-cakephp-3-4
But, this could be replace with:

    $data = $this->getRequest()->getData();
    unset($data['CaptchaCode']);
    $this->request = $this->getRequest()->withParsedBody($data);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant