-
Notifications
You must be signed in to change notification settings - Fork 10.9k
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
Carbon 1.26.0 causes some trouble!? #23893
Comments
briannesbitt/Carbon#1250 (comment)
|
Thanks for the feedback, we will try to find out why this happens and release a fix on Carbon. |
I provided 1.26.1 using an other name, but I still cannot reproduce this error, I use PHP 7.2, create a new 5.6.16 project, it install Carbon 1.26.0 with no problem. If someone know why it not always happen, I'm interested. |
@kylekatarnls I havn't tried, but this looks to be a conflict in Laravel's own Carbon class. Make sure you're using Illuminate\Support\Carbon if you're attempting to reproduce the problem. |
I do: use Illuminate\Support\Carbon;
class SomeMiddleware
{
public function handle($request, Closure $next)
{
Carbon::macro('test', function () {
return 'test';
});
$d = new Carbon();
echo $d->test();
exit;
}
} This display "test". PHP 7.2.3, Laravel 5.6.16, Carbon 1.26.0 (Windows 10). |
The issue is with Carbon 1.26 After creating a new project (
|
Carbon just released a new version(a few hours ago) that adds macros and mixins, which conflicts with Illuminate\Support\Carbon via a trait. |
Sorry miss-typed, it's Carbon 1.26, the file contains |
@devcircus 1.26.1 renamed the variable, you can update. |
Are you sure about 1.26.1?
Checking the actual file, the variable is still named
|
1.26.2 seems to have fixed the issue. |
Glad to hear, because I still not was able to reproduce even by trying maximal error_reporting level. Now that Carbon added Illiminate\Support\Carbon features, we'll be able to remove Laravel overrides and it would be the end of compatibility problems and gap between Carbon and Laravel's Carbon. |
Hope that Laravel will once again adopt the latest Carbon version because some very handy functionality has been added in 1.26. For now I'm locking my project to laravel/[email protected] and nesbot/[email protected]. |
@nbolender Not sure they will come to read closed issues. I regret this situation but it's needed to take the time to think about what to keep/remove Laravel side in Illuminate\Support\Carbon (#23938, #23941) to upgrade it the right way. As a temporary fix, you can also use in your composer.json Not ideal since you need to upgrade manually carbon, but it allow you to keep the laravel/[email protected].* dependency up to date and having up to date carbon too with no conflict. |
Description:
Creating a new Laravel project (
composer create-project laravel/laravel
) returns with the following error (the project is created though):This happens as soon as Carbon gets updated to v1.26.0.
composer update
is also affected.Steps To Reproduce:
Run either
composer create-project laravel/laravel
orcomposer update
on an existing project.Thanks in advance!
The text was updated successfully, but these errors were encountered: