<p>You're getting that error message because your PHP environment is displaying <a href="https://secure.php.net/manual/en/errorfunc.configuration.php#ini.error-reporting" rel="nofollow">PHP Strict mode</a> error messages.</p>

<p>By default, Craft will explicitly disable those if <a href="https://craftcms.com/docs/config-settings#devMode" rel="nofollow">devMode</a> is enabled (<code>error_reporting(E_ALL &amp; ~E_STRICT);</code>) and disable all messages if devMode is disabled (<code>error_reporting(0);</code>).</p>

<p>So my guess is you've either got a plugin that's messing with error_reporting and re-enabling strict messages or you've doing it from your public <code>index.php</code> or <code>craft/config</code> files.</p>

<p>Note that in the upcoming Craft 3, we've made it so that you can run Craft with PHP strict error messaging enabled.</p>

CC BY-SA 3.0
2016-08-22T17:38:46.107Z
2016-08-22T17:38:46.107Z
Brad Bell
<p>I'm trying to add a global set, with a Matrix and two required fields for a product. This always works.</p>

<p>Now that I am in version 2.6.2791 it fails to add the fields with error:</p>

<p><code>
Warning&lt;/b&gt;
: Declaration of Craft\UserSessionService::login($username, $password, $rememberMe = false) should be compatible with CWebUser::login($identity, $duration = 0) in
&lt;b&gt;/Applications/MAMP/htdocs/craft-app/2.6.2791/services/UserSessionService.php&lt;/b&gt;
on line
&lt;b&gt;17&lt;/b&gt;
&lt;br&gt;
&lt;br&gt;
&lt;b&gt;Warning&lt;/b&gt;
: Declaration of Craft\UserSessionService::afterLogin() should be compatible with CWebUser::afterLogin($fromCookie) in
&lt;b&gt;/Applications/MAMP/htdocs/craft-app/2.6.2791/services/UserSessionService.php&lt;/b&gt;
on line
&lt;b&gt;17&lt;/b&gt;
&lt;br&gt;
&lt;br&gt;
&lt;b&gt;Warning&lt;/b&gt;
: Cannot modify header information - headers already sent by (output started at /Applications/MAMP/htdocs/craft-app/2.6.2791/services/UserSessionService.php:17) in
&lt;b&gt;/Applications/MAMP/htdocs/craft-app/2.6.2791/framework/web/CHttpRequest.php&lt;/b&gt;
on line
&lt;b&gt;1519&lt;/b&gt;
&lt;br&gt;
&lt;br&gt;
&lt;b&gt;Warning&lt;/b&gt;
: Cannot modify header information - headers already sent by (output started at /Applications/MAMP/htdocs/craft-app/2.6.2791/services/UserSessionService.php:17) in
&lt;b&gt;/Applications/MAMP/htdocs/craft-app/2.6.2791/framework/web/CHttpRequest.php&lt;/b&gt;
on line
&lt;b&gt;1507&lt;/b&gt;
</code></p>

<p>The CSRF token could not be validated.</p>

<p>Any ideas or fixes would be great!</p>

<error-message><globals><custom-field>
Failed to add a custom field in settings
# Failed to add a custom field in settings

(Asked by: username_0 on 2016-08-22)

I'm trying to add a global set, with a Matrix and two required fields for a product. This always works.

Now that I am in version 2.6.2791 it fails to add the fields with error:

`Warning
: Declaration of Craft\UserSessionService::login($username, $password, $rememberMe = false) should be compatible with CWebUser::login($identity, $duration = 0) in
/Applications/MAMP/htdocs/craft-app/2.6.2791/services/UserSessionService.php
on line
17
  
  
Warning
: Declaration of Craft\UserSessionService::afterLogin() should be compatible with CWebUser::afterLogin($fromCookie) in
/Applications/MAMP/htdocs/craft-app/2.6.2791/services/UserSessionService.php
on line
17
  
  
Warning
: Cannot modify header information - headers already sent by (output started at /Applications/MAMP/htdocs/craft-app/2.6.2791/services/UserSessionService.php:17) in
/Applications/MAMP/htdocs/craft-app/2.6.2791/framework/web/CHttpRequest.php
on line
1519
  
  
Warning
: Cannot modify header information - headers already sent by (output started at /Applications/MAMP/htdocs/craft-app/2.6.2791/services/UserSessionService.php:17) in
/Applications/MAMP/htdocs/craft-app/2.6.2791/framework/web/CHttpRequest.php
on line
1507`

The CSRF token could not be validated.

Any ideas or fixes would be great!

**Tags:** error-message, globals, custom-field


---

## 1 answers

### Answer by username_1 on 2016-08-22. Score: 2 | Accepted answer

You're getting that error message because your PHP environment is displaying [PHP Strict mode](https://secure.php.net/manual/en/errorfunc.configuration.php#ini.error-reporting) error messages.

By default, Craft will explicitly disable those if [devMode](https://craftcms.com/docs/config-settings#devMode) is enabled (`error_reporting(E_ALL & ~E_STRICT);`) and disable all messages if devMode is disabled (`error_reporting(0);`).

So my guess is you've either got a plugin that's messing with error\_reporting and re-enabling strict messages or you've doing it from your public `index.php` or `craft/config` files.

Note that in the upcoming Craft 3, we've made it so that you can run Craft with PHP strict error messaging enabled.


---

