Skip to content

Update LaravelLocalization.php - #911

Closed
MattiaMarchiorato wants to merge 1 commit into
mcamara:masterfrom
MattiaMarchiorato:master
Closed

Update LaravelLocalization.php#911
MattiaMarchiorato wants to merge 1 commit into
mcamara:masterfrom
MattiaMarchiorato:master

Conversation

@MattiaMarchiorato

Copy link
Copy Markdown

check if value is not empty before str_replace because passing null to parameter #2 ($replace) of type array|string is deprecated

check if value is not empty before str_replace because passing null to parameter mcamara#2 ($replace) of type array|string is deprecated
@niels-numbers

Copy link
Copy Markdown
Collaborator

Closing this one, the underlying problem is fixed by #960.

Thanks for reporting the deprecation and for the patch. We went with a different fix: substituteAttributesInRoute
now uses a single preg_replace_callback, which avoids passing null into str_replace and also handles
{param:column} bindings correctly.

One note on the patch itself, in case it is useful elsewhere: if ($value) also skips 0 and "0", so a route
parameter with the value 0 would have been left unreplaced. if ($value !== null) would be the safer form.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants