Answers.Body: <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>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-08-22T17:38:46.107Z
Answers.LastActivityDate: 2016-08-22T17:38:46.107Z
Answers.UserDisplayName: Brad Bell
Body: <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>
  
Tags: <error-message><globals><custom-field>
Title: Failed to add a custom field in settings
ThreadText: # 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</b>
  : Declaration of Craft\UserSessionService::login($username, $password, $rememberMe = false) should be compatible with CWebUser::login($identity, $duration = 0) in
  <b>/Applications/MAMP/htdocs/craft-app/2.6.2791/services/UserSessionService.php</b>
  on line
  <b>17</b>
  <br>
  <br>
  <b>Warning</b>
  : Declaration of Craft\UserSessionService::afterLogin() should be compatible with CWebUser::afterLogin($fromCookie) in
  <b>/Applications/MAMP/htdocs/craft-app/2.6.2791/services/UserSessionService.php</b>
  on line
  <b>17</b>
  <br>
  <br>
  <b>Warning</b>
  : Cannot modify header information - headers already sent by (output started at /Applications/MAMP/htdocs/craft-app/2.6.2791/services/UserSessionService.php:17) in
  <b>/Applications/MAMP/htdocs/craft-app/2.6.2791/framework/web/CHttpRequest.php</b>
  on line
  <b>1519</b>
  <br>
  <br>
  <b>Warning</b>
  : Cannot modify header information - headers already sent by (output started at /Applications/MAMP/htdocs/craft-app/2.6.2791/services/UserSessionService.php:17) in
  <b>/Applications/MAMP/htdocs/craft-app/2.6.2791/framework/web/CHttpRequest.php</b>
  on line
  <b>1507</b>`
  
  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.
  
  
  ---
  
  