@@ -87,22 +87,24 @@ public function getPanel(): string
8787 */
8888 private function analyse (
8989 Routing \Router $ router ,
90- Nette \Http \IRequest $ httpRequest ,
90+ ? Nette \Http \IRequest $ httpRequest ,
9191 string $ module = '' ,
9292 ?string $ path = null ,
93- bool $ parentMatches = true ,
9493 int $ level = -1 ,
9594 int $ flag = 0
9695 ): void {
9796 if ($ router instanceof Routing \RouteList) {
98- try {
99- $ parentMatches = $ parentMatches && $ router ->match ($ httpRequest ) !== null ;
100- } catch (\Throwable $ e ) {
97+ if ($ httpRequest ) {
98+ try {
99+ $ httpRequest = $ router ->match ($ httpRequest ) === null ? null : $ httpRequest ;
100+ } catch (\Throwable $ e ) {
101+ $ httpRequest = null ;
102+ }
101103 }
102104
103105 $ prop = (new \ReflectionProperty (Routing \RouteList::class, 'path ' ));
104106 $ prop ->setAccessible (true );
105- if ($ pathPrefix = $ prop ->getValue ($ router )) {
107+ if ($ httpRequest && ( $ pathPrefix = $ prop ->getValue ($ router) )) {
106108 $ path .= $ pathPrefix ;
107109 $ url = $ httpRequest ->getUrl ();
108110 $ httpRequest = $ httpRequest ->withUrl ($ url ->withPath ($ url ->getPath (), $ url ->getBasePath () . $ pathPrefix ));
@@ -113,7 +115,7 @@ private function analyse(
113115 $ next = count ($ this ->routers );
114116 $ flags = $ router ->getFlags ();
115117 foreach ($ router ->getRouters () as $ i => $ subRouter ) {
116- $ this ->analyse ($ subRouter , $ httpRequest , $ module , $ path , $ parentMatches , $ level + 1 , $ flags [$ i ]);
118+ $ this ->analyse ($ subRouter , $ httpRequest , $ module , $ path , $ level + 1 , $ flags [$ i ]);
117119 }
118120
119121 if ($ info = $ this ->routers [$ next ] ?? null ) {
@@ -130,7 +132,7 @@ private function analyse(
130132 $ matched = $ flag & Routing \RouteList::ONE_WAY ? 'oneway ' : 'no ' ;
131133 $ params = $ e = null ;
132134 try {
133- $ params = $ parentMatches
135+ $ params = $ httpRequest
134136 ? $ router ->match ($ httpRequest )
135137 : null ;
136138 } catch (\Throwable $ e ) {
0 commit comments