UrlScript->getScriptPath/getPathInfo return different values compared to documentation

Notice: This thread is very old.
wisepenguin
Member | 1
+
0
-

Hi,
UrlScript API docs

The docs mention

>[UrlScript API docs]

  • scriptPath: /admin/script.php (or simply /admin/ when script is directory index)
  • pathInfo: /pathinfo/ (additional path information)

I agree with the docs and think it makes sense. It's also the convention followed by Symfony 2; Symfony 2 Request::getPathInfo would have “/” at the start.

However, the actual implementation in Nette 2.0.3 leaves “/” at the end of getScriptPath and removes it from getPathInfo – which is contrary to the Nette documentation.

As 2.0.3 is released I guess the 2 API is stable which means changing it to how the docs mention would break backwards compatibility, so correcting the docs is probably the only option for 2.0.x.

The Nette tests also assume “/” is at the end of getScriptPath and not at the start of getPathInfo, is there any reason for this? I think the Nette documentation and Symfony 2 getPathInfo results which agree with it are the better way.

Anyway, I'm finding Nette 2.0.3 good so far, although would prefer more English documentation. However, I'd also like to say thanks for what is already there!

ps. I've also added the following snippet to the “RoutingPanel.panel.html”

<div>
	<h2>Request Information</h2>
	<table>
		<tr>
			<th>Script Path</th>
			<td><?php echo htmlSpecialChars($this->httpRequest->getUrl()->getScriptPath()) ?></td>
		</tr>
		<tr>
			<th>Path Info</th>
			<td><?php echo htmlSpecialChars($this->httpRequest->getUrl()->getPathInfo()) ?></td>
		</tr>
	</table>
</div>

ps. I really like that security is one of the top features of Nette, please don't stop that.

Cheers