From f88c6cb898b58fa23caee54768f946140cd53f87 Mon Sep 17 00:00:00 2001 From: Alex Tselegidis Date: Fri, 1 Jan 2016 20:34:42 +0100 Subject: [PATCH] Sometimes captcha generates an error if the session is accessed after there is some output in the response. From now on the captcha phrase will be saved first and then there will be the image output. --- src/application/controllers/captcha.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/application/controllers/captcha.php b/src/application/controllers/captcha.php index 01941b0d..7c64de76 100644 --- a/src/application/controllers/captcha.php +++ b/src/application/controllers/captcha.php @@ -32,8 +32,9 @@ class Captcha extends CI_Controller { public function index() { header('Content-type: image/jpeg'); $builder = new Gregwar\Captcha\CaptchaBuilder; - $builder->build()->output(); + $builder->build(); $this->session->set_userdata('captcha_phrase', $builder->getPhrase()); + $builder->output(); } }