Welcome to Geeklog, Anonymous Monday, May 27 2024 @ 08:34 pm EDT

Geeklog Forums

URL /rewrite / Class Error revisited


tokyoahead

Anonymous
Hi all

I just checked further on the problem with the URL-Rewrite error.

Text Formatted Code
URL Class: number of names passed to setArgNames must be equal or greater than number of arguments found in URL

 


I dont know how many people out there actually use the rewriting, but things like to google page ranking depend on this so I think its a pretty important thing.

The issue is the following:

when you use it, you get links in this format (in links.php for example:

Text Formatted Code
http://tokyoahead.local/main/portal.php/link/20031013074333632

 


However, once you klick on them, they translate into

Text Formatted Code
http://tokyoahead.local/main/portal.php/link/20031013074333632/

 

(note the / at the end)

I dont know why, but the link once klicked on gets the /, in Opera and firefox.
This results in a wrong number of arguments since the URL class explodes the string on the / and gets 3 results, one too many. I changed the respective code in the class to see what is going on:

Text Formatted Code
 if (count($names) < count($this->_arguments)) {
print "URL Class: number of names passed to setArgNames must be equal or greater than number of arguments found in URL";
echo "<BR>" . implode("-",$names) . "<br>";
echo implode("-",$this->_arguments) . "<br>";
exit;

 


the result shows the problem:


URL Class: number of names passed to setArgNames must be equal or greater than number of arguments found in URL
what-item
link-20031013074333632-


note the - after the link id, indicating that the url translated into a third argument since there was a / at the end.
I solved the whole thing crudely by adjusting the following code

Text Formatted Code
for ($i = 1; $i <= count($this->_arguments); $i++) {

 


to

Text Formatted Code
for ($i = 1; $i <= count($names); $i++) {

 


but is all of this normal? where does the additional / come from ? is this OS-specific?
how can this be solved? is it a bug or a feature? who else has this problem??
 Quote

ted

Anonymous
it is normal... it is actually browser specific and is not a bug. It is a browser's way of properly translating (for lack of the proper word) directory structurers in http. or something like that. some browsers will add the slash whenever there is no file specified.
 Quote

tokyoahead

Anonymous
ah ok

so in the end the url class has to be rewritten to strip the trailing slash i guess
 Quote

All times are EDT. The time is now 08:34 pm.

  • Normal Topic
  • Sticky Topic
  • Locked Topic
  • New Post
  • Sticky Topic W/ New Post
  • Locked Topic W/ New Post
  •  View Anonymous Posts
  •  Able to post
  •  Filtered HTML Allowed
  •  Censored Content