[TYPO3-english] Betr: Re: Two problems with coolURI

Roy van Lamoen mailinglists at telfort.nl
Fri Jul 17 08:54:18 CEST 2009


Hi Jan,

first of all thanks for your time. As a software tester, I've done some analysis
on the long URI problem (rather long text below). Hope it is of any help.

>> But, if the pagepath, which, in case of a tt_news item actually is /menu-item/news-item-title,
>> gets too long, the linked page cannot be found.
>
>The link is generated and saved to DB into a field with limited length 
>of 255. The link doesn't look that long. But I don't see any other 
>explanation. Check out what's saved in your DB.

I've made a new news-item, titled 'Testnieuws item to show you what happens
if the title of a news item gets too long'. The complete (cool)URI is: http://www.hbs-artemis.nl/nieuws/testnieuws-item-to-show-you-what-happens-if-the-title-of-a-news-item-gets-too-long/

Stored id DB.link_cache is: nieuws/testnieuws-item-to-show-you-what-happens-if-the-title-of-a-news-item-gets-too-long/

Result when clicking the link: page not found.

So I changed the record to nieuws/testnieuws-item/. Obviously, the link worked
correctly now.

I've built up the link word by word until it was nieuws/testnieuws-item-to-show-you-what-happens/.
This results in a 404.

Then I started to shorten the link, letter by letter. Last link returning
an 404 error is nieuws/testnieuws-item-to-show-you-what-happen/. At nieuws/testnieuws-item-to-show-you-what-happe/,
something strange happens. When I click this link, I return to the homepage???

At this moment I started to think my hack in class.tx_cooluri.php may had
something to do with it. In function extractArraysFromParams I added the
line "if ($params==null) return false;" (preceding the foreach) to 'solve'
problem 2. Maybe it has something to do with this problem as well, so I removed
the line. Clicked the link, but still returned to the homepage. Furthermore,
PHP warning where thrown and the sites CSS and images were not downloaded.
The following warning where thrown:

--------- Warnings start ---------
Warning: Invalid argument supplied for foreach() in /storage/mijndomein/users/139348/public/sites/www.hbs-artemis.nl/typo3conf/ext/cooluri/class.tx_cooluri.php
on line 425

Warning: implode() [function.implode]: Bad arguments. in /storage/mijndomein/users/139348/public/sites/www.hbs-artemis.nl/typo3conf/ext/cooluri/class.tx_cooluri.php
on line 428

Warning: Cannot modify header information - headers already sent by (output
started at /storage/mijndomein/users/139348/public/sites/www.hbs-artemis.nl/typo3conf/ext/cooluri/class.tx_cooluri.php:425)
in /storage/mijndomein/users/139348/public/sites/www.hbs-artemis.nl/typo3/sysext/cms/tslib/class.tslib_fe.php
on line 3226
--------- Warnings end---------

This is on the original code! When I add the line 'if ($params==null) return
false;' to function extractArraysFromParams, I don't get these warning, I
just return to the homepage.

Shortening the link one more letter to nieuws/testnieuws-item-to-show-you-what-happ/
solves the problem: the news item is shown as it should be.

So, if the length of the string in DB.link_cache.url <= 45, everything is
ok, ==46 then it returns to the homepage and >46 it can't find the page...

The problem also occurs on a normal page. Maybe some variable thats overflowing?

>> Problem 2:
>> Another thing I've had in the passed is with double slashes. When I add
>an
>> additional slash to the pagepath (for instance http://bla.com/link//)
it
>> does show the correct page but the URI consist of the complete(!) Unix
>path.
>> When I 'double slash' the domainname, it returns a couple of PHP errors.
>
>And why would you do that? The Unix path is strange as CoolUri doesn't 
>work with filesystem. I'd say, that this is not a supported use-case ;)

Like I said, I'm a software tester. I like to test behaviour in not supported
use cases ;-)

When adding a double slash on the the domainname only, I get the following
warning on the original coolURI code:
----------- Warnings start -----------
Warning: Invalid argument supplied for foreach() in /storage/mijndomein/users/139348/public/sites/www.hbs-artemis.nl/typo3conf/ext/cooluri/class.tx_cooluri.php
on line 425

Warning: implode() [function.implode]: Bad arguments. in /storage/mijndomein/users/139348/public/sites/www.hbs-artemis.nl/typo3conf/ext/cooluri/class.tx_cooluri.php
on line 428

Warning: Cannot modify header information - headers already sent by (output
started at /storage/mijndomein/users/139348/public/sites/www.hbs-artemis.nl/typo3conf/ext/cooluri/class.tx_cooluri.php:425)
in /storage/mijndomein/users/139348/public/sites/www.hbs-artemis.nl/typo3/sysext/cms/tslib/class.tslib_fe.php
on line 3226
----------- Warnings end -----------

Double slashing URL with coolURI links gives me the full Unix path

Adding the above mentioned code changes (In function extractArraysFromParams
"if ($params==null) return false;" preceding the foreach) makes the warnings
disappear. The Unix path problem still remains however.

But then again, double slashing URL's is indeed on not supported use case
I guess... ;-)

Alright, a rather long reply. I hope this makes it a bit easier to get to
a solution.

Kind regards,

Roy van Lamoen


       




More information about the TYPO3-english mailing list