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

[10.x] Illuminate\Filesystem\join_paths(): Argument #2 must be of type string, null given #49466

Closed
tylernathanreed opened this issue Dec 21, 2023 · 5 comments · Fixed by #49467

Comments

@tylernathanreed
Copy link
Contributor

Laravel Version

10.38.1

PHP Version

8.2.12

Database Driver & Version

No response

Description

I recently ran composer update, which pulled in the latest Laravel version. My tests started reported errors that didn't previously exist, which indicates a breaking change.

After some investigation, I discovered that it was caused by #49433, which no longer accepts null as a valid value for functions like app_path, base_path, public_path, etc.

While substituting an empty string instead of null fixes the issue, I wouldn't expect to have to update my project like this unless I was making a major Laravel upgrade (e.g. L11).

Steps To Reproduce

Within php artisan tinker:

base_path(null); // Works on Laravel 10.38.0; throws exception on Laravel 10.38.1
@driesvints
Copy link
Member

Hi @tylernathanreed. These methods never accepted a null value as you can see from their docblocks. You should always have passed a string here.

@tylernathanreed
Copy link
Contributor Author

@driesvints,

Yet despite that, the code worked. The null case comes up often when we had use cases like config('foo.bar'). I would prefer to keep this working. Otherwise, I'll have to audit the project to change scenarios like this to be config('foo.bar', '').

Honestly, this is just failing because of the new type that formally introduced. Granted, as you said, the docblock stated that only a string was accepted. The underlying code works with both null and string.

I've created PR #49467, which shows that only the type hint needs to be changed.

@venux92
Copy link

venux92 commented Dec 22, 2023

I have exactly the same issue after just upgrading to 10.38.1 I had to revert to 10.38.0 for now as I could not build my project anymore without auditing it.

@driesvints
Copy link
Member

We did a new patch release which should resolve this.

@venux92
Copy link

venux92 commented Dec 23, 2023

@driesvints Perfect.. I just updated to 10.38.2 and it's working. Thanks for pointing out the null value as well. Will take some time one day to update them all. 👍🏽

@tylernathanreed Thanks for the PR 🚀

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