E-mail component rendering a template fails with no error message
Hi there, Summary: when using EmailComponent I bump into a strange problem in the View class. Using CakePHP 1.3.0.0. I'm using EmailComponent in a very standard way. In my controller I have: $this-Email-to = 's...@email.com'; $this-Email-from = 'some.ot...@email.com'; $this-Email-subject = 'Message Subject'; $this-Email-template = 'template_name'; // under views/elements/ email/text/template_name.ctp $this-Email-sendAs = 'text' ; $this-Email-send(); The template exists and is just plain text, no special characters. This leads to a blank page, regardless of the E_ALL error reporting level. So I go down into the Email component class, adding die(here) calls and find out it fails on line 461: $content = explode(\n, str_replace(array(\r\n, \r), \n, $View- renderLayout($content))); Now I go to $View-renderLayout() and add the same die(here) calls there, and realize the problem is actually happening right before line 747, which is odd, because it's just: return $out; The thing is that if I do debug($out) right before 747, it outputs the message perfectly, but in the normal flow of the class, it just breaks and returns me a blank screen after some 5 seconds hanging, with no error neither on the screen or the logs. I tried everything and have absolutely no idea what to do from here. I fiddled with all the parameters, renamed the template, changed it's content, nothing works. It only works when I remove the $this-Email- template line and do like $this-Email-send('any text), but that's no good, obviously. One more curious thing: if above view.php:498 I add debug($data_for_layout); it fails in the exact same way (the request hangs for some 5 seconds and returns blank), but if I try pr($data_for_layout); it prints it's contents perfectly. Just thought this could be useful. Thank you so much for your attention, Bruno PS: I searched thoroughly for this both here and on Google, with no luck, so please forgive me if it's been answered already. --~--~-~--~~~---~--~~ 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 cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: E-mail component rendering a template fails with no error message
On Fri, Oct 9, 2009 at 1:02 AM, Bruno Bergher bruno.berg...@gmail.com wrote: Hi there, Summary: when using EmailComponent I bump into a strange problem in the View class. Using CakePHP 1.3.0.0. I'm using EmailComponent in a very standard way. In my controller I have: $this-Email-to = 's...@email.com'; $this-Email-from = 'some.ot...@email.com'; $this-Email-subject = 'Message Subject'; $this-Email-template = 'template_name'; // under views/elements/ email/text/template_name.ctp $this-Email-sendAs = 'text' ; $this-Email-send(); The template exists and is just plain text, no special characters. This leads to a blank page, regardless of the E_ALL error reporting level. So I go down into the Email component class, adding die(here) calls and find out it fails on line 461: $content = explode(\n, str_replace(array(\r\n, \r), \n, $View- renderLayout($content))); Now I go to $View-renderLayout() and add the same die(here) calls there, and realize the problem is actually happening right before line 747, which is odd, because it's just: return $out; So renderLayout() is probably fine. If you add: die($View-renderLayout($content)); just before line 461 in the component, what do you get? Other things to check around that line: $content -- before the explode() call $View-layoutPath The thing is that if I do debug($out) right before 747, it outputs the message perfectly, but in the normal flow of the class, it just breaks and returns me a blank screen after some 5 seconds hanging, with no error neither on the screen or the logs. I tried everything and have absolutely no idea what to do from here. I fiddled with all the parameters, renamed the template, changed it's content, nothing works. It only works when I remove the $this-Email- template line and do like $this-Email-send('any text), but that's no good, obviously. One more curious thing: if above view.php:498 I add debug($data_for_layout); it fails in the exact same way (the request hangs for some 5 seconds and returns blank), but if I try pr($data_for_layout); it prints it's contents perfectly. Just thought this could be useful. That's likely just because debug has been set to 0 before that. --~--~-~--~~~---~--~~ 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 cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: E-mail component rendering a template fails with no error message
Hey Brian, Thanks for answering. die($content) returns the message, in pristine condition : ) die($View-layoutPath) returns the correct path, email/text die($View-renderLayout($content)) oddly returns: Fatal error: Call to a member function entity() on a non-object in (...)/cake/libs/view/helper.php on line 339 I'm not sure where to go from there. I can't find any calls to this method anywere in either the EmailComponent or the View class. And I checked the debug level in that line, it'ss 2. Going deeper, it's as if the debug_backtrace() call in debug() goes into infinite recursion or something, so PHP just gives up and returns nothing. Thanks again, Bruno On Oct 9, 1:18 pm, brian bally.z...@gmail.com wrote: On Fri, Oct 9, 2009 at 1:02 AM, Bruno Bergher bruno.berg...@gmail.com wrote: Hi there, Summary: when using EmailComponent I bump into a strange problem in the View class. Using CakePHP 1.3.0.0. I'm using EmailComponent in a very standard way. In my controller I have: $this-Email-to = 's...@email.com'; $this-Email-from = 'some.ot...@email.com'; $this-Email-subject = 'Message Subject'; $this-Email-template = 'template_name'; // under views/elements/ email/text/template_name.ctp $this-Email-sendAs = 'text' ; $this-Email-send(); The template exists and is just plain text, no special characters. This leads to a blank page, regardless of the E_ALL error reporting level. So I go down into the Email component class, adding die(here) calls and find out it fails on line 461: $content = explode(\n, str_replace(array(\r\n, \r), \n, $View- renderLayout($content))); Now I go to $View-renderLayout() and add the same die(here) calls there, and realize the problem is actually happening right before line 747, which is odd, because it's just: return $out; So renderLayout() is probably fine. If you add: die($View-renderLayout($content)); just before line 461 in the component, what do you get? Other things to check around that line: $content -- before the explode() call $View-layoutPath The thing is that if I do debug($out) right before 747, it outputs the message perfectly, but in the normal flow of the class, it just breaks and returns me a blank screen after some 5 seconds hanging, with no error neither on the screen or the logs. I tried everything and have absolutely no idea what to do from here. I fiddled with all the parameters, renamed the template, changed it's content, nothing works. It only works when I remove the $this-Email- template line and do like $this-Email-send('any text), but that's no good, obviously. One more curious thing: if above view.php:498 I add debug($data_for_layout); it fails in the exact same way (the request hangs for some 5 seconds and returns blank), but if I try pr($data_for_layout); it prints it's contents perfectly. Just thought this could be useful. That's likely just because debug has been set to 0 before that. --~--~-~--~~~---~--~~ 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 cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---