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

[BUGFIX] Guard LocalizationUtility::translate with (string) cast #255

Merged
merged 1 commit into from
May 22, 2023

Conversation

sbuerk
Copy link
Contributor

@sbuerk sbuerk commented May 21, 2023

The LocalizationUtility::translate() is used
in several places to translate something. The
method may return a string or null, where as
the used places usual expects to have a valid
string afterwards. For example, if the return
value is null and used to pass it to another
method like htmlspecialchars() this will
violates added argument types with PHP 8.0.

To avoid emitted PHP warnings call to this
method is guarded with a explicit (string)
type cast to mitigate this issue.

Releases: main, 3.0

The `LocalizationUtility::translate()` is used
in several places to translate something. The
method may return a string or null, where as
the used places usual expects to have a valid
string afterwards. For example, if the return
value is null and used to pass it to another
method like `htmlspecialchars()` this will
violates added argument types with PHP 8.0.

To avoid emitted PHP warnings call to this
method is guarded with a explicit `(string)`
type cast to mitigate this issue.

Releases: main, 3.0
@sbuerk sbuerk self-assigned this May 21, 2023
@sbuerk sbuerk changed the title [BUGFIX] Guard LocalizationUtility::translate with (string) cast [BUGFIX] Guard LocalizationUtility::translate with (string) cast (Backport) May 21, 2023
@sbuerk sbuerk changed the title [BUGFIX] Guard LocalizationUtility::translate with (string) cast (Backport) [BUGFIX] Guard LocalizationUtility::translate with (string) cast May 21, 2023
@calien666 calien666 merged commit 9b4cba1 into 3.0 May 22, 2023
@calien666 calien666 deleted the 3.0-phpwarnings-1 branch May 22, 2023 13:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants