@@ -622,7 +622,7 @@ public static function getSelfRoutedURLNoQuery()
622622 if (!empty ($ _SERVER ['REQUEST_URI ' ])) {
623623 $ route = $ _SERVER ['REQUEST_URI ' ];
624624 if (!empty ($ _SERVER ['QUERY_STRING ' ])) {
625- $ route = str_replace ($ _SERVER ['QUERY_STRING ' ], '' , $ route );
625+ $ route = self :: str_lreplace ($ _SERVER ['QUERY_STRING ' ], '' , $ route );
626626 if (substr ($ route , -1 ) == '? ' ) {
627627 $ route = substr ($ route , 0 , -1 );
628628 }
@@ -635,9 +635,26 @@ public static function getSelfRoutedURLNoQuery()
635635 }
636636
637637 $ selfRoutedURLNoQuery = $ selfURLhost . $ route ;
638+
639+ $ pos = strpos ($ selfRoutedURLNoQuery , "? " );
640+ if ($ pos !== false ) {
641+ $ selfRoutedURLNoQuery = substr ($ selfRoutedURLNoQuery , 0 , $ pos -1 );
642+ }
643+
638644 return $ selfRoutedURLNoQuery ;
639645 }
640646
647+ public static function str_lreplace ($ search , $ replace , $ subject )
648+ {
649+ $ pos = strrpos ($ subject , $ search );
650+
651+ if ($ pos !== false ) {
652+ $ subject = substr_replace ($ subject , $ replace , $ pos , strlen ($ search ));
653+ }
654+
655+ return $ subject ;
656+ }
657+
641658 /**
642659 * Returns the URL of the current host + current view + query.
643660 *
0 commit comments