captcha image not showing

I’ve come across a very strange issue. If you put the following in the Controller.php, the captcha image of the contact form doesn’t display at all!!! I’ve even tried with Yii 1.1.16 and happens the same.

	public function init()


	    echo "a";


is this a bug?

that is rather obvious - captcha is rendered with controller action, so if you put some output in controller init() function it will be sent prior to image data…

I really want to add this code in the init method:





As you can see, this code doesn’t have any “echo”, but the captcha image doesn’t display!!

if captcha image url does not contain "lang" param (and probably it does not) this code will redirect instead of serve image data…

the url DOES contain the “lang” param. It doesn’t redirect, as the contact form is displayed. Would you like to try this code?

the url displaying form IS NOT the url for captcha image. Use firebug or similar dev tool and check form HTML in browser and check what is the url in <img> tag whre captcha should be visible.

You may also use "network" tab of dev tool and reload page, then check what real request is made and what is the server response.