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

Deprecated: trim(): Passing null to parameter #1 ($string) of type string is deprecated in vendor/laravel/framework/src/Illuminate/Log/LogManager.php on line 637 #54626

Closed
stojankukrika opened this issue Feb 15, 2025 · 6 comments

Comments

@stojankukrika
Copy link

Laravel Version

11.42.1

PHP Version

8.3

Database Driver & Version

Mysql

Description

I get this error on composer dump-autoload or composer update:

Deprecated: trim(): Passing null to parameter #1 ($string) of type string is deprecated in vendor/laravel/framework/src/Illuminate/Log/LogManager.php on line 637

In LoadConfiguration.php line 99:

array_merge(): Argument #2 must be of type array, int given

even I have this as a logging.php config file:

<?php

return [

    'default' => env('LOG_CHANNEL', 'stack'),

    'deprecations' => env('LOG_DEPRECATIONS_CHANNEL', 'null'),

    'channels' => [
        'bugsnag' => [
            'driver' => 'bugsnag',
        ],

        'daily' => [
            'driver' => 'daily',
            'path' => storage_path('logs/'.php_sapi_name().'/laravel.log'),
            'level' => env('LOG_LEVEL', 'debug'),
            'days' => 90,
            'permissions' => 0664,
        ],
    ],

];

and this in env file:

LOG_CHANNEL=stack
LOG_STACK=daily
LOG_DEPRECATIONS_CHANNEL=null
LOG_LEVEL=debug

Can you help me?

Steps To Reproduce

composer update
during process:

@php artisan package:discover --ansi

@jackbayliss
Copy link
Contributor

Have you tried :

php artisan config:clear
php artisan cache:clear

Other than that try setting your env LOG_DEPRECATIONS_CHANNEL to 'null' rather than null maybe 🤷🏻

If it still happens, can you get it to occur in a fresh project? If so upload it, as it may be easier to figure it out :)

@stojankukrika
Copy link
Author

It doesn't help :( And it happened only in one laravel service after Shift update :( the rest of the services have the same, and the rest are ok.

@stojankukrika
Copy link
Author

fixed with run composer update --no-scripts and after that :

php artisan config:clear
php artisan cache:clear

then composer update works well. Can somebody explain to me what that does and why it works well after that? I want to learn it if it happens again.

@jackbayliss
Copy link
Contributor

jackbayliss commented Feb 16, 2025

I guess there was a depreciation that tried to log during the update, and your env was cached so it was set to null rather than a string, as you cant trim on null, but you can on a string. (Or perhaps a previous version was cached?)

Using the cache and config clear means any env settings are no longer cached so I'm assuming that's what happened

@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!

@crynobone
Copy link
Member

Hey there,

We're closing this issue because it's inactive, already solved, old, or not relevant anymore. Feel free to open up a new issue if you're still experiencing this problem.

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

3 participants