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

BUG: a new language present with different key and value ends in an exception #4857

Closed
1 task done
iseries opened this issue Jan 29, 2024 · 2 comments
Closed
1 task done
Assignees
Labels

Comments

@iseries
Copy link
Contributor

iseries commented Jan 29, 2024

Is there an existing issue for this?

  • I have searched the existing issues

Current Behavior

When adding a new language present with a different key and value an Exception is thrown.

Exception

An exception was thrown while Neos tried to render your page

Warning: Undefined array key "en_US" in /var/www/mysite.local/neos/Data/Temporary/Development/Cache/Code/Flow_Object_Classes/Neos_Neos_Fusion_DimensionsMenuItemsImplementation.php line 111

root<Neos.Fusion:Case>/
 documentType<Neos.Fusion:Matcher>/
  element<Rehme.Site:Document.Homepage>/
   renderer<Rehme.Site:Document.Layout.Base>/
    renderer<Neos.Neos:Page>/
     head<Neos.Fusion:Join>/
      alternateLanguageLinks<Neos.Seo:AlternateLanguageLinks>/
       renderer<Neos.Fusion:Loop>/
        items<Neos.Neos:DimensionsMenuItems>/

Log:

Exception #1 in line 111 of /var/www/mysite.local/neos/Data/Temporary/Development/Cache/Code/Flow_Object_Classes/Neos_Neos_Fusion_DimensionsMenuItemsImplementation.php: Warning: Undefined array key "en_US" in /var/www/mysite.local/neos/Data/Temporary/Development/Cache/Code/Flow_Object_Classes/Neos_Neos_Fusion_DimensionsMenuItemsImplementation.php line 111

84 Neos\Flow\Error\ErrorHandler::handleError()
83 Neos\Neos\Fusion\DimensionsMenuItemsImplementation_Original::Neos\Neos\Fusion\{closure}()
82 array_walk()
81 Neos\Neos\Fusion\DimensionsMenuItemsImplementation_Original::buildItems()
80 Neos\Neos\Fusion\AbstractMenuItemsImplementation::getItems()
79 Neos\Neos\Fusion\AbstractMenuItemsImplementation::evaluate()
78 Neos\Fusion\Core\Runtime_Original::evaluateObjectOrRetrieveFromCache()
77 Neos\Fusion\Core\Runtime_Original::evaluate()
[...]
5 Neos\Flow\Http\Middleware\MiddlewaresChain_Original::handle()
4 Neos\Flow\Http\Middleware\StandardsComplianceMiddleware_Original::process()
3 Neos\Flow\Http\Middleware\MiddlewaresChain_Original::handle()
2 Neos\Flow\Http\RequestHandler::handleRequest()
1 Neos\Flow\Core\Bootstrap::run()


HTTP REQUEST:
target: /
Upgrade-Insecure-Requests: 1
Cookie: Neos_Session=PeptXzhYdFRJNTOOEX1AzA1Iwoc5nQ58
Connection: keep-alive
Accept-Encoding: gzip, deflate
Accept-Language: en-US,en;q=0.5
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,*/*;q=0.8
User-Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:121.0) Gecko/20100101 Firefox/121.0
Host: mysite.local:8080

PHP PROCESS:
Inode: 24520080
PID: 64742
UID: 1000
GID: 33
User: arjuna

Expected Behavior

Based on the documentation, it should be possible to define a different key and value.

Steps To Reproduce

Current Settings:

Neos:
  Neos:
    routing:
      supportEmptySegmentForDimensions: true
  ContentRepository:
    contentDimensions:
      language:
        label: 'Sprache'
        default: de
        defaultPreset: de
        presets:
          de:
            label: 'Deutsch'
            values:
              - de
            uriSegment: ''

Extend it with:

          en:
            label: 'Englisch'
            values:
              - en_US
            uriSegment: 'en'

Execute:
./flow flow:cache:flush and ./flow node:migrate 20150716212459

Open the frontend.

Environment

- Neos: 8.3.9
- PHP: 8.2.15

Anything else?

Denny Lubitz noticed in slack (see here) that there is a hard convention in the DimensionsMenuItemsImplementation, that key and label needs to be the same: https://github.com/neos/neos-development-collection/blob/8.3/Neos.Neos/Classes/Fusion/DimensionsMenuItemsImplementation.php#L111C81-L111C95

@iseries iseries added the Bug label Jan 29, 2024
@dlubitz dlubitz self-assigned this Jan 29, 2024
@dlubitz
Copy link
Contributor

dlubitz commented Jan 29, 2024

Thanks @iseries for reporting that issue.

Issue is here, that we use the dimension value, instead of the preset key here:
https://github.com/neos/neos-development-collection/blob/8.3/Neos.Neos/Classes/Fusion/DimensionsMenuItemsImplementation.php#L111

@dlubitz
Copy link
Contributor

dlubitz commented May 5, 2024

Fixed with #4859

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

No branches or pull requests

2 participants