Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HandleEntrySchedule fails when Date is configured to use CarbonImmutable instead of Carbon #11239

Closed
curlytech opened this issue Dec 9, 2024 · 0 comments · Fixed by #11244
Closed

Comments

@curlytech
Copy link

Bug description

My Laravel installation is configured to use CarbonImmutable instead of Carbon as response from now().

The following code in HandleEntrySchedule therefore fails with error:

Statamic\Entries\MinuteEntries::__construct(): Argument ($minute) must be of type Carbon\Carbon, Carbon\CarbonImmutable given,

 $minute = now()->subMinute();
 return (new MinuteEntries($minute))();

How to reproduce

Configure Date to use CarbonImmutable in AppServiceProvider:

    Date::use(CarbonImmutable::class);

Logs

Dec 09 14:35:03 foo-web foo [2024-12-09 19:35:03] production.ERROR: Statamic\Entries\MinuteEntries::__construct(): Argument #1 ($minute) must be of type Carbon\Carbon, Carbon\CarbonImmutable given, called in /home/forge/foo.com/releases/20241209192844/vendor/statamic/cms/src/Jobs/HandleEntrySchedule.php on line 30 {"exception":"[object] (TypeError(code: 0): Statamic\\Entries\\MinuteEntries::__construct(): Argument #1 ($minute) must be of type Carbon\\Carbon, Carbon\\CarbonImmutable given, called in /home/forge/foo.com/releases/20241209192844/vendor/statamic/cms/src/Jobs/HandleEntrySchedule.php on line 30 at /home/forge/foo.com/releases/20241209192844/vendor/statamic/cms/src/Entries/MinuteEntries.php:11)
Dec 09 14:35:03 foo-web foo [stacktrace]
Dec 09 14:35:03 foo-web foo #0 /home/forge/foo.com/releases/20241209192844/vendor/statamic/cms/src/Jobs/HandleEntrySchedule.php(30): Statamic\\Entries\\MinuteEntries->__construct()
Dec 09 14:35:03 foo-web foo #1 /home/forge/foo.com/releases/20241209192844/vendor/statamic/cms/src/Jobs/HandleEntrySchedule.php(19): Statamic\\Jobs\\HandleEntrySchedule->entries()
Dec 09 14:35:03 foo-web foo #2 /home/forge/foo.com/releases/20241209192844/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(36): Statamic\\Jobs\\HandleEntrySchedule->handle()
Dec 09 14:35:03 foo-web foo #3 /home/forge/foo.com/releases/20241209192844/vendor/laravel/framework/src/Illuminate/Container/Util.php(43): Illuminate\\Container\\BoundMethod::Illuminate\\Container\\{closure}()
Dec 09 14:35:03 foo-web foo #4 /home/forge/foo.com/releases/20241209192844/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(95): Illuminate\\Container\\Util::unwrapIfClosure()
Dec 09 14:35:03 foo-web foo #5 /home/forge/foo.com/releases/20241209192844/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(35): Illuminate\\Container\\BoundMethod::callBoundMethod()
Dec 09 14:35:03 foo-web foo #6 /home/forge/foo.com/releases/20241209192844/vendor/laravel/framework/src/Illuminate/Container/Container.php(694): Illuminate\\Container\\BoundMethod::call()
Dec 09 14:35:03 foo-web foo #7 /home/forge/foo.com/releases/20241209192844/vendor/laravel/framework/src/Illuminate/Bus/Dispatcher.php(126): Illuminate\\Container\\Container->call()
Dec 09 14:35:03 foo-web foo #8 /home/forge/foo.com/releases/20241209192844/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(144): Illuminate\\Bus\\Dispatcher->Illuminate\\Bus\\{closure}()
Dec 09 14:35:03 foo-web foo #9 /home/forge/foo.com/releases/20241209192844/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(119): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
Dec 09 14:35:03 foo-web foo #10 /home/forge/foo.com/releases/20241209192844/vendor/laravel/framework/src/Illuminate/Bus/Dispatcher.php(130): Illuminate\\Pipeline\\Pipeline->then()
Dec 09 14:35:03 foo-web foo #11 /home/forge/foo.com/releases/20241209192844/vendor/laravel/framework/src/Illuminate/Queue/CallQueuedHandler.php(124): Illuminate\\Bus\\Dispatcher->dispatchNow()
Dec 09 14:35:03 foo-web foo #12 /home/forge/foo.com/releases/20241209192844/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(144): Illuminate\\Queue\\CallQueuedHandler->Illuminate\\Queue\\{closure}()
Dec 09 14:35:03 foo-web foo #13 /home/forge/foo.com/releases/20241209192844/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(119): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
Dec 09 14:35:03 foo-web foo #14 /home/forge/foo.com/releases/20241209192844/vendor/laravel/framework/src/Illuminate/Queue/CallQueuedHandler.php(123): Illuminate\\Pipeline\\Pipeline->then()
Dec 09 14:35:03 foo-web foo #15 /home/forge/foo.com/releases/20241209192844/vendor/laravel/framework/src/Illuminate/Queue/CallQueuedHandler.php(71): Illuminate\\Queue\\CallQueuedHandler->dispatchThroughMiddleware()
Dec 09 14:35:03 foo-web foo #16 /home/forge/foo.com/releases/20241209192844/vendor/laravel/framework/src/Illuminate/Queue/Jobs/Job.php(102): Illuminate\\Queue\\CallQueuedHandler->call()
Dec 09 14:35:03 foo-web foo #17 /home/forge/foo.com/releases/20241209192844/vendor/laravel/framework/src/Illuminate/Queue/Worker.php(441): Illuminate\\Queue\\Jobs\\Job->fire()
Dec 09 14:35:03 foo-web foo #18 /home/forge/foo.com/releases/20241209192844/vendor/laravel/framework/src/Illuminate/Queue/Worker.php(391): Illuminate\\Queue\\Worker->process()
Dec 09 14:35:03 foo-web foo #19 /home/forge/foo.com/releases/20241209192844/vendor/laravel/framework/src/Illuminate/Queue/Worker.php(178): Illuminate\\Queue\\Worker->runJob()
Dec 09 14:35:03 foo-web foo #20 /home/forge/foo.com/releases/20241209192844/vendor/laravel/framework/src/Illuminate/Queue/Console/WorkCommand.php(148): Illuminate\\Queue\\Worker->daemon()
Dec 09 14:35:03 foo-web foo #21 /home/forge/foo.com/releases/20241209192844/vendor/laravel/framework/src/Illuminate/Queue/Console/WorkCommand.php(131): Illuminate\\Queue\\Console\\WorkCommand->runWorker()
Dec 09 14:35:03 foo-web foo #22 /home/forge/foo.com/releases/20241209192844/vendor/laravel/horizon/src/Console/WorkCommand.php(51): Illuminate\\Queue\\Console\\WorkCommand->handle()
Dec 09 14:35:03 foo-web foo #23 /home/forge/foo.com/releases/20241209192844/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(36): Laravel\\Horizon\\Console\\WorkCommand->handle()
Dec 09 14:35:03 foo-web foo #24 /home/forge/foo.com/releases/20241209192844/vendor/laravel/framework/src/Illuminate/Container/Util.php(43): Illuminate\\Container\\BoundMethod::Illuminate\\Container\\{closure}()
Dec 09 14:35:03 foo-web foo #25 /home/forge/foo.com/releases/20241209192844/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(95): Illuminate\\Container\\Util::unwrapIfClosure()
Dec 09 14:35:03 foo-web foo #26 /home/forge/foo.com/releases/20241209192844/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(35): Illuminate\\Container\\BoundMethod::callBoundMethod()
Dec 09 14:35:03 foo-web foo #27 /home/forge/foo.com/releases/20241209192844/vendor/laravel/framework/src/Illuminate/Container/Container.php(694): Illuminate\\Container\\BoundMethod::call()
Dec 09 14:35:03 foo-web foo #28 /home/forge/foo.com/releases/20241209192844/vendor/laravel/framework/src/Illuminate/Console/Command.php(213): Illuminate\\Container\\Container->call()
Dec 09 14:35:03 foo-web foo #29 /home/forge/foo.com/releases/20241209192844/vendor/symfony/console/Command/Command.php(279): Illuminate\\Console\\Command->execute()
Dec 09 14:35:03 foo-web foo #30 /home/forge/foo.com/releases/20241209192844/vendor/laravel/framework/src/Illuminate/Console/Command.php(182): Symfony\\Component\\Console\\Command\\Command->run()
Dec 09 14:35:03 foo-web foo #31 /home/forge/foo.com/releases/20241209192844/vendor/symfony/console/Application.php(1094): Illuminate\\Console\\Command->run()
Dec 09 14:35:03 foo-web foo #32 /home/forge/foo.com/releases/20241209192844/vendor/symfony/console/Application.php(342): Symfony\\Component\\Console\\Application->doRunCommand()
Dec 09 14:35:03 foo-web foo #33 /home/forge/foo.com/releases/20241209192844/vendor/symfony/console/Application.php(193): Symfony\\Component\\Console\\Application->doRun()
Dec 09 14:35:03 foo-web foo #34 /home/forge/foo.com/releases/20241209192844/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php(197): Symfony\\Component\\Console\\Application->run()
Dec 09 14:35:03 foo-web foo #35 /home/forge/foo.com/releases/20241209192844/artisan(35): Illuminate\\Foundation\\Console\\Kernel->handle()
Dec 09 14:35:03 foo-web foo #36 {main}
Dec 09 14:35:03 foo-web foo "}

Environment

Laravel Version: 11.34.2
PHP Version: 8.3.14
Composer Version: 2.8.3
Environment: local
Debug Mode: ENABLED
URL: cleaneatz.test
Maintenance Mode: OFF
Timezone: UTC
Locale: en

Cache
Config: NOT CACHED
Events: NOT CACHED
Routes: NOT CACHED
Views: NOT CACHED

Drivers
Broadcasting: log
Cache: array
Database: mysql
Logs: stack / single
Mail: mailgun
Queue: sync
Session: file

Livewire
Livewire: v3.5.17

Rappasoft Laravel Livewire Tables
Version: v3.5.7

Statamic
Addons: 1
Sites: 1
Stache Watcher: Enabled
Static Caching: Disabled
Version: 5.41.0 PRO

Statamic Addons
rias/statamic-redirect: 3.8.2

Installation

Existing Laravel app

Additional details

No response

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant