user1109464
user1109464

Reputation: 64

Laravel setcookie() expects parameter 3 to be integer, float given

I'm using Laravel 5.2, and I'm getting this error on first page. What is this error and how should I solve it?

ErrorException in Response.php line 348:
setcookie() expects parameter 3 to be integer, float given
in Response.php line 348
at HandleExceptions->handleError('2', 'setcookie() expects parameter 3 to be integer, float given', '/var/www/dev/vendor/symfony/http-foundation/Response.php', '348', array('this' => object(Response), 'values' => array('Sat, 07 Oct 2017 08:31:17 GMT'), 'name' => 'Date', 'value' => 'Sat, 07 Oct 2017 08:31:17 GMT', 'cookie' => object(Cookie)))
at setcookie('XSRF-TOKEN', 'eyJpdiI6InVMSlFsWGl3VzBcL3J5TEh6K3JZYU5BPT0iLCJ2YWx1ZSI6IlRnbitTUWNOWGNaZjE5MlJoVk1iWHJlQmR6U0xjMmNQME9BWDRoNDN2Q2NqWStoK3grQ2l4NGRnMXBZdHJ2b0NNVXZZdElvRXE3OWhvcVhiVGx5b3NBPT0iLCJtYWMiOiJkYmU3MDUyMzZkMTk4NTcwYmE1MTA0NWY0Njk5MDhkNzhlZDlmNTMzZjRjOGNkNGZhNmFmODk5ZWZkOGE2NWJmIn0=', '130356383897', '/', null, false, false) in Response.php line 348
at Response->sendHeaders() in Response.php line 373
at Response->send() in index.php line 56

Upvotes: 0

Views: 3924

Answers (1)

Alexey Mezenin
Alexey Mezenin

Reputation: 163948

The third parameter must be int.

Just convert the third parameter to int:

setcookie($name, $value, (int)$expire)

Upvotes: 3

Related Questions