Yii Framework Forum: CCaptchaAction & local domains - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

CCaptchaAction & local domains Rate Topic: -----

#1 User is offline   Pierre Voisin 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 3
  • Joined: 02-August 12

  Posted 02 August 2012 - 10:46 PM

Hi there, this is my first post! :)

I'm still quite new to Yii but everything has been going well so far except one thing that I can't get. I've noticed it once but by that time and couldn't halt and investigate since it was not blocking in production.

In CCaptchaAction, at the end of the "run" method there's a call to "Yii::app()->end()" which ends up calling PHP's "exit" function since the second parameter is true by default (see implementation of CApplication#end).

When I run my code (which is really really close to the captcha example's) on a live domain/host it runs like a charm, but when I'm under development cycle I'm running it on a local VM with a custom domain name like "stuff" (one single word, declared in my local Windows hosts file) the captcha image is not sent to the browser and I'm getting error messages like «Error 324 (net::ERR_EMPTY_RESPONSE): The server closed the connection without sending any data.» (Chrome).

In facts, I'm not sure why the image is sent out to the browser in production since the implementation makes that call to the "exit" function. I've tried to see if I could change the direct call to "end()" for a call like "end(0, false)" so that it doesn't exit and it actually flushes the image to the browser, which is logical to me, and it works!
What I can't understand is why it works in production - I'm more comfortable with that call to "end(0, false)", it makes more sense to me but I'm surely wrong.

So, well, I'd really appreciate your help! I'm using Yii 1.1.9 and a standard LAMP stack (VirtualBox, Fedora, httpd). Implied URL is like: "hteeteepee://stuff/index.php?r=registration/captcha&v=501b47646a064" and "captcha" points to the original CCaptchaAction class.

Please tell me if you need more details. I think everything relevant is here already but it's late and I may have missed something... ;)

Thanks in advance,


Pierre
0

#2 User is offline   Maurizio Domba Cerin 

  • Yii - Yesss It Is !!!
  • Yii
  • Group: Yii Dev Team
  • Posts: 4,342
  • Joined: 12-October 09
  • Location:Croatia

Posted 03 August 2012 - 02:33 AM

end() just finishes the script execution so that there is no additional output to the screen, but all that has been sent to the screen before it, should be there....

Did you chech the yii requirements on localhost... captcha needs the GD extension with FreeType support
Find more about me.... btw. Do you know your WAN IP?
0

#3 User is offline   Pierre Voisin 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 3
  • Joined: 02-August 12

Posted 03 August 2012 - 12:44 PM

Yep, checkRequirements returns true and I've also checked manually: gd is correctly installed and the TTF also. By the way, when I change the call from end() to end(0, false) the image is properly generated.

Apart from that you're definitely right and I thought about it on my way to the bed yesterday: as soon as header is called something is flushed out so I should get some bits of an HTTP response on the browser side anyway. Or maybe it somehow gets into an HTTP buffer which is dismissed at the end for some reason?
0

#4 User is offline   Maurizio Domba Cerin 

  • Yii - Yesss It Is !!!
  • Yii
  • Group: Yii Dev Team
  • Posts: 4,342
  • Joined: 12-October 09
  • Location:Croatia

Posted 03 August 2012 - 05:07 PM

it's hard to say what could be the problem without having and debuging the code... you should check this with some tools like firebug for firefox to see if any data and what data is returned.
Find more about me.... btw. Do you know your WAN IP?
0

#5 User is offline   Pierre Voisin 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 3
  • Joined: 02-August 12

Posted 05 August 2012 - 12:50 PM

Sorted out! :)

I've read this thread (hteeteepee://stackoverflow.com/a/9405819/1203332) and found it was related to xdebug too... So I upgraded it and the problem disappeared!

Thanks anyway,


Pierre
1

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users