Skip to content

UrlScript is not standalone - it brokes expected getBasePath behavioral  #100

Description

@SlavaAurim

I cannot use class Nette\HttpUrlScript "smoothly", as standalone (its needed for me for extending of Nette\Http\Request class).

For example:

$url = new \Nette\Http\UrlScript("http://nette.org/admin/script.php/pathinfo/?name=param#fragment");
echo $url->basePath; // expected '/admin/', but output is '/'

My suggestions:

You can specify in the constructor the minimum default functionality, suitable for most cases. My simple example:

class UrlScript extends Url
{
    ...

    public function __construct($url = NULL)
    {
        parent::__construct($url);
        $this->scriptPath =  $this->path;       
    }

    ...
}

With this patch any descendant class of UrlScript (if its instance was created standalone, not from RequestFactory), will have same behavioral as the class Url (in method getBasePath, getRelativeUrl and other).

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions