Trasa z znakami specjalnymi nie jest poprawnie analizowana w Zend Framework 2

URI z niemieckimi znakami specjalnymi nie działają (błąd 404). Mam już ten problem (tutaj) i został rozwiązany za pomocąmodyfikator unicode i apomocnik widoku niestandardowego, która go używa.

Teraz mam ten sam problem zSegment trasa podrzędna, ale tym razem podejście z identyfikatorem Unicode i pomocnikiem widoku niestandardowego nie działa.

Wszystkie prośby jaksld.tld/sport/sportäöüÄÖÜß/cityäöüÄÖÜß lubsld.tld/sport/sportäöüÄÖÜß/cityäöüÄÖÜß/page/123 kończą się na404 błąd.

/module/Catalog/config/module.config.php

<?php
return array(
    ...
    'router' => array(
        'routes' => array(
            'catalog' => array(
                ...
            ),
            'city' => array(
                ...
            ),
            // works correctly, if I remove the child route
            'sport' => array(
                'type'  => 'MyNamespace\Mvc\Router\Http\UnicodeRegex',
                'options' => array(
                    'regex' => '/catalog/(?<city>[\p{L}\p{Zs}]*)/(?<sport>[\p{L}\p{Zs}]*)',
                    'defaults' => array(
                        'controller' => 'Catalog\Controller\Catalog',
                        'action'     => 'list-courses',
                    ),
                    'spec'  => '/catalog/%city%/%sport%',
                ),
                'may_terminate' => true,
                'child_routes' => array(
                    'courses' => array(
                        'type'  => 'segment',
                        'options' => array(
                            'route' => '[/page/:page]',
                            'defaults' => array(
                                'controller' => 'Catalog\Controller\Catalog',
                                'action'     => 'list-courses',
                            ),
                        ),
                        'may_terminate' => true,
                    ),
                )
            ),
        ),
    ),
    ...
);

Wypróbowałem to także za pomocąUnicodeRegex trasa dla dzieci:

        'sport' => array(
            'type'  => 'MyNamespace\Mvc\Router\Http\UnicodeRegex',
            'options' => array(
                'regex' => '/catalog/(?<city>[\p{L}\p{Zs}]*)/(?<sport>[\p{L}\p{Zs}]*)',
                'defaults' => array(
                    'controller' => 'Catalog\Controller\Catalog',
                    'action'     => 'list-courses',
                ),
                'spec'  => '/catalog/%city%/%sport%',
            ),
            'may_terminate' => true,
            'child_routes' => array(
                'courses' => array(
                    'type'  => 'MyNamespace\Mvc\Router\Http\UnicodeRegex',
                    'options' => array(
                        'regex' => '/page/(?<page>[\p{N}]*)',
                        'defaults' => array(
                            'controller' => 'Catalog\Controller\Catalog',
                            'action'     => 'list-courses',
                        ),
                        'spec'  => '/page/%page%',
                    ),
                    'may_terminate' => true,
                ),
            )
        ),

UnicodeRegex

widziećtutaj

Segment Unicode

WydłużaZend\Mvc\Router\Http\Segment i uzupełnia dane ALLpreg_match(...) dzwoni zu:

'((\G(?P<literal>[^:{\[\]]*)(?P<token>[:{\[\]]|$)))u''(\G\{(?P<name>[^}]+)\}:?)u''((\G(?P<name>[^:/{\[\]]+)(?:{(?P<delimiters>[^}]+)})?:?))u''(\G(?P<literal>[^}]+)\})u''(\G' . $this->regex . ')u''(^' . $this->regex . '$)u'

Jak to działa?

questionAnswers(1)

yourAnswerToTheQuestion