Uncaught Nette\InvalidStateException: Invalid value in $_POST/$_COOKIE in key ‘_acf_nonce’, expected string, b

Thommato
Member | 1
+
0
-

Dear Sir/Madam,

I'm using Nette Forms as setup form for a other form that will show up after the first submit of the Nette form.

Uncaught Nette\InvalidStateException: Invalid value in $_POST/$_COOKIE in key ‘_acf_nonce’, expected string, boolean given.

I'm using the default set-up, like: https://doc.nette.org/…s/standalone

Green
Member | 5
+
0
-

I have same error, any solution for this?

David Grudl
Nette Core | 8129
+
0
-

It seems that some library is modifying $_COOKIE. Try to call Nette\Forms\Form::initialize() at the beginning of the script.

janpot
Member | 2
+
0
-

What is the reason you require strings in the cookie? I have a problem with a third-party plugin that writes an integer directly to the $_COOKIE.

Marek Bartoš
Nette Blogger | 1167
+
+2
-

$_COOKIE values are supposed to come from http request cookie headers and are always string. $_COOKIE should be read-only for userland code.

janpot
Member | 2
+
0
-

I agree but found only a little evidence for that in PHP documentation – So is it possible to say never assign directly, use setcookie?

mystik
Member | 291
+
+2
-

Assign cookie to $_COOKIES will not set cookie because it is array of received cookies. If you want to set cookie you must use setcookie.

Marek Bartoš
Nette Blogger | 1167
+
+2
-

Currently not, imho it should be handled by a RFC for php-src
In the meanwhile it should be fixed on the plugin side, expectation of Nette is correct