@@ -1026,6 +1026,7 @@ private static function assertNoLocalBrowserReferences(string $content, string $
10261026 foreach (self ::htmlMarkupNodes ($ content ) as $ node ) {
10271027 if ('tag ' === $ node ['kind ' ]) foreach ($ node ['attributes ' ] as $ name => $ value ) {
10281028 if (!in_array ($ name , array ('xlink:href ' , 'srcset ' , 'src ' , 'href ' , 'poster ' , 'action ' , 'style ' ), true )) continue ;
1029+ if ('action ' === $ name && 'form ' !== $ node ['name ' ]) continue ;
10291030 if ('style ' === $ name ) { $ assertCss ($ value , 'style_attribute ' ); continue ; }
10301031 foreach ('srcset ' === $ name ? self ::srcsetCandidates ($ value ) : array ($ value ) as $ candidate ) $ assertReference ($ candidate , $ name , $ node ['name ' ]);
10311032 }
@@ -1035,7 +1036,12 @@ private static function assertNoLocalBrowserReferences(string $content, string $
10351036 if (is_array ($ attributes )) {
10361037 $ assertJsonAttributes ($ attributes , self ::jsonUrlIsRoute ($ node ['content ' ]));
10371038 } elseif (preg_match_all ('~(?:"| \\\\u0022)(url|src|href|poster|action|srcset)(?:"| \\\\u0022)\s*:\s*(?:"| \\\\u0022)(.*?)(?:"| \\\\u0022)~is ' , $ node ['content ' ], $ fields , PREG_SET_ORDER )) {
1038- foreach ($ fields as $ field ) foreach ('srcset ' === strtolower ($ field [1 ]) ? self ::srcsetCandidates ($ field [2 ]) : array ($ field [2 ]) as $ candidate ) $ assertReference ((string ) $ candidate , 'json: ' . strtolower ($ field [1 ]));
1039+ $ route = self ::jsonUrlIsRoute ($ node ['content ' ]);
1040+ foreach ($ fields as $ field ) {
1041+ $ name = strtolower ($ field [1 ]);
1042+ $ routeField = $ route && 'url ' === $ name ? 'route_url ' : (in_array ($ name , array ('href ' , 'action ' ), true ) ? 'route_ ' . $ name : $ name );
1043+ foreach ('srcset ' === $ name ? self ::srcsetCandidates ($ field [2 ]) : array ($ field [2 ]) as $ candidate ) $ assertReference (str_replace ('\\/ ' , '/ ' , (string ) $ candidate ), 'json: ' . $ routeField );
1044+ }
10391045 }
10401046 }
10411047 }
0 commit comments