Re: redirect and header error but no white space
On Jul 17, 6:01 pm, Stinkbug <[EMAIL PROTECTED]> wrote: > I tried removing the ?> from my files, but that didn't seem to help. > I don't have a space at the end of ?> on any of my files anyway. This > same exact code worked under cake 1.1, but it isn't in 1.2. > > I also did some searching online and found an application called > BabelPad that would save utf-8 files without BOM. I tried that. All > of my files appeared to be saved without BOM, but I resaved them > anyway, just in case. > > Still didn't work. I've narrowed the problem down to one line of > code. > > $this->Post->Department->find("Department.id = " . $this->data['Post'] > ['department_id'], array(), null, 1); > > Then further down I have a redirect. The line above is a simple query > to the database. I can comment this line out and the application > redirects like it should. If I try to use this line, I get the header > could not be sent error. > > This model is associated with two other models. The User model and > Post model. I'm unbinding the Post model so the only data being > fetched is Department and user. In the find method above, if I set > recursive to 0 the application redirects like it should (just grabbing > the department data). Set to 1 it grabs the User data as well, but > then I get the header can't be sent error. > > I'm still trying to narrow the problem down. If anyone has any > suggestions, I'd appreciate it though. Read the error message. if there is no error message enable debug. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: redirect and header error but no white space
The problem appears to be with an LDAP integration that I have in my User Model. A Temporary solution... Disable it. Once I figure out what the problem is, I'll try and remember to post that information here. On Jul 18, 9:04 am, Stinkbug <[EMAIL PROTECTED]> wrote: > @franky091 I tried modifying the find method, but that didn't seem to > make a difference either. I believe the manual says that I can do it > the way I had it anyway. I'm just looking for one record anyway. > > @AD7six The error I'm receiving is: > > Warning (2): Cannot modify header information - headers already sent > by (output started at C:\wamp\www\intranet\cake\basics.php:262) [CORE > \cake\libs\controller\controller.php, line 577] > > Code | Context > > $status = "Location:http://jthomas/contents"; > > header - [internal], line ?? > Controller::header() - CORE\cake\libs\controller\controller.php, line > 577 > Controller::redirect() - CORE\cake\libs\controller\controller.php, > line 558 > PostsController::step2() - APP\controllers\posts_controller.php, line > 105 > Object::dispatchMethod() - CORE\cake\libs\object.php, line 114 > Dispatcher::_invoke() - CORE\cake\dispatcher.php, line 256 > Dispatcher::dispatch() - CORE\cake\dispatcher.php, line 230 > [main] - APP\webroot\index.php, line 90 > > The location is the page I'm trying to redirect to. I'm still looking > into the issue. Surely something has to be causing it. > > On Jul 18, 2:11 am, AD7six <[EMAIL PROTECTED]> wrote: > > > On Jul 17, 6:01 pm, Stinkbug <[EMAIL PROTECTED]> wrote: > > > > I tried removing the ?> from my files, but that didn't seem to help. > > > I don't have a space at the end of ?> on any of my files anyway. This > > > same exact code worked under cake 1.1, but it isn't in 1.2. > > > > I also did some searching online and found an application called > > > BabelPad that would save utf-8 files without BOM. I tried that. All > > > of my files appeared to be saved without BOM, but I resaved them > > > anyway, just in case. > > > > Still didn't work. I've narrowed the problem down to one line of > > > code. > > > > $this->Post->Department->find("Department.id = " . $this->data['Post'] > > > ['department_id'], array(), null, 1); > > > > Then further down I have a redirect. The line above is a simple query > > > to the database. I can comment this line out and the application > > > redirects like it should. If I try to use this line, I get the header > > > could not be sent error. > > > > This model is associated with two other models. The User model and > > > Post model. I'm unbinding the Post model so the only data being > > > fetched is Department and user. In the find method above, if I set > > > recursive to 0 the application redirects like it should (just grabbing > > > the department data). Set to 1 it grabs the User data as well, but > > > then I get the header can't be sent error. > > > > I'm still trying to narrow the problem down. If anyone has any > > > suggestions, I'd appreciate it though. > > > Read the error message. if there is no error message enable debug. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: redirect and header error but no white space
@franky091 I tried modifying the find method, but that didn't seem to make a difference either. I believe the manual says that I can do it the way I had it anyway. I'm just looking for one record anyway. @AD7six The error I'm receiving is: Warning (2): Cannot modify header information - headers already sent by (output started at C:\wamp\www\intranet\cake\basics.php:262) [CORE \cake\libs\controller\controller.php, line 577] Code | Context $status = "Location: http://jthomas/contents"; header - [internal], line ?? Controller::header() - CORE\cake\libs\controller\controller.php, line 577 Controller::redirect() - CORE\cake\libs\controller\controller.php, line 558 PostsController::step2() - APP\controllers\posts_controller.php, line 105 Object::dispatchMethod() - CORE\cake\libs\object.php, line 114 Dispatcher::_invoke() - CORE\cake\dispatcher.php, line 256 Dispatcher::dispatch() - CORE\cake\dispatcher.php, line 230 [main] - APP\webroot\index.php, line 90 The location is the page I'm trying to redirect to. I'm still looking into the issue. Surely something has to be causing it. On Jul 18, 2:11 am, AD7six <[EMAIL PROTECTED]> wrote: > On Jul 17, 6:01 pm, Stinkbug <[EMAIL PROTECTED]> wrote: > > > > > I tried removing the ?> from my files, but that didn't seem to help. > > I don't have a space at the end of ?> on any of my files anyway. This > > same exact code worked under cake 1.1, but it isn't in 1.2. > > > I also did some searching online and found an application called > > BabelPad that would save utf-8 files without BOM. I tried that. All > > of my files appeared to be saved without BOM, but I resaved them > > anyway, just in case. > > > Still didn't work. I've narrowed the problem down to one line of > > code. > > > $this->Post->Department->find("Department.id = " . $this->data['Post'] > > ['department_id'], array(), null, 1); > > > Then further down I have a redirect. The line above is a simple query > > to the database. I can comment this line out and the application > > redirects like it should. If I try to use this line, I get the header > > could not be sent error. > > > This model is associated with two other models. The User model and > > Post model. I'm unbinding the Post model so the only data being > > fetched is Department and user. In the find method above, if I set > > recursive to 0 the application redirects like it should (just grabbing > > the department data). Set to 1 it grabs the User data as well, but > > then I get the header can't be sent error. > > > I'm still trying to narrow the problem down. If anyone has any > > suggestions, I'd appreciate it though. > > Read the error message. if there is no error message enable debug. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: redirect and header error but no white space
CHeck the syntax of "find", if you use 1.2, you should do something like this: $this->Post->Department->find("all", array("conditions" => "Department.id = " . $this->data['Post'] ['department_id'], "recursive" => 1)); I guess you problem comes from the "find" throwing some errors before you render/redirect. hth On Jul 17, 6:01 pm, Stinkbug <[EMAIL PROTECTED]> wrote: > I tried removing the ?> from my files, but that didn't seem to help. > I don't have a space at the end of ?> on any of my files anyway. This > same exact code worked under cake 1.1, but it isn't in 1.2. > > I also did some searching online and found an application called > BabelPad that would save utf-8 files without BOM. I tried that. All > of my files appeared to be saved without BOM, but I resaved them > anyway, just in case. > > Still didn't work. I've narrowed the problem down to one line of > code. > > $this->Post->Department->find("Department.id = " . $this->data['Post'] > ['department_id'], array(), null, 1); > > Then further down I have a redirect. The line above is a simple query > to the database. I can comment this line out and the application > redirects like it should. If I try to use this line, I get the header > could not be sent error. > > This model is associated with two other models. The User model and > Post model. I'm unbinding the Post model so the only data being > fetched is Department and user. In the find method above, if I set > recursive to 0 the application redirects like it should (just grabbing > the department data). Set to 1 it grabs the User data as well, but > then I get the header can't be sent error. > > I'm still trying to narrow the problem down. If anyone has any > suggestions, I'd appreciate it though. > > On Jul 17, 9:06 am, RichardAtHome <[EMAIL PROTECTED]> wrote: > > > You can save yourself a *lot* of heartache with this issue by leaving > > off the closing ?> in your php files :-) > > > --- snip --- > > > class TestController extends AppController { > > > function index() { > > > } > > } > > > ---end snip--- > > > is enough, the closing ?> is optional > > > On Jul 17, 2:20 pm, haj <[EMAIL PROTECTED]> wrote: > > > > I'm using this editor on windows: > > > >http://www.emeditor.com/ > > > > There is a checkbox in config menu if to add BOM or not for UTF-8. > > > Some editor may not have this feature. > > > > On Jul 16, 1:07 pm, Stinkbug <[EMAIL PROTECTED]> wrote: > > > > > Excuse my stupidity on this topic, but I don't really understand > > > > encoding at all. So how exactly do I save a a file without the BOM? > > > > > Does it require special software, or what? I'm on windows. > > > > > On Jul 14, 11:39 pm, haj <[EMAIL PROTECTED]> wrote: > > > > > > So, I basically saved all UTF-8 files without BOM and now things works > > > > > beautifully. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: redirect and header error but no white space
I tried removing the ?> from my files, but that didn't seem to help. I don't have a space at the end of ?> on any of my files anyway. This same exact code worked under cake 1.1, but it isn't in 1.2. I also did some searching online and found an application called BabelPad that would save utf-8 files without BOM. I tried that. All of my files appeared to be saved without BOM, but I resaved them anyway, just in case. Still didn't work. I've narrowed the problem down to one line of code. $this->Post->Department->find("Department.id = " . $this->data['Post'] ['department_id'], array(), null, 1); Then further down I have a redirect. The line above is a simple query to the database. I can comment this line out and the application redirects like it should. If I try to use this line, I get the header could not be sent error. This model is associated with two other models. The User model and Post model. I'm unbinding the Post model so the only data being fetched is Department and user. In the find method above, if I set recursive to 0 the application redirects like it should (just grabbing the department data). Set to 1 it grabs the User data as well, but then I get the header can't be sent error. I'm still trying to narrow the problem down. If anyone has any suggestions, I'd appreciate it though. On Jul 17, 9:06 am, RichardAtHome <[EMAIL PROTECTED]> wrote: > You can save yourself a *lot* of heartache with this issue by leaving > off the closing ?> in your php files :-) > > --- snip --- > class TestController extends AppController { > > function index() { > > } > } > > ---end snip--- > > is enough, the closing ?> is optional > > On Jul 17, 2:20 pm, haj <[EMAIL PROTECTED]> wrote: > > > I'm using this editor on windows: > > >http://www.emeditor.com/ > > > There is a checkbox in config menu if to add BOM or not for UTF-8. > > Some editor may not have this feature. > > > On Jul 16, 1:07 pm, Stinkbug <[EMAIL PROTECTED]> wrote: > > > > Excuse my stupidity on this topic, but I don't really understand > > > encoding at all. So how exactly do I save a a file without the BOM? > > > > Does it require special software, or what? I'm on windows. > > > > On Jul 14, 11:39 pm, haj <[EMAIL PROTECTED]> wrote: > > > > > So, I basically saved all UTF-8 files without BOM and now things works > > > > beautifully. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: redirect and header error but no white space
You can save yourself a *lot* of heartache with this issue by leaving off the closing ?> in your php files :-) --- snip --- is optional On Jul 17, 2:20 pm, haj <[EMAIL PROTECTED]> wrote: > I'm using this editor on windows: > > http://www.emeditor.com/ > > There is a checkbox in config menu if to add BOM or not for UTF-8. > Some editor may not have this feature. > > On Jul 16, 1:07 pm, Stinkbug <[EMAIL PROTECTED]> wrote: > > > Excuse my stupidity on this topic, but I don't really understand > > encoding at all. So how exactly do I save a a file without the BOM? > > > Does it require special software, or what? I'm on windows. > > > On Jul 14, 11:39 pm, haj <[EMAIL PROTECTED]> wrote: > > > > So, I basically saved all UTF-8 files without BOM and now things works > > > beautifully. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: redirect and header error but no white space
I'm using this editor on windows: http://www.emeditor.com/ There is a checkbox in config menu if to add BOM or not for UTF-8. Some editor may not have this feature. On Jul 16, 1:07 pm, Stinkbug <[EMAIL PROTECTED]> wrote: > Excuse my stupidity on this topic, but I don't really understand > encoding at all. So how exactly do I save a a file without the BOM? > > Does it require special software, or what? I'm on windows. > > On Jul 14, 11:39 pm, haj <[EMAIL PROTECTED]> wrote: > > > So, I basically saved all UTF-8 files without BOM and now things works > > beautifully. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: redirect and header error but no white space
Excuse my stupidity on this topic, but I don't really understand encoding at all. So how exactly do I save a a file without the BOM? Does it require special software, or what? I'm on windows. On Jul 14, 11:39 pm, haj <[EMAIL PROTECTED]> wrote: > So, I basically saved all UTF-8 files without BOM and now things works > beautifully. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: redirect and header error but no white space
hi, thanks to publish your results with that bug. see ya! On Jul 15, 1:39 am, haj <[EMAIL PROTECTED]> wrote: > So, I basically saved all UTF-8 files without BOM and now things works > beautifully. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: redirect and header error but no white space
So, I basically saved all UTF-8 files without BOM and now things works beautifully. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: redirect and header error but no white space
Ok, it looks like this php bug is involved. I have been ignorant about this totally.. http://bugs.php.net/bug.php?id=22108 --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: redirect and header error but no white space
Well, I might find a light in some direction... the model file was written and saved in UTF-8 (all else are UTF-8, too, tho) but when I change this to not UTF-8, it looks working... I feel this very hairly... --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: redirect and header error but no white space
Darn, I can't locate what's wrong! Although I was mostly certain about not having extra space or funky control code hidden somewhere in the code, I just copied 1.2 RC2 to a new directory and set up only 3 files for the test - model/controller/ view. And they're like this: article.php (model): article_controller.php (controller): redirect('/articles/index'); } function index() { } }?> index.ctp (view): link('GO', '/articles/go'); ?> Then clicking "GO" from /articles page still gives me: Warning (2): Cannot modify header information - headers already sent by (output started at C:\Program Files\Apache Group\Apache2\htdocs \caketest\app\controllers\articles_controller.php:1) [CORE\cake\libs \controller\controller.php, line 577] Damn, I feel very stupid, I've never had this problem with various 1.1 productions (using lots of redirect) in the last years. There can be no since white space before or after or ctr code etc since I'm setting my editor any ctr char visible. I may yet somehow stupid in this less than 10 lines of total code but do feel something ELSE is the problem. I'm hosting this on local XP with Apache2.0.59/PHP4.3.4, MySQL4.0.20 if this info helps anything. Could someone suggest me how I could perhaps locate WHERE this damn header must have been sent?! --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: redirect and header error but no white space
Thanks for your reply. It doesn't look like end of file for I usually make return code etc visible on my editor but I should check again anyways. Yes, I'm running it on the XP, and basically all files are UTF-8... If anything I'm missing people could think of, I'd appreciate any input. On Jul 10, 11:24 pm, lucaspirola <[EMAIL PROTECTED]> wrote: > i re-create all structure and works fine, > > maybe its something wih end of file or encoding of file, > or windows :S > > any other news i post here > > see ya! > > On Jul 10, 11:28 pm, lucaspirola <[EMAIL PROTECTED]> wrote: > > > wow, > > i got the same problem, > > and that surprise because app > > was fine... > > > any news about this problem? > > > thks! > > > On Jul 8, 11:00 pm, haj <[EMAIL PROTECTED]> wrote: > > > > Hi, > > > > Using 1.2 and I'm doing a simple model saving page then $this- > > > > >redirect(), I get the header error telling: > > > > Warning (2): Cannot modify header information - headers already sent > > > by (output started at C:\Program Files\Apache Group\Apache2\htdocs\eco > > > \app\controllers\shippers_controller.php:1) [CORE\cake\libs\controller > > > \controller.php,line577] > > > > Searched the group and found info about spaces, I checked any extra > > > white space in the beginning or ending of shippers_controller.php or > > > related model files, find nothing. In my editor I can visual control > > > code so it's not there. I also tried to remove the last ?> from > > > shippers_controller.php file but same error remain. > > > > Any idea? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: redirect and header error but no white space
i re-create all structure and works fine, maybe its something wih end of file or encoding of file, or windows :S any other news i post here see ya! On Jul 10, 11:28 pm, lucaspirola <[EMAIL PROTECTED]> wrote: > wow, > i got the same problem, > and that surprise because app > was fine... > > any news about this problem? > > thks! > > On Jul 8, 11:00 pm, haj <[EMAIL PROTECTED]> wrote: > > > Hi, > > > Using 1.2 and I'm doing a simple model saving page then $this- > > > >redirect(), I get the header error telling: > > > Warning (2): Cannot modify header information - headers already sent > > by (output started at C:\Program Files\Apache Group\Apache2\htdocs\eco > > \app\controllers\shippers_controller.php:1) [CORE\cake\libs\controller > > \controller.php,line577] > > > Searched the group and found info about spaces, I checked any extra > > white space in the beginning or ending of shippers_controller.php or > > related model files, find nothing. In my editor I can visual control > > code so it's not there. I also tried to remove the last ?> from > > shippers_controller.php file but same error remain. > > > Any idea? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: redirect and header error but no white space
wow, i got the same problem, and that surprise because app was fine... any news about this problem? thks! On Jul 8, 11:00 pm, haj <[EMAIL PROTECTED]> wrote: > Hi, > > Using 1.2 and I'm doing a simple model saving page then $this- > > >redirect(), I get the header error telling: > > Warning (2): Cannot modify header information - headers already sent > by (output started at C:\Program Files\Apache Group\Apache2\htdocs\eco > \app\controllers\shippers_controller.php:1) [CORE\cake\libs\controller > \controller.php,line577] > > Searched the group and found info about spaces, I checked any extra > white space in the beginning or ending of shippers_controller.php or > related model files, find nothing. In my editor I can visual control > code so it's not there. I also tried to remove the last ?> from > shippers_controller.php file but same error remain. > > Any idea? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
redirect and header error but no white space
Hi, Using 1.2 and I'm doing a simple model saving page then $this- >redirect(), I get the header error telling: Warning (2): Cannot modify header information - headers already sent by (output started at C:\Program Files\Apache Group\Apache2\htdocs\eco \app\controllers\shippers_controller.php:1) [CORE\cake\libs\controller \controller.php, line 577] Searched the group and found info about spaces, I checked any extra white space in the beginning or ending of shippers_controller.php or related model files, find nothing. In my editor I can visual control code so it's not there. I also tried to remove the last ?> from shippers_controller.php file but same error remain. Any idea? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---