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

Argument #1 ($date) must be of type Carbon\Carbon, Illuminate\Support\Carbon given #51360

Closed
ariaieboy opened this issue May 9, 2024 · 10 comments

Comments

@ariaieboy
Copy link

ariaieboy commented May 9, 2024

Laravel Version

11.7.0

PHP Version

8.3

Database Driver & Version

No response

Description

After upgrading to laravel 11.7.0 from 11.5.0 I am getting this error in some places:
Carbon\Carbon::rawAddUnit(): Argument #1 ($date) must be of type Carbon\Carbon, Illuminate\Support\Carbon given, called in /var/www/html/vendor/nesbot/carbon/src/Carbon/Traits/Units.php on line 356

Steps To Reproduce

here is the stack trace about this error that happens on the ProcessPendingUpdates job of telescope package.

<html>
<body>
<!--StartFragment-->
/var/www/html/vendor/nesbot/carbon/src/Carbon/Traits/Units.php:356
--
/var/www/html/vendor/nesbot/carbon/src/Carbon/Traits/Date.php:2943
/var/www/html/vendor/nesbot/carbon/src/Carbon/Traits/Date.php:2616
/var/www/html/vendor/laravel/telescope/src/Jobs/ProcessPendingUpdates.php:56
/var/www/html/vendor/laravel/framework/src/Illuminate/Conditionable/Traits/Conditionable.php:34
/var/www/html/vendor/laravel/framework/src/Illuminate/Collections/Traits/EnumeratesValues.php:554
/var/www/html/vendor/laravel/telescope/src/Jobs/ProcessPendingUpdates.php:53
/var/www/html/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php:36
/var/www/html/vendor/laravel/framework/src/Illuminate/Container/Util.php:41
/var/www/html/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php:93
/var/www/html/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php:35
/var/www/html/vendor/laravel/framework/src/Illuminate/Container/Container.php:662
/var/www/html/vendor/laravel/framework/src/Illuminate/Bus/Dispatcher.php:128
/var/www/html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:144
/var/www/html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:119
/var/www/html/vendor/laravel/framework/src/Illuminate/Bus/Dispatcher.php:132
/var/www/html/vendor/laravel/framework/src/Illuminate/Queue/CallQueuedHandler.php:124
/var/www/html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:144
/var/www/html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:119
/var/www/html/vendor/laravel/framework/src/Illuminate/Queue/CallQueuedHandler.php:123
/var/www/html/vendor/laravel/framework/src/Illuminate/Queue/CallQueuedHandler.php:71
/var/www/html/vendor/laravel/framework/src/Illuminate/Queue/Jobs/Job.php:102
/var/www/html/vendor/laravel/framework/src/Illuminate/Queue/Worker.php:439
/var/www/html/vendor/laravel/framework/src/Illuminate/Queue/Worker.php:389
/var/www/html/vendor/laravel/framework/src/Illuminate/Queue/Worker.php:176
/var/www/html/vendor/laravel/framework/src/Illuminate/Queue/Console/WorkCommand.php:139
/var/www/html/vendor/laravel/framework/src/Illuminate/Queue/Console/WorkCommand.php:122
/var/www/html/vendor/laravel/horizon/src/Console/WorkCommand.php:51
/var/www/html/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php:36
/var/www/html/vendor/laravel/framework/src/Illuminate/Container/Util.php:41
/var/www/html/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php:93
/var/www/html/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php:35
/var/www/html/vendor/laravel/framework/src/Illuminate/Container/Container.php:662
/var/www/html/vendor/laravel/framework/src/Illuminate/Console/Command.php:212
/var/www/html/vendor/symfony/console/Command/Command.php:279
/var/www/html/vendor/laravel/framework/src/Illuminate/Console/Command.php:181
/var/www/html/vendor/symfony/console/Application.php:1049
/var/www/html/vendor/symfony/console/Application.php:318
/var/www/html/vendor/symfony/console/Application.php:169
/var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php:196
/var/www/html/artisan:35

<!--EndFragment-->
</body>
</html>
@ariaieboy
Copy link
Author

My carbon package gets updated to v3 and because of that, I am seeing this error in my Laravel telescope.

Since according to the trace log above the code that executed is all on the Laravel vendor directory I think this bug is related to Laravel compatibility with Carbon 3

@crynobone
Copy link
Member

Can you share the contain of composer show for this project.

@ariaieboy
Copy link
Author

ariaieboy commented May 10, 2024

@crynobone
my project works perfectly fine with this packages. I locked the nesbot/carbon to V2 in my composer.json But if I remove it from the composer.json it's going to upgrade to V3 and I get errors in my horizon jobs.

composer show on the project when the nesbot/carbon is locked to V2:

aaronfrancis/pulse-outdated                  v0.1.2             A Laravel Pulse card to show outdated composer dependencies
akaunting/laravel-money                      5.2.0              Currency formatting and conversion package for Laravel
anourvalar/eloquent-serialize                1.2.22             Laravel Query Builder (Eloquent) serialization
archtechx/enums                              v1.0.1             Helpers for making PHP enums more lovable.
ariaieboy/filament-currency                  1.4.1              Bring back laravel-money formatter for Filament Text Column
ariaieboy/filament-jalali-datetime           1.4.1              a Jalali DateTime Column for filament table builder
ariaieboy/filament-jalali-datetimepicker     3.0.1              This is my package filament-jalali-datetimepicker
ariaieboy/jalali                             1.0.0              This Package helps developers to easily work with Jalali (Shamsi or Iranian) dates in php appliations, b...  
ariaieboy/kavenegar-laravel                  1.11               laravel 4 and 5 kavenegar integration
artesaos/seotools                            v1.3.0             SEO Tools for Laravel and Lumen
awcodes/overlook                             v2.2.0             A Filament plugin that adds an app overview widget to your admin panel.
aws/aws-crt-php                              v1.2.5             AWS Common Runtime for PHP
aws/aws-sdk-php                              3.306.2            AWS SDK for PHP - Use Amazon Web Services in your PHP project
barryvdh/laravel-ide-helper                  v3.0.0             Laravel IDE Helper, generates correct PHPDocs for all Facade classes, to improve auto-completion.
barryvdh/reflection-docblock                 v2.1.1
blade-ui-kit/blade-heroicons                 2.3.0              A package to easily make use of Heroicons in your Laravel Blade views.
blade-ui-kit/blade-icons                     1.6.0              A package to easily make use of icons in your Laravel Blade views.
brianium/paratest                            v7.4.3             Parallel testing for PHP
brick/math                                   0.12.1             Arbitrary-precision arithmetic library
carbonphp/carbon-doctrine-types              2.1.0              Types to use Carbon in Doctrine
chillerlan/php-cache                         5.1.0              A psr/simple-cache implementation. PHP 8.1+
chillerlan/php-settings-container            3.2.0              A container class for immutable settings objects. Not a DI container.
codewithdennis/filament-select-tree          v3.1.39            The multi-level select field enables you to make single selections from a predefined list of options tha...  
composer/class-map-generator                 1.1.1              Utilities to scan PHP code and generate class maps.
composer/pcre                                3.1.3              PCRE wrapping library that offers type-safe preg_* replacements.
composer/semver                              3.4.0              Semver library that offers utilities, version constraint parsing and validation.
danharrin/date-format-converter              v0.3.0             Convert token-based date formats between standards.
danharrin/livewire-rate-limiting             v1.3.1             Apply rate limiters to Laravel Livewire actions.
dflydev/dot-access-data                      v3.0.2             Given a deep data structure, access data by dot notation.
dg/bypass-finals                             v1.6.0             Removes final keyword from source code on-the-fly and allows mocking of final methods and classes
doctrine/cache                               2.2.0              PHP Doctrine Cache library is a popular cache implementation that supports many different drivers such a...  
doctrine/dbal                                3.8.4              Powerful PHP database abstraction layer (DBAL) with many features for database schema introspection and ...  
doctrine/deprecations                        1.1.3              A small layer on top of trigger_error(E_USER_DEPRECATED) or PSR-3 logging with options to disable all de...  
doctrine/event-manager                       2.0.0              The Doctrine Event Manager is a simple PHP event system that was built to be used with the various Doctr...  
doctrine/inflector                           2.0.10             PHP Doctrine Inflector is a small library that can perform string manipulations with regard to upper/low...  
doctrine/lexer                               3.0.1              PHP Doctrine Lexer parser library that can be used in Top-Down, Recursive Descent Parsers.
doctrine/sql-formatter                       1.4.0              a PHP SQL highlighting library
dragon-code/contracts                        2.23.0             A set of contracts for any project
dragon-code/pretty-array                     v4.1.0             Simple conversion of an array to a pretty view
dragon-code/support                          6.13.0             Support package is a collection of helpers and tools for any project.
dragonmantank/cron-expression                v3.3.3             CRON for PHP: Calculate the next or previous run date and determine if a CRON expression is due
egulias/email-validator                      4.0.2              A library for validating emails against several RFCs
fakerphp/faker                               v1.23.1            Faker is a PHP library that generates fake data for you.
fidry/cpu-core-counter                       1.1.0              Tiny utility to get the number of CPU cores.
filament/actions                             v3.2.76            Easily add beautiful action modals to any Livewire component.
filament/filament                            v3.2.76            A collection of full-stack components for accelerated Laravel app development.
filament/forms                               v3.2.76            Easily add beautiful forms to any Livewire component.
filament/infolists                           v3.2.76            Easily add beautiful read-only infolists to any Livewire component.
filament/notifications                       v3.2.76            Easily add beautiful notifications to any Livewire app.
filament/spatie-laravel-media-library-plugin v3.2.76            Filament support for `spatie/laravel-medialibrary`.
filament/spatie-laravel-settings-plugin      v3.2.76            Filament support for `spatie/laravel-settings`.
filament/support                             v3.2.76            Core helper methods and foundation code for all Filament packages.
filament/tables                              v3.2.76            Easily add beautiful tables to any Livewire component.
filament/upgrade                             v3.2.76            Upgrade Filament v2 code to Filament v3.
filament/widgets                             v3.2.76            Easily add beautiful dashboard widgets to any Livewire component.
filp/whoops                                  2.15.4             php error handling for cool kids
flowframe/laravel-trend                      v0.2.0             Easily generate model trends
fruitcake/laravel-telescope-toolbar          v1.3.5             Toolbar for Laravel Telescope based on Symfony Web Profiler
fruitcake/php-cors                           v1.3.0             Cross-origin resource sharing library for the Symfony HttpFoundation
graham-campbell/result-type                  v1.1.2             An Implementation Of The Result Type
grkamil/laravel-telegram-logging             v1.11.0            Send logs to Telegram chat via Telegram bot
guzzlehttp/guzzle                            7.8.1              Guzzle is a PHP HTTP client library
guzzlehttp/promises                          2.0.2              Guzzle promises library
guzzlehttp/psr7                              2.6.2              PSR-7 message implementation that also provides common utility methods
guzzlehttp/uri-template                      v1.0.3             A polyfill class for uri_template of PHP
hamcrest/hamcrest-php                        v2.0.1             This is the PHP port of Hamcrest Matchers
hungthai1401/vulnerable                      v0.1.0             A Laravel Pulse card to show security vulnerability composer dependencies
irazasyed/telegram-bot-sdk                   v3.14.0            The Unofficial Telegram Bot API PHP SDK
jean85/pretty-package-versions               2.0.6              A library to get pretty versions strings of installed dependencies
kavenegar/php                                v1.2.2             A PHP wrapper for Kavenegar's API
kirschbaum-development/eloquent-power-joins  3.5.6              The Laravel magic applied to joins.
laminas/laminas-diactoros                    3.3.1              PSR HTTP Message implementations
larastan/larastan                            v2.9.6             Larastan - Discover bugs in your code without running it. A phpstan/phpstan wrapper for Laravel
laravel-lang/actions                         1.8.1              Translation of buttons and other action elements
laravel-lang/attributes                      2.10.4             List of 126 languages for form field names
laravel-lang/common                          6.2.0              Easily connect the necessary language packs to the application
laravel-lang/http-statuses                   3.8.2              List of 126 languages for HTTP statuses
laravel-lang/json-fallback                   2.1.0              Adds support for fallback JSON string translation
laravel-lang/lang                            15.2.2             List of 126 languages for Laravel Framework, Laravel Jetstream, Laravel Fortify, Laravel Breeze, Laravel...  
laravel-lang/locale-list                     1.3.0              List of localizations available in Laravel Lang projects
laravel-lang/locales                         2.7.0              Basic functionality for working with localizations
laravel-lang/native-country-names            1.4.0              The project contains native translations of country names
laravel-lang/native-currency-names           1.4.0              The project contains native translations of currency names
laravel-lang/native-locale-names             2.3.0              The project contains native translations of locale names
laravel-lang/publisher                       16.3.0             Publisher lang files for the Laravel and Lumen Frameworks, Jetstream, Fortify, Cashier, Spark and Nova f...  
laravel/framework                            v11.7.0            The Laravel Framework.
laravel/horizon                              v5.24.4            Dashboard and code-driven configuration for Laravel queues.
laravel/octane                               v2.3.10            Supercharge your Laravel application's performance.
laravel/pint                                 v1.15.3            An opinionated code formatter for PHP.
laravel/prompts                              v0.1.21            Add beautiful and user-friendly forms to your command-line applications.
laravel/pulse                                v1.1.0             Laravel Pulse is a real-time application performance monitoring tool and dashboard for your Laravel appl...  
laravel/sail                                 v1.29.1            Docker files for running a basic Laravel application.
laravel/serializable-closure                 v1.3.3             Laravel Serializable Closure provides an easy and secure way to serialize closures in PHP.
laravel/telescope                            v5.0.4             An elegant debug assistant for the Laravel framework.
laravel/tinker                               v2.9.0             Powerful REPL for the Laravel framework.
league/commonmark                            2.4.2              Highly-extensible PHP Markdown parser which fully supports the CommonMark spec and GitHub-Flavored Markd...  
league/config                                v1.2.0             Define configuration arrays with strict schemas and access values with dot notation
league/csv                                   9.15.0             CSV data manipulation made easy in PHP
league/event                                 3.0.2              Event package
league/flysystem                             3.27.0             File storage abstraction for PHP
league/flysystem-aws-s3-v3                   3.27.0             AWS S3 filesystem adapter for Flysystem.
league/flysystem-local                       3.25.1             Local filesystem adapter for Flysystem.
league/mime-type-detection                   1.15.0             Mime-type detection for Flysystem
league/uri                                   7.4.1              URI manipulation library
league/uri-interfaces                        7.4.1              Common interfaces and classes for URI representation and interaction
livewire/livewire                            v3.4.12            A front-end framework for Laravel.
maennchen/zipstream-php                      3.1.0              ZipStream is a library for dynamically streaming dynamic zip files from PHP without writing to the disk ...  
markbaker/complex                            3.0.2              PHP Class for working with complex numbers
markbaker/matrix                             3.0.1              PHP Class for working with matrices
masterminds/html5                            2.9.0              An HTML5 parser and serializer.
mockery/mockery                              1.6.11             Mockery is a simple yet flexible PHP mock object framework
monolog/monolog                              3.6.0              Sends your logs to files, sockets, inboxes, databases and various web services
mtdowling/jmespath.php                       2.7.0              Declaratively specify how to extract elements from a JSON document
myclabs/deep-copy                            1.11.1             Create deep copies (clones) of your objects
nesbot/carbon                                2.72.3             An API extension for DateTime that supports 281 different languages.
nette/schema                                 v1.3.0             📐 Nette Schema: validating data structures against a given Schema.
nette/utils                                  v4.0.4             🛠  Nette Utils: lightweight utilities for string & array manipulation, image handling, safe JSON enco...     
nicmart/tree                                 0.8.0              A basic but flexible php tree data structure and a fluent tree builder implementation.
nikic/php-parser                             v5.0.2             A PHP parser written in PHP
nunomaduro/collision                         v8.1.1             Cli error handling for console/command-line PHP applications.
nunomaduro/patrol                            v1.2.0             An elegant command-line tool that keeps your PHP Project's dependencies in check
nunomaduro/termwind                          v2.0.1             Its like Tailwind CSS, but for the console.
nyholm/psr7                                  1.8.1              A fast PHP7 implementation of PSR-7
openspout/openspout                          v4.23.1            PHP Library to read and write spreadsheet files (CSV, XLSX and ODS), in a fast and scalable way
owenvoke/blade-fontawesome                   v2.6.0             A package to easily make use of Font Awesome in your Laravel Blade views
pestphp/pest                                 v2.34.7            The elegant PHP Testing Framework.
pestphp/pest-plugin                          v2.1.1             The Pest plugin manager
pestphp/pest-plugin-arch                     v2.7.0             The Arch plugin for Pest PHP.
pestphp/pest-plugin-laravel                  v2.4.0             The Pest Laravel Plugin
pestphp/pest-plugin-livewire                 v2.1.0             The Pest Livewire Plugin
phar-io/manifest                             2.0.4              Component for reading phar.io manifest information from a PHP Archive (PHAR)
phar-io/version                              3.2.1              Library for handling version information and constraints
phpdocumentor/reflection-common              2.2.0              Common reflection classes used by phpdocumentor to reflect the code structure
phpdocumentor/reflection-docblock            5.4.0              With this component, a library can provide support for annotations via DocBlocks or otherwise retrieve i...  
phpdocumentor/type-resolver                  1.8.2              A PSR-5 based resolver of Class names, Types and Structural Element Names
phpmyadmin/sql-parser                        5.9.0              A validating SQL lexer and parser with a focus on MySQL dialect.
phpoffice/phpspreadsheet                     2.0.0              PHPSpreadsheet - Read, Create and Write Spreadsheet documents in PHP - Spreadsheet engine
phpoption/phpoption                          1.9.2              Option Type for PHP
phpstan/extension-installer                  1.3.1              Composer plugin for automatic installation of PHPStan extensions
phpstan/phpdoc-parser                        1.29.0             PHPDoc parser with support for nullable, intersection and generic types
phpstan/phpstan                              1.10.67            PHPStan - PHP Static Analysis Tool
phpstan/phpstan-deprecation-rules            1.1.4              PHPStan rules for detecting usage of deprecated classes, methods, properties, constants and traits.
phpstan/phpstan-strict-rules                 1.5.5              Extra strict and opinionated rules for PHPStan
phpunit/php-code-coverage                    10.1.14            Library that provides collection, processing, and rendering functionality for PHP code coverage informat...  
phpunit/php-file-iterator                    4.1.0              FilterIterator implementation that filters files based on a list of suffixes.
phpunit/php-invoker                          4.0.0              Invoke callables with a timeout
phpunit/php-text-template                    3.0.1              Simple template engine.
phpunit/php-timer                            6.0.0              Utility class for timing
phpunit/phpunit                              10.5.17            The PHP Unit Testing framework.
psr/cache                                    3.0.0              Common interface for caching libraries
psr/clock                                    1.0.0              Common interface for reading the clock.
psr/container                                2.0.2              Common Container Interface (PHP FIG PSR-11)
psr/event-dispatcher                         1.0.0              Standard interfaces for event handling.
psr/http-client                              1.0.3              Common interface for HTTP clients
psr/http-factory                             1.0.2              Common interfaces for PSR-7 HTTP message factories
psr/http-message                             2.0                Common interface for HTTP messages
psr/log                                      3.0.0              Common interface for logging libraries
psr/simple-cache                             3.0.0              Common interfaces for simple caching
psy/psysh                                    v0.12.3            An interactive shell for modern PHP.
ralouphie/getallheaders                      3.0.3              A polyfill for getallheaders.
ramsey/collection                            2.0.0              A PHP library for representing and manipulating collections.
ramsey/uuid                                  4.7.6              A PHP library for generating and working with universally unique identifiers (UUIDs).
rector/rector                                1.0.4              Instant Upgrade and Automated Refactoring of any PHP code
roave/security-advisories                    dev-latest 99ba399 Prevents installation of composer packages with known security vulnerabilities: no API, simply require it    
ryangjchandler/blade-capture-directive       v1.0.0             Create inline partials in your Blade templates with ease.
salibhdr/typhoon-iran-cities                 3.0.1              A laravel package for importing all regions such as provinces, counties, cities, city districts, rural d...  
sebastian/cli-parser                         2.0.1              Library for parsing CLI options
sebastian/code-unit                          2.0.0              Collection of value objects that represent the PHP code units
sebastian/code-unit-reverse-lookup           3.0.0              Looks up which function or method a line of code belongs to
sebastian/comparator                         5.0.1              Provides the functionality to compare PHP values for equality
sebastian/complexity                         3.2.0              Library for calculating the complexity of PHP code units
sebastian/diff                               5.1.1              Diff implementation
sebastian/environment                        6.1.0              Provides functionality to handle HHVM/PHP environments
sebastian/exporter                           5.1.2              Provides the functionality to export PHP variables for visualization
sebastian/global-state                       6.0.2              Snapshotting of global state
sebastian/lines-of-code                      2.0.2              Library for counting the lines of code in PHP source code
sebastian/object-enumerator                  5.0.0              Traverses array structures and object graphs to enumerate all referenced objects
sebastian/object-reflector                   3.0.0              Allows reflection of object attributes, including inherited and non-public ones
sebastian/recursion-context                  5.0.0              Provides functionality to recursively process PHP variables
sebastian/type                               4.0.0              Collection of value objects that represent the types of the PHP type system
sebastian/version                            4.0.1              Library that helps with managing the version number of Git-hosted PHP projects
shetabit/multipay                            v1.47.0            PHP Payment Gateway Integration Package
shetabit/payment                             v5.8.0             Laravel Payment Gateway Integration Package
shuvroroy/filament-spatie-laravel-health     v2.0.1             This plugin is built on top of Spatie's Laravel-health package
spatie/backtrace                             1.6.1              A better backtrace
spatie/browsershot                           4.0.2              Convert a webpage to an image or pdf using headless Chrome
spatie/color                                 1.5.3              A little library to handle color conversions
spatie/crawler                               8.2.0              Crawl all internal links found on a website
spatie/db-dumper                             3.6.0              Dump databases
spatie/enum                                  3.13.0             PHP Enums
spatie/flare-client-php                      1.5.1              Send PHP errors to Flare
spatie/ignition                              1.14.1             A beautiful error page for PHP applications.
spatie/image                                 3.6.0              Manipulate images with an expressive API
spatie/image-optimizer                       1.7.4              Easily optimize images using PHP
spatie/invade                                2.0.0              A PHP function to work with private properties and methods
spatie/laravel-activitylog                   4.8.0              A very simple activity logger to monitor the users of your website or application
spatie/laravel-db-snapshots                  2.6.1              Quickly dump and load databases
spatie/laravel-health                        1.29.0             Monitor the health of a Laravel application
spatie/laravel-ignition                      2.7.0              A beautiful error page for Laravel applications.
spatie/laravel-medialibrary                  11.4.8             Associate files with Eloquent models
spatie/laravel-package-tools                 1.16.4             Tools for creating Laravel packages
spatie/laravel-permission                    6.7.0              Permission handling for Laravel 8.0 and up
spatie/laravel-settings                      3.3.2              Store your application settings
spatie/laravel-sitemap                       7.2.0              Create and generate sitemaps with ease
spatie/regex                                 3.1.1              A sane interface for php's built in preg_* functions
spatie/robots-txt                            2.2.0              Determine if a page may be crawled from robots.txt and robots meta tags
spatie/temporary-directory                   2.2.1              Easily create, use and destroy temporary directories
staudenmeir/eloquent-has-many-deep-contracts v1.2               Contracts for staudenmeir/eloquent-has-many-deep
staudenmeir/laravel-adjacency-list           v1.22              Recursive Laravel Eloquent relationships with CTEs
staudenmeir/laravel-cte                      v1.11              Laravel queries with common table expressions
symfony/browser-kit                          v7.0.7             Simulates the behavior of a web browser, allowing you to make requests, click on links and submit forms ...  
symfony/console                              v7.0.7             Eases the creation of beautiful and testable command line interfaces
symfony/css-selector                         v7.0.7             Converts CSS selectors to XPath expressions
symfony/deprecation-contracts                v3.5.0             A generic function and convention to trigger deprecation notices
symfony/dom-crawler                          v7.0.7             Eases DOM navigation for HTML and XML documents
symfony/error-handler                        v7.0.7             Provides tools to manage errors and ease debugging PHP code
symfony/event-dispatcher                     v7.0.7             Provides tools that allow your application components to communicate with each other by dispatching even...  
symfony/event-dispatcher-contracts           v3.5.0             Generic abstractions related to dispatching event
symfony/finder                               v7.0.7             Finds files and directories via an intuitive fluent interface
symfony/html-sanitizer                       v7.0.7             Provides an object-oriented API to sanitize untrusted HTML input for safe insertion into a document's DOM.   
symfony/http-client                          v7.0.7             Provides powerful methods to fetch HTTP resources synchronously or asynchronously
symfony/http-client-contracts                v3.5.0             Generic abstractions related to HTTP clients
symfony/http-foundation                      v7.0.7             Defines an object-oriented layer for the HTTP specification
symfony/http-kernel                          v7.0.7             Provides a structured process for converting a Request into a Response
symfony/mailer                               v7.0.7             Helps sending emails
symfony/mime                                 v7.0.7             Allows manipulating MIME messages
symfony/polyfill-ctype                       v1.29.0            Symfony polyfill for ctype functions
symfony/polyfill-iconv                       v1.29.0            Symfony polyfill for the Iconv extension
symfony/polyfill-intl-grapheme               v1.29.0            Symfony polyfill for intl's grapheme_* functions
symfony/polyfill-intl-idn                    v1.29.0            Symfony polyfill for intl's idn_to_ascii and idn_to_utf8 functions
symfony/polyfill-intl-normalizer             v1.29.0            Symfony polyfill for intl's Normalizer class and related functions
symfony/polyfill-mbstring                    v1.29.0            Symfony polyfill for the Mbstring extension
symfony/polyfill-php72                       v1.29.0            Symfony polyfill backporting some PHP 7.2+ features to lower PHP versions
symfony/polyfill-php80                       v1.29.0            Symfony polyfill backporting some PHP 8.0+ features to lower PHP versions
symfony/polyfill-php81                       v1.29.0            Symfony polyfill backporting some PHP 8.1+ features to lower PHP versions
symfony/polyfill-php83                       v1.29.0            Symfony polyfill backporting some PHP 8.3+ features to lower PHP versions
symfony/polyfill-uuid                        v1.29.0            Symfony polyfill for uuid functions
symfony/process                              v7.0.7             Executes commands in sub-processes
symfony/psr-http-message-bridge              v7.0.7             PSR HTTP message bridge
symfony/routing                              v7.0.7             Maps an HTTP request to a set of configuration variables
symfony/service-contracts                    v3.5.0             Generic abstractions related to writing services
symfony/string                               v7.0.7             Provides an object-oriented API to strings and deals with bytes, UTF-8 code points and grapheme clusters...
symfony/translation                          v6.4.7             Provides tools to internationalize your application
symfony/translation-contracts                v3.5.0             Generic abstractions related to translation
symfony/uid                                  v7.0.7             Provides an object-oriented API to generate and represent UIDs
symfony/var-dumper                           v7.0.7             Provides mechanisms for walking through any arbitrary PHP variable
symfony/yaml                                 v7.0.7             Loads and dumps YAML files
ta-tikoma/phpunit-architecture-test          0.8.4              Methods for testing application architecture
thecodingmachine/safe                        v2.5.0             PHP core functions that throw exceptions instead of returning FALSE on error
theseer/tokenizer                            1.2.3              A small library for converting tokenized PHP source code into XML and potentially other formats
tijsverkoyen/css-to-inline-styles            v2.2.7             CssToInlineStyles is a class that enables you to convert HTML-pages/files into HTML-pages/files with inl...  
vlucas/phpdotenv                             v5.6.0             Loads environment variables from `.env` to `getenv()`, `$_ENV` and `$_SERVER` automagically.
voku/anti-xss                                4.1.42             anti xss-library
voku/portable-ascii                          2.0.1              Portable ASCII library - performance optimized (ascii) string functions for php.
voku/portable-utf8                           6.0.13             Portable UTF-8 library - performance optimized (unicode) string functions for php.
webmozart/assert                             1.11.0             Assertions to validate method input/output with nice error messages.

Here is the composer update --dry-run output after I remove the nesbot/carbon lock from V2:

  - Upgrading aws/aws-sdk-php (3.306.2 => 3.306.3)
  - Upgrading nesbot/carbon (2.72.3 => 3.3.1)
  - Upgrading openspout/openspout (v4.23.1 => v4.24.0)
  - Upgrading psr/http-factory (1.0.2 => 1.1.0)
  - Upgrading rector/rector (1.0.4 => 1.0.5)
  - Locking symfony/clock (v7.0.7)
  - Upgrading symfony/translation (v6.4.7 => v7.0.7)

@driesvints
Copy link
Member

@ariaieboy we'll need a clear way to reproduce this one otherwise it's gonna be a wild goose chase for us.

@ariaieboy
Copy link
Author

It's an edge-case scenario cause I can't reproduce this error on my local machine and that's weird.

I use docker in my production and local environment, and these 2 are almost identical.

I've even reproduced the same workload on my local machine by replying my jobs from production on local but I couldn't reproduce this error.

The only thing that I have is 2 jobs that fail exactly when the now() method is called with a sub/add method.

The Telescope job fail after calling now()->addSeconds(10) and my job fails after calling now()->subDays(config('x', 3)

@driesvints
Copy link
Member

@ariaieboy gotcha. In that case I'm afraid there's not much we can do. We only have one report for this so far. I'm sorry you're affected by this but unless we have a way to reproduce this we can't investigate. Afaik from looking at the internal code all looks good. If you ever have a clear way to reproduce this we'd be happy to have a second look.

@kylekatarnls
Copy link
Contributor

kylekatarnls commented May 16, 2024

Hello, reading this error:

Carbon\Carbon::rawAddUnit(): Argument #1 ($date) must be of type Carbon\Carbon, Illuminate\Support\Carbon given, called in /var/www/html/vendor/nesbot/carbon/src/Carbon/Traits/Units.php on line 356

Since Illuminate\Support\Carbon extends Carbon\Carbon, then Illuminate\Support\Carbon is a valid type that rawAddUnit accepts for $date parameter.

This error message tends to say that an object having the class name Illuminate\Support\Carbon but not being a sub-class of Carbon\Carbon has been passed to the method. Maybe you should look if something in your app, your vendor or compiled cache file is actually defining Illuminate\Support\Carbon in a different way than the official one (from Laravel)

@ariaieboy
Copy link
Author

@kylekatarnls thanks for your response.

I couldn't reproduce this bug in my local environment.

I had a new issue with swoole and Laravel Octane recently and because of that I switched from an Alpine-based image to an Ubuntu-based docker image and since then both of my problems have gone away.

I think there must be an issue in the Alpine variants of PHP or one of the ext. because I rebuilt one of my release tags images and pushed it to production while the same codebase would work perfectly with the old image the new image had some issues including this one.

Since the Ubuntu image does not have any problem I think the alpine/php/ext must have some bug in the latest builds. I've spent lots of time on these bugs but I just gave up completely and just switched to Ubuntu for now.

@brucek2
Copy link

brucek2 commented Oct 14, 2024

I started seeing these as of yesterday, as Horizon processes outgoing emails. The two things that happened yesterday morning were

#1 - this set of composer updates:

  • Upgrading aws/aws-sdk-php (3.323.0 => 3.324.1)
  • Upgrading doctrine/dbal (3.9.1 => 3.9.3)
  • Upgrading dragonmantank/cron-expression (v3.3.3 => v3.4.0)
  • Upgrading laravel/dusk (v8.2.7 => v8.2.8)
  • Upgrading laravel/framework (v11.26.0 => v11.27.2)
  • Upgrading laravel/horizon (v5.29.0 => v5.29.1)
  • Upgrading league/flysystem (3.29.0 => 3.29.1)
  • Upgrading nette/schema (v1.3.0 => v1.3.2)
  • Upgrading nikic/php-parser (v5.3.0 => v5.3.1)
  • Upgrading phpunit/php-code-coverage (11.0.6 => 11.0.7)
  • Upgrading phpunit/phpunit (11.3.6 => 11.4.1)
  • Upgrading sebastian/version (5.0.1 => 5.0.2)

#2 - I switched to more aggressive opcache settings, including enabling jit.

I just backed off #2 and will see if that stops these error reports.

Looking at the application code involved, it has been stable for a long time, but I do notice one of the classes has Carbon imported as Carbon\Carbon vs. Illuminate\Support\Carbon. That hasn't mattered for years, or since initially updating to Laravel 11 / Carbon 3 about 4 weeks ago, but maybe it's a factor now for some reason?

@brucek2
Copy link

brucek2 commented Oct 14, 2024

Just realized my specific error is slightly different:
Carbon\CarbonImmutable::rawAddUnit(): Argument #1 ($date) must be of type Carbon\CarbonImmutable, Carbon\CarbonImmutable given

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

No branches or pull requests

5 participants