Framework: [5.5.45] Method addMinutes does not exist.

Created on 3 May 2019  路  7Comments  路  Source: laravel/framework

Updating nesbot/carbon (1.36.2 => 1.37.0)
After this update session in Laravel stopped working.
BadMethodCallExceptionMethod addMinutes does not exist.
in聽Macroable.php聽line 96
at聽Carbon->__call('addMinutes',聽array(120))in聽StartSession.php聽line 203
at聽StartSession->getCookieExpirationDate()in聽StartSession.php聽line 177
at聽StartSession->addCookieToResponse(object(JsonResponse),聽object(Store))in聽StartSession.php聽line 71
at聽StartSession->handle(object(Request),聽object(Closure))in聽Pipeline.php聽line 149

needs more info

Most helpful comment

Patch released. Run composer update to get it.

All 7 comments

  • Laravel Version: 5.5.45
  • PHP Version: 7.1
  • Database Driver & Version: MySQL 5.7.23

Description:

Illuminate\Support\Carbon does not seem to extend properly on Carbon\Carbon or something with Illuminate\Support\Traits\Macroable.

BadMethodCallExceptionMethod get thrown in Illuminate\Support\Traits\Macroable when it runs its magic __call-method.
Illuminate\Session\Middleware\StartSession\getCookieExpirationDate() where it tries to run addMinutes.

Steps To Reproduce:

>>> Carbon\Carbon::now()->addMinutes(120);
=> Carbon\Carbon @1556883383 {#4145
     date: 2019-05-03 13:36:23.282898 Europe/Stockholm (+02:00),
   }
>>> Illuminate\Support\Carbon::now()->addMinutes(120);
BadMethodCallException with message 'Method addMinutes does not exist.'

Please fill out the issue template when posting bug reports.

+1, just after a composer update, the problem has appeared.
I tried to smash the vendor and to rebuild it but it does not change anything.
To reproduce the problem, you just have to execute a php artisan queue:restart in Laravel 5.5 and with php7.1 for example.
The following error is thrown :

In Macroable.php line 96:

  Method addSeconds does not exist.

It has something to do with Carbon version 1.37.0. Installing 1.36.2 and clearing the bootstrap/cache folder fixes it. Have not found out what it is in Carbon 1.37.0 that causes it yet.

Edit:
Reported and seems to be an issue with mixed release tags, 1.37.0 contains breaking changes from 2.0.
https://github.com/briannesbitt/Carbon/issues/1708

Carbon tag removed, a new tag will replace it soon

Patch released. Run composer update to get it.

Going to close this then since it's a carbon issue.

@kylekatarnls thanks for looking into this so quickly 馃憤

Was this page helpful?
0 / 5 - 0 ratings

Related issues

gabriellimo picture gabriellimo  路  3Comments

SachinAgarwal1337 picture SachinAgarwal1337  路  3Comments

Anahkiasen picture Anahkiasen  路  3Comments

lzp819739483 picture lzp819739483  路  3Comments

RomainSauvaire picture RomainSauvaire  路  3Comments