Uploaded image for project: 'eZ Publish / Platform'
  1. eZ Publish / Platform
  2. EZP-26149

Slashes in view parameters cause php notice

    Details

      Description

      If we add slashes in a view parameter it will cause a php notice. This should not be expected.

      Steps to reproduce:
      1. Set a 5.4.7 environment in dev mode
      2. Access to http://your.site/(offset)/http://www.google.com
      3. Confirm you can see the notice as described

      Returned notice:

       
      Whoops, looks like something went wrong.
      2/2 ContextErrorException in SiteAccessListener.php line 142: Notice: Uninitialized string offset: 0
       
          in SiteAccessListener.php line 142
          at ErrorHandler->handleError('8', 'Uninitialized string offset: 0', '/var/www/ezpublish54/vendor/ezsystems/ezpublish-kernel/eZ/Bundle/EzPublishCoreBundle/EventListener/SiteAccessListener.php', '142', array('vpString' => '(offset)/http://www.google.com', 'viewParameters' => array('offset' => 'http:'), 'vpSegments' => array('(offset)', '', 'www.google.com'), 'i' => '2', 'iMax' => '4', 'paramName' => 'offset')) in SiteAccessListener.php line 142
          at SiteAccessListener->generateViewParametersArray('(offset)/http://www.google.com') in SiteAccessListener.php line 114
          at SiteAccessListener->getViewParameters('/(offset)/http://www.google.com') in SiteAccessListener.php line 87
          at SiteAccessListener->onSiteAccessMatch(object(PostSiteAccessMatchEvent), 'ezpublish.siteaccess', object(TraceableEventDispatcher))
          at call_user_func(array(object(SiteAccessListener), 'onSiteAccessMatch'), object(PostSiteAccessMatchEvent), 'ezpublish.siteaccess', object(TraceableEventDispatcher)) in WrappedListener.php line 61
          at WrappedListener->__invoke(object(PostSiteAccessMatchEvent), 'ezpublish.siteaccess', object(TraceableEventDispatcher))
          at call_user_func(object(WrappedListener), object(PostSiteAccessMatchEvent), 'ezpublish.siteaccess', object(TraceableEventDispatcher)) in WrappedListener.php line 61
          at WrappedListener->__invoke(object(PostSiteAccessMatchEvent), 'ezpublish.siteaccess', object(ContainerAwareEventDispatcher))
          at call_user_func(object(WrappedListener), object(PostSiteAccessMatchEvent), 'ezpublish.siteaccess', object(ContainerAwareEventDispatcher)) in EventDispatcher.php line 161
          at EventDispatcher->doDispatch(array(object(WrappedListener), object(WrappedListener), object(WrappedListener), object(WrappedListener), object(WrappedListener)), 'ezpublish.siteaccess', object(PostSiteAccessMatchEvent)) in EventDispatcher.php line 46
          at EventDispatcher->dispatch('ezpublish.siteaccess', object(PostSiteAccessMatchEvent)) in TraceableEventDispatcher.php line 128
          at TraceableEventDispatcher->dispatch('ezpublish.siteaccess', object(PostSiteAccessMatchEvent)) in SiteAccessMatchListener.php line 95
          at SiteAccessMatchListener->onKernelRequest(object(GetResponseEvent), 'kernel.request', object(TraceableEventDispatcher))
          at call_user_func(array(object(SiteAccessMatchListener), 'onKernelRequest'), object(GetResponseEvent), 'kernel.request', object(TraceableEventDispatcher)) in WrappedListener.php line 61
          at WrappedListener->__invoke(object(GetResponseEvent), 'kernel.request', object(TraceableEventDispatcher))
          at call_user_func(object(WrappedListener), object(GetResponseEvent), 'kernel.request', object(TraceableEventDispatcher)) in WrappedListener.php line 61
          at WrappedListener->__invoke(object(GetResponseEvent), 'kernel.request', object(ContainerAwareEventDispatcher))
          at call_user_func(object(WrappedListener), object(GetResponseEvent), 'kernel.request', object(ContainerAwareEventDispatcher)) in EventDispatcher.php line 161
          at 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), object(WrappedListener), object(WrappedListener), object(WrappedListener), object(WrappedListener), object(WrappedListener), object(WrappedListener)), 'kernel.request', object(GetResponseEvent)) in EventDispatcher.php line 46
          at EventDispatcher->dispatch('kernel.request', object(GetResponseEvent)) in TraceableEventDispatcher.php line 128
          at TraceableEventDispatcher->dispatch('kernel.request', object(GetResponseEvent)) in HttpKernel.php line 125
          at HttpKernel->handleRaw(object(Request), '2') in HttpKernel.php line 64
          at HttpKernel->handle(object(Request), '2', false) in ContainerAwareHttpKernel.php line 69
          at ContainerAwareHttpKernel->handle(object(Request), '2', false) in ExceptionListener.php line 50
          at ExceptionListener->onKernelException(object(GetResponseForExceptionEvent), 'kernel.exception', object(TraceableEventDispatcher))
          at call_user_func(array(object(ExceptionListener), 'onKernelException'), object(GetResponseForExceptionEvent), 'kernel.exception', object(TraceableEventDispatcher)) in WrappedListener.php line 61
          at WrappedListener->__invoke(object(GetResponseForExceptionEvent), 'kernel.exception', object(ContainerAwareEventDispatcher))
          at call_user_func(object(WrappedListener), object(GetResponseForExceptionEvent), 'kernel.exception', object(ContainerAwareEventDispatcher)) in EventDispatcher.php line 161
          at EventDispatcher->doDispatch(array(object(WrappedListener), object(WrappedListener), object(WrappedListener), object(WrappedListener), object(WrappedListener), object(WrappedListener)), 'kernel.exception', object(GetResponseForExceptionEvent)) in EventDispatcher.php line 46
          at EventDispatcher->dispatch('kernel.exception', object(GetResponseForExceptionEvent)) in TraceableEventDispatcher.php line 128
          at TraceableEventDispatcher->dispatch('kernel.exception', object(GetResponseForExceptionEvent)) in HttpKernel.php line 221
          at HttpKernel->handleException(object(ContextErrorException), object(Request), '1') in HttpKernel.php line 75
          at HttpKernel->handle(object(Request), '1', true) in ContainerAwareHttpKernel.php line 69
          at ContainerAwareHttpKernel->handle(object(Request), '1', true) in Kernel.php line 184
          at Kernel->handle(object(Request)) in index.php line 77
       
      1/2 ContextErrorException in SiteAccessListener.php line 142: Notice: Uninitialized string offset: 0
       
          in SiteAccessListener.php line 142
          at ErrorHandler->handleError('8', 'Uninitialized string offset: 0', '/var/www/ezpublish54/vendor/ezsystems/ezpublish-kernel/eZ/Bundle/EzPublishCoreBundle/EventListener/SiteAccessListener.php', '142', array('vpString' => '(offset)/http://www.google.com', 'viewParameters' => array('offset' => 'http:'), 'vpSegments' => array('(offset)', '', 'www.google.com'), 'i' => '2', 'iMax' => '4', 'paramName' => 'offset')) in SiteAccessListener.php line 142
          at SiteAccessListener->generateViewParametersArray('(offset)/http://www.google.com') in SiteAccessListener.php line 114
          at SiteAccessListener->getViewParameters('/(offset)/http://www.google.com') in SiteAccessListener.php line 87
          at SiteAccessListener->onSiteAccessMatch(object(PostSiteAccessMatchEvent), 'ezpublish.siteaccess', object(TraceableEventDispatcher))
          at call_user_func(array(object(SiteAccessListener), 'onSiteAccessMatch'), object(PostSiteAccessMatchEvent), 'ezpublish.siteaccess', object(TraceableEventDispatcher)) in WrappedListener.php line 61
          at WrappedListener->__invoke(object(PostSiteAccessMatchEvent), 'ezpublish.siteaccess', object(ContainerAwareEventDispatcher))
          at call_user_func(object(WrappedListener), object(PostSiteAccessMatchEvent), 'ezpublish.siteaccess', object(ContainerAwareEventDispatcher)) in EventDispatcher.php line 161
          at EventDispatcher->doDispatch(array(object(WrappedListener), object(WrappedListener), object(WrappedListener), object(WrappedListener), object(WrappedListener)), 'ezpublish.siteaccess', object(PostSiteAccessMatchEvent)) in EventDispatcher.php line 46
          at EventDispatcher->dispatch('ezpublish.siteaccess', object(PostSiteAccessMatchEvent)) in TraceableEventDispatcher.php line 128
          at TraceableEventDispatcher->dispatch('ezpublish.siteaccess', object(PostSiteAccessMatchEvent)) in SiteAccessMatchListener.php line 95
          at SiteAccessMatchListener->onKernelRequest(object(GetResponseEvent), 'kernel.request', object(TraceableEventDispatcher))
          at call_user_func(array(object(SiteAccessMatchListener), 'onKernelRequest'), object(GetResponseEvent), 'kernel.request', object(TraceableEventDispatcher)) in WrappedListener.php line 61
          at WrappedListener->__invoke(object(GetResponseEvent), 'kernel.request', object(ContainerAwareEventDispatcher))
          at call_user_func(object(WrappedListener), object(GetResponseEvent), 'kernel.request', object(ContainerAwareEventDispatcher)) in EventDispatcher.php line 161
          at 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), object(WrappedListener), object(WrappedListener), object(WrappedListener), object(WrappedListener), object(WrappedListener), object(WrappedListener)), 'kernel.request', object(GetResponseEvent)) in EventDispatcher.php line 46
          at EventDispatcher->dispatch('kernel.request', object(GetResponseEvent)) in TraceableEventDispatcher.php line 128
          at TraceableEventDispatcher->dispatch('kernel.request', object(GetResponseEvent)) in HttpKernel.php line 125
          at HttpKernel->handleRaw(object(Request), '1') in HttpKernel.php line 64
          at HttpKernel->handle(object(Request), '1', true) in ContainerAwareHttpKernel.php line 69
          at ContainerAwareHttpKernel->handle(object(Request), '1', true) in Kernel.php line 184
          at Kernel->handle(object(Request)) in index.php line 77
      

        Issue Links

          Activity

          Hide
          Paulo Nunes (Inactive) added a comment - - edited

          PR: https://github.com/ezsystems/ezpublish-kernel/pull/1747 verified and approved by QA
          Tested on 5.4
          [~joao.inacio@ez.no]: I'll send this back to Dev so that the PR may be merged

          Show
          Paulo Nunes (Inactive) added a comment - - edited PR: https://github.com/ezsystems/ezpublish-kernel/pull/1747 verified and approved by QA Tested on 5.4 [~joao.inacio@ez.no] : I'll send this back to Dev so that the PR may be merged
          Hide
          Paulo Nunes (Inactive) added a comment -

          PR: https://github.com/ezsystems/ezpublish-kernel/pull/1747 verified and approved by QA
          Tested on 5.4 and 6.3
          Joao Inacio: I'll send this back to Dev so that the PR may be merged

          Show
          Paulo Nunes (Inactive) added a comment - PR: https://github.com/ezsystems/ezpublish-kernel/pull/1747 verified and approved by QA Tested on 5.4 and 6.3 Joao Inacio: I'll send this back to Dev so that the PR may be merged
          Show
          Joao Inacio (Inactive) added a comment - Merged in ezpublish-kernel: https://github.com/ezsystems/ezpublish-kernel/commit/c4abe5c982d50c82afd4d034adc152d75d4184a7

            People

            • Assignee:
              Unassigned
              Reporter:
              Ricardo Correia (Inactive)
            • Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: