Skip to content

Deprecated functions in CakePHP #1

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

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