Closed craigh closed 10 years ago
this is issues with the modules as far as I can tell.
This is still an issue, and it is the core's fault as far as I can tell.
@cmfcmf I've been looking into this more. I can reproduce the problem with News when I attempt to create a news story. I have shorturls enabled and 'strip entry point' set to TRUE. upon submission of the form, I get this error (also see below after the trace):
[1] Symfony\Component\HttpKernel\Exception\MethodNotAllowedHttpException: No route found for "POST /news/create/": Method Not Allowed (Allow: GET, HEAD) at n/a in /Applications/MAMP/htdocs/core.git/src/lib/Zikula/Bundle/CoreBundle/EventListener/RouterListener.php line 151
at Zikula\Bundle\CoreBundle\EventListener\RouterListener->onKernelRequest(object(GetResponseEvent), 'kernel.request', object(Zikula_EventManager)) in line
at call_user_func(array(object(RouterListener), 'onKernelRequest'), object(GetResponseEvent), 'kernel.request', object(Zikula_EventManager)) in /Applications/MAMP/htdocs/core.git/src/vendor/symfony/symfony/src/Symfony/Component/EventDispatcher/Debug/WrappedListener.php line 59
at Symfony\Component\EventDispatcher\Debug\WrappedListener->__invoke(object(GetResponseEvent), 'kernel.request', object(Zikula_EventManager)) in line
at call_user_func(object(WrappedListener), object(GetResponseEvent), 'kernel.request', object(Zikula_EventManager)) in /Applications/MAMP/htdocs/core.git/src/vendor/symfony/symfony/src/Symfony/Component/EventDispatcher/EventDispatcher.php line 164
at Symfony\Component\EventDispatcher\EventDispatcher->doDispatch(array(object(WrappedListener), object(WrappedListener), object(WrappedListener), object(WrappedListener), object(WrappedListener), object(WrappedListener), object(WrappedListener), object(WrappedListener), object(WrappedListener), object(WrappedListener), object(WrappedListener), object(WrappedListener), object(WrappedListener), object(WrappedListener), object(WrappedListener), object(WrappedListener), object(WrappedListener)), 'kernel.request', object(GetResponseEvent)) in /Applications/MAMP/htdocs/core.git/src/vendor/symfony/symfony/src/Symfony/Component/EventDispatcher/EventDispatcher.php line 53
at Symfony\Component\EventDispatcher\EventDispatcher->dispatch('kernel.request', object(GetResponseEvent)) in /Applications/MAMP/htdocs/core.git/src/vendor/symfony/symfony/src/Symfony/Component/EventDispatcher/ContainerAwareEventDispatcher.php line 167
at Symfony\Component\EventDispatcher\ContainerAwareEventDispatcher->dispatch('kernel.request', object(GetResponseEvent), null) in /Applications/MAMP/htdocs/core.git/src/lib/legacy/Zikula/EventManager.php line 99
at Zikula_EventManager->dispatch('kernel.request', object(GetResponseEvent)) in /Applications/MAMP/htdocs/core.git/src/vendor/symfony/symfony/src/Symfony/Component/EventDispatcher/Debug/TraceableEventDispatcher.php line 112
at Symfony\Component\EventDispatcher\Debug\TraceableEventDispatcher->dispatch('kernel.request', object(GetResponseEvent)) in /Applications/MAMP/htdocs/core.git/src/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/HttpKernel.php line 126
at Symfony\Component\HttpKernel\HttpKernel->handleRaw(object(Zikula_Request_Http), '1') in /Applications/MAMP/htdocs/core.git/src/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/HttpKernel.php line 66
at Symfony\Component\HttpKernel\HttpKernel->handle(object(Zikula_Request_Http), '1', true) in /Applications/MAMP/htdocs/core.git/src/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/DependencyInjection/ContainerAwareHttpKernel.php line 64
at Symfony\Component\HttpKernel\DependencyInjection\ContainerAwareHttpKernel->handle(object(Zikula_Request_Http), '1', true) in /Applications/MAMP/htdocs/core.git/src/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Kernel.php line 185
at Symfony\Component\HttpKernel\Kernel->handle(object(Zikula_Request_Http)) in /Applications/MAMP/htdocs/core.git/src/index.php line 21
[2] Symfony\Component\Routing\Exception\MethodNotAllowedException: at n/a in /Applications/MAMP/htdocs/core.git/src/app/cache/dev/appDevUrlMatcher.php line 3432
at appDevUrlMatcher->match('/news/create/') in /Applications/MAMP/htdocs/core.git/src/vendor/symfony/symfony/src/Symfony/Component/Routing/Matcher/UrlMatcher.php line 106
at Symfony\Component\Routing\Matcher\UrlMatcher->matchRequest(object(Zikula_Request_Http)) in /Applications/MAMP/htdocs/core.git/src/vendor/jms/i18n-routing-bundle/JMS/I18nRoutingBundle/Router/I18nRouter.php line 190
at JMS\I18nRoutingBundle\Router\I18nRouter->matchRequest(object(Zikula_Request_Http)) in /Applications/MAMP/htdocs/core.git/src/lib/Zikula/Bundle/CoreBundle/EventListener/RouterListener.php line 124
at Zikula\Bundle\CoreBundle\EventListener\RouterListener->onKernelRequest(object(GetResponseEvent), 'kernel.request', object(Zikula_EventManager)) in line
at call_user_func(array(object(RouterListener), 'onKernelRequest'), object(GetResponseEvent), 'kernel.request', object(Zikula_EventManager)) in /Applications/MAMP/htdocs/core.git/src/vendor/symfony/symfony/src/Symfony/Component/EventDispatcher/Debug/WrappedListener.php line 59
at Symfony\Component\EventDispatcher\Debug\WrappedListener->__invoke(object(GetResponseEvent), 'kernel.request', object(Zikula_EventManager)) in line
at call_user_func(object(WrappedListener), object(GetResponseEvent), 'kernel.request', object(Zikula_EventManager)) in /Applications/MAMP/htdocs/core.git/src/vendor/symfony/symfony/src/Symfony/Component/EventDispatcher/EventDispatcher.php line 164
at Symfony\Component\EventDispatcher\EventDispatcher->doDispatch(array(object(WrappedListener), object(WrappedListener), object(WrappedListener), object(WrappedListener), object(WrappedListener), object(WrappedListener), object(WrappedListener), object(WrappedListener), object(WrappedListener), object(WrappedListener), object(WrappedListener), object(WrappedListener), object(WrappedListener), object(WrappedListener), object(WrappedListener), object(WrappedListener), object(WrappedListener)), 'kernel.request', object(GetResponseEvent)) in /Applications/MAMP/htdocs/core.git/src/vendor/symfony/symfony/src/Symfony/Component/EventDispatcher/EventDispatcher.php line 53
at Symfony\Component\EventDispatcher\EventDispatcher->dispatch('kernel.request', object(GetResponseEvent)) in /Applications/MAMP/htdocs/core.git/src/vendor/symfony/symfony/src/Symfony/Component/EventDispatcher/ContainerAwareEventDispatcher.php line 167
at Symfony\Component\EventDispatcher\ContainerAwareEventDispatcher->dispatch('kernel.request', object(GetResponseEvent), null) in /Applications/MAMP/htdocs/core.git/src/lib/legacy/Zikula/EventManager.php line 99
at Zikula_EventManager->dispatch('kernel.request', object(GetResponseEvent)) in /Applications/MAMP/htdocs/core.git/src/vendor/symfony/symfony/src/Symfony/Component/EventDispatcher/Debug/TraceableEventDispatcher.php line 112
at Symfony\Component\EventDispatcher\Debug\TraceableEventDispatcher->dispatch('kernel.request', object(GetResponseEvent)) in /Applications/MAMP/htdocs/core.git/src/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/HttpKernel.php line 126
at Symfony\Component\HttpKernel\HttpKernel->handleRaw(object(Zikula_Request_Http), '1') in /Applications/MAMP/htdocs/core.git/src/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/HttpKernel.php line 66
at Symfony\Component\HttpKernel\HttpKernel->handle(object(Zikula_Request_Http), '1', true) in /Applications/MAMP/htdocs/core.git/src/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/DependencyInjection/ContainerAwareHttpKernel.php line 64
at Symfony\Component\HttpKernel\DependencyInjection\ContainerAwareHttpKernel->handle(object(Zikula_Request_Http), '1', true) in /Applications/MAMP/htdocs/core.git/src/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Kernel.php line 185
at Symfony\Component\HttpKernel\Kernel->handle(object(Zikula_Request_Http)) in /Applications/MAMP/htdocs/core.git/src/index.php line 21
I debugged this a little and found that System::queryStringDecode()
was processing the /news/create
"route/url" twice which seems wrong. the first time it works as expected (with the new exception I added above). but the second pass through it fails with this error.
I thought maybe the processing of the web profiler toolbar was causing the second processing, but I deactivated that and still had the same error. I'm wondering if it has something to do with the js routing writer/loader which I also saw processed in a different pageload?
here is the $_SERVER['REQUEST_URI']
value for one pageload for a couple different news pages:
/core.git/src/news/view /core.git/src/js/routing?callback=fos.Router.setData /core.git/src/_wdt/639ba0 /core.git/src/search/opensearch _works_
/core.git/src/news/newitem /core.git/src/js/routing?callback=fos.Router.setData /core.git/src/_wdt/7fa6e7 /core.git/src/search/opensearch _works_
/core.git/src/news/create/ _FAILS_
I believe the failure Symfony\Component\HttpKernel\Exception\MethodNotAllowedHttpException: No route found for "POST /news/create/": Method Not Allowed (Allow: GET, HEAD)
would be failing in one of the subsequent processing loops (routing
, _wdt
, or open search
)
@cmfcmf wrote:
I'm pretty sure it's this line right here: https://github.com/zikula/core/blob/1.4/src/system/ZikulaRoutesModule/Controller/RedirectingController.php#L27
but the error is originating here:
// zikularoutesmodule_redirectingcontroller_removetrailingslash
if (preg_match('#^/(?P<url>.*/)$#s', $pathinfo, $matches)) {
if (!in_array($this->context->getMethod(), array('GET', 'HEAD'))) {
$allow = array_merge($allow, array('GET', 'HEAD'));
goto not_zikularoutesmodule_redirectingcontroller_removetrailingslash;
}
return $this->mergeDefaults(array_replace($matches, array('_route' => 'zikularoutesmodule_redirectingcontroller_removetrailingslash')), array ( '_controller' => 'Zikula\\RoutesModule\\Controller\\RedirectingController::removeTrailingSlashAction', '_zkModule' => 'ZikulaRoutesModule', '_zkType' => 'redirectingcontroller', '_zkFunc' => 'removetrailingslash',));
}
not_zikularoutesmodule_redirectingcontroller_removetrailingslash:
// en__RG__fos_js_routing_js
if (0 === strpos($pathinfo, '/js/routing') && preg_match('#^/js/routing(?:\\.(?P<_format>js|json))?$#s', $pathinfo, $matches)) {
return $this->mergeDefaults(array_replace($matches, array('_route' => 'en__RG__fos_js_routing_js')), array ( '_controller' => 'fos_js_routing.controller:indexAction', '_format' => 'js', '_locale' => 'en',));
}
throw 0 < count($allow) ? new MethodNotAllowedException(array_unique($allow)) : new ResourceNotFoundException();
which is at the end of the app/cache/dev/appDevUrlMatcher.php
file. so it is using the not_zikularoutesmodule_redirectingcontroller_removetrailingslash:
goto and then throwing the error.
because it is a POST
I've not done a lot of testing yet, but after turning on short urls in the general settings, both News and Pages break pretty severely.