Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

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

Error when running queues #51068

Closed
sklr opened this issue Apr 15, 2024 · 5 comments
Closed

Error when running queues #51068

sklr opened this issue Apr 15, 2024 · 5 comments

Comments

@sklr
Copy link

sklr commented Apr 15, 2024

Laravel Version

11.3.1

PHP Version

8.3.6

Database Driver & Version

No response

Description

When I run a queue with php artisan queue:work no error is displayed in CLI, but in storage/logs/laravel.log there is multiple:

[2024-04-15 13:33:19] local.ERROR: abs(): Argument #1 ($num) must be of type int|float, string given {"exception":"[object] (TypeError(code: 0): abs(): Argument #1 ($num) must be of type int|float, string given at /var/www/example.com/vendor/nesbot/carbon/src/Carbon/Traits/Units.php:162)
[stacktrace]
#0 /var/www/example.com/vendor/nesbot/carbon/src/Carbon/Traits/Units.php(162): abs()
#1 /var/www/example.com/vendor/nesbot/carbon/src/Carbon/Traits/Units.php(49): Carbon\\Carbon->addUTCUnit()
#2 /var/www/example.com/vendor/nesbot/carbon/src/Carbon/Traits/Date.php(2662): Carbon\\Carbon->addRealUnit()
#3 /var/www/example.com/vendor/laravel/framework/src/Illuminate/Support/InteractsWithTime.php(38): Carbon\\Carbon->__call()
#4 /var/www/example.com/vendor/laravel/framework/src/Illuminate/Queue/RedisQueue.php(278): Illuminate\\Queue\\Queue->availableAt()
#5 /var/www/example.com/vendor/laravel/framework/src/Illuminate/Queue/RedisQueue.php(228): Illuminate\\Queue\\RedisQueue->retrieveNextJob()
#6 /var/www/example.com/vendor/laravel/framework/src/Illuminate/Queue/Worker.php(349): Illuminate\\Queue\\RedisQueue->pop()
#7 /var/www/example.com/vendor/laravel/framework/src/Illuminate/Queue/Worker.php(363): Illuminate\\Queue\\Worker->Illuminate\\Queue\\{closure}()
#8 /var/www/example.com/vendor/laravel/framework/src/Illuminate/Queue/Worker.php(162): Illuminate\\Queue\\Worker->getNextJob()
#9 /var/www/example.com/vendor/laravel/framework/src/Illuminate/Queue/Console/WorkCommand.php(139): Illuminate\\Queue\\Worker->daemon()
#10 /var/www/example.com/vendor/laravel/framework/src/Illuminate/Queue/Console/WorkCommand.php(122): Illuminate\\Queue\\Console\\WorkCommand->runWorker()
#11 /var/www/example.com/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(36): Illuminate\\Queue\\Console\\WorkCommand->handle()
#12 /var/www/example.com/vendor/laravel/framework/src/Illuminate/Container/Util.php(41): Illuminate\\Container\\BoundMethod::Illuminate\\Container\\{closure}()
#13 /var/www/example.com/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(93): Illuminate\\Container\\Util::unwrapIfClosure()
#14 /var/www/example.com/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(35): Illuminate\\Container\\BoundMethod::callBoundMethod()
#15 /var/www/example.com/vendor/laravel/framework/src/Illuminate/Container/Container.php(662): Illuminate\\Container\\BoundMethod::call()
#16 /var/www/example.com/vendor/laravel/framework/src/Illuminate/Console/Command.php(212): Illuminate\\Container\\Container->call()
#17 /var/www/example.com/vendor/symfony/console/Command/Command.php(279): Illuminate\\Console\\Command->execute()
#18 /var/www/example.com/vendor/laravel/framework/src/Illuminate/Console/Command.php(181): Symfony\\Component\\Console\\Command\\Command->run()
#19 /var/www/example.com/vendor/symfony/console/Application.php(1049): Illuminate\\Console\\Command->run()
#20 /var/www/example.com/vendor/symfony/console/Application.php(318): Symfony\\Component\\Console\\Application->doRunCommand()
#21 /var/www/example.com/vendor/symfony/console/Application.php(169): Symfony\\Component\\Console\\Application->doRun()
#22 /var/www/example.com/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php(196): Symfony\\Component\\Console\\Application->run()
#23 /var/www/example.com/artisan(35): Illuminate\\Foundation\\Console\\Kernel->handle()
#24 {main}
"} 

I think this is due to Carbon using declare(strict_types=1); in carbon/src/Carbon/Traits/Units.php. When $unit = "second", the $value is never cast/converted to float|int.

Carbon version is 3.2.4

Steps To Reproduce

Just run a queue worker. No jobs are actually queued.

@sxtnmedia
Copy link

Fresh Laravel v11.3.1
Carbon 3.2.4
PHP 8.3.6

Couldn't reproduce the error.

@devajmeireles
Copy link
Contributor

Same here, @sxtnmedia 👍🏻

@crynobone
Copy link
Member

Hey there, thanks for reporting this issue.

We'll need more info and/or code to debug this further. Can you please create a repository with the command below, commit the code that reproduces the issue as one separate commit on the main/master branch and share the repository here?

Please make sure that you have the latest version of the Laravel installer in order to run this command. Please also make sure you have both Git & the GitHub CLI tool properly set up.

laravel new bug-report --github="--public"

Do not amend and create a separate commit with your custom changes. After you've posted the repository, we'll try to reproduce the issue.

Thanks!

@sklr
Copy link
Author

sklr commented Apr 16, 2024

I forgot to mention that this happened after an upgrade from Laravel 9 to 10 to 11. I will try to reproduce the issue in a separate repo.

@pakistanimoon
Copy link

Could not reproduce Error on Fresh Laravel
Can you please show some code snippets or upload repo?

@laravel laravel locked and limited conversation to collaborators Apr 16, 2024
@driesvints driesvints converted this issue into discussion #51079 Apr 16, 2024

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Projects
None yet
Development

No branches or pull requests

5 participants