Welcome Guest, Not a member yet? Register   Sign In
Community Auth For CodeIgniter 3
#14

(This post was last modified: 01-05-2017, 05:11 PM by skunkbad.)

(01-05-2017, 01:30 AM)simon Wrote:
(12-27-2015, 11:55 AM)skunkbad Wrote:
(12-27-2015, 06:31 AM)Blair2004 Wrote: seems like header has already been send... some visible code has been send from server, and header() cannot work after.

Please show the full error message.

My first post, resurrecting an old post ...

I've run into what looks like the same warning message and have some info to add. My app is producing this:



Quote:A PHP Error was encountered
Severity: Warning
Message: Cannot modify header information - headers already sent by (output started at /Users/simon/Developer/CI3Test/application/controllers/Examples.php:400)
Filename: libraries/Tokens.php
Line Number: 241
Backtrace:
File: /Users/simon/Developer/CI3Test/application/libraries/Tokens.php
Line: 241
Function: setcookie


On the Examples/recover page. I've read the comments that the warning appears due to some visible code being sent or a cookie being set after the headers have been sent. I think a cookie being set is exactly the problem, but only under a certain circumstance.

I've also read the comment about a possible change to the Example code, but in my case the only change is to the user details in create_user.

I noticed that if I commented out:
echo $this->load->view('examples/page_header', '', TRUE);
in the Examples controller, the page would load without error, albeit without the header.

Looking further, this line:
echo $this->load->view('examples/recover_form', ( isset( $view_data ) ) ? $view_data : '', TRUE );
that loads the recover view, at some point in the chain of code downwards has a call to 'setcookie'. Setting a cookie after the page_header view has already been output to screen, triggers the PHP warning, and commenting page_header out prevented it, as would be expected.

Commenting out setcookie also allowed the page to load normally, even with page_header enabled again. I restored setcookie and get the warning again.

However, the warning message is only shown when the PHP error reporting level is set to do so. My project is set to 'development' with this line in index.php.
define('ENVIRONMENT', isset($_SERVER['CI_ENV']) ? $_SERVER['CI_ENV'] : 'development');

If I change 'development' to 'production', the error reporting level is set higher and the warning message is never shown.

Should I just ignore the warning, always work in production mode, make some change to the Community Auth code or perhaps something else?

- Simon


Have you done anything code-wise, or is this a straight out of the box install? If I do a basic install and switch the environment to production, there is no difference, and I don't get any errors.
Reply


Messages In This Thread
RE: Community Auth For CodeIgniter 3 - by pat M - 12-13-2015, 05:58 AM
RE: Community Auth For CodeIgniter 3 - by pat M - 12-15-2015, 10:02 AM
RE: Community Auth For CodeIgniter 3 - by prafull - 12-21-2015, 01:58 AM
RE: Community Auth For CodeIgniter 3 - by prafull - 12-22-2015, 02:13 AM
RE: Community Auth For CodeIgniter 3 - by simon - 01-05-2017, 01:30 AM
RE: Community Auth For CodeIgniter 3 - by skunkbad - 01-05-2017, 05:08 PM
RE: Community Auth For CodeIgniter 3 - by simon - 01-05-2017, 05:35 PM
RE: Community Auth For CodeIgniter 3 - by simon - 01-07-2017, 11:29 PM
RE: Community Auth For CodeIgniter 3 - by simon - 01-08-2017, 12:46 AM
RE: Community Auth For CodeIgniter 3 - by simon - 01-08-2017, 01:37 PM
RE: Community Auth For CodeIgniter 3 - by simon - 01-08-2017, 11:02 PM



Theme © iAndrew 2016 - Forum software by © MyBB