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

FIX Prevent invalid i18n sources from being collected #11603

Merged
merged 1 commit into from
Feb 12, 2025

Conversation

emteknetnz
Copy link
Member

Issue silverstripe/.github#365

Fixes a couple of bugs that showed up when running the text collector:

  • In assets File.php, an invalid key ending with "." with a value of "generic" was being collected
  • There were lots of invalid CLASS_DESCRIPTION: null being collected in multiple modules

Copy link
Member

@GuySartorelli GuySartorelli left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There were lots of invalid CLASS_DESCRIPTION: null being collected in multiple modules

This might point at us missing some configuration - totally fine if that's investigated in a separate card but at a minimum can you please either create a card to look into it, or list them here so I can look into it quickly before accepting this change?

if (!empty($currentEntity[0])) {
if (!empty($currentEntity[0]) && !str_ends_with($currentEntity[0], '.')) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I assume this is for

In assets File.php, an invalid key ending with "." with a value of "generic" was being collected

  1. Shouldn't we have a PR in silverstripe/assets to fix that key?
  2. Should we throw a warning when we find these instead of just ignoring them?
  3. We should update our PHPStan rule to capture this scenario so it doesn't happen again

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we should do an of those - here's the unit test that would trigger this before this PR https://github.com/silverstripe/silverstripe-framework/pull/11603/files#diff-7b72a58f2b9e604294d0342910391de6700b4c6fe15f99615bbaa729c196135dR1039 - it's a weird condition

There may be well other conditions in the future that mean we end up with a dot at the end of the key. I think having a catch-all "key ends with a period, it's clearly invalid, so just ignore it" is a pretty good real-world solution

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Discussed offline. We'll catch in PHPStan with silverstripe/silverstripe-standards#16 later on

@emteknetnz
Copy link
Member Author

New issue for missing class_description config #11607

Copy link
Member

@GuySartorelli GuySartorelli left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@GuySartorelli GuySartorelli merged commit 41c6d6c into silverstripe:5 Feb 12, 2025
17 checks passed
@GuySartorelli GuySartorelli deleted the pulls/5/fix-i18n branch February 12, 2025 01:30
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