@@ -121,6 +121,9 @@ abstract class Presenter extends Control implements Application\IPresenter
121121 /** @var ITemplateFactory */
122122 private $ templateFactory ;
123123
124+ /** @var Nette\Http\Url */
125+ private $ refUrlCache ;
126+
124127
125128 public function __construct ()
126129 {
@@ -970,15 +973,14 @@ protected function createRequest($component, $destination, array $args, $mode)
970973 }
971974
972975 // CONSTRUCT URL
973- static $ refUrl ;
974- if ($ refUrl === NULL ) {
975- $ refUrl = new Http \Url ($ this ->httpRequest ->getUrl ());
976- $ refUrl ->setPath ($ this ->httpRequest ->getUrl ()->getScriptPath ());
976+ if ($ this ->refUrlCache === NULL ) {
977+ $ this ->refUrlCache = new Http \Url ($ this ->httpRequest ->getUrl ());
978+ $ this ->refUrlCache ->setPath ($ this ->httpRequest ->getUrl ()->getScriptPath ());
977979 }
978980 if (!$ this ->router ) {
979981 throw new Nette \InvalidStateException ('Unable to generate URL, service Router has not been set. ' );
980982 }
981- $ url = $ this ->router ->constructUrl ($ this ->lastCreatedRequest , $ refUrl );
983+ $ url = $ this ->router ->constructUrl ($ this ->lastCreatedRequest , $ this -> refUrlCache );
982984 if ($ url === NULL ) {
983985 unset($ args [self ::ACTION_KEY ]);
984986 $ params = urldecode (http_build_query ($ args , NULL , ', ' ));
@@ -987,7 +989,7 @@ protected function createRequest($component, $destination, array $args, $mode)
987989
988990 // make URL relative if possible
989991 if ($ mode === 'link ' && $ scheme === FALSE && !$ this ->absoluteUrls ) {
990- $ hostUrl = $ refUrl ->getHostUrl () . '/ ' ;
992+ $ hostUrl = $ this -> refUrlCache ->getHostUrl () . '/ ' ;
991993 if (strncmp ($ url , $ hostUrl , strlen ($ hostUrl )) === 0 ) {
992994 $ url = substr ($ url , strlen ($ hostUrl ) - 1 );
993995 }
0 commit comments