0

I have a php page that processes 2 parameters on the URL that calls it. I can't figure out why jinput->get works sometimes but not every time. The code is:

$jinput = JFactory::getApplication()->input;
$source = $jinput->get('source', "", 'string');
$volume = $jinput->get('volume', "", 'string');

and the following URLs work only if the previous URL had a different volume number:

Example:

URL 1.
http://ilfvgs.org/index.php/online-data/mi/volume?source=IN&volume=13,%2303 works fine returning the correct $volume = "13,#03"

URL 2. http://ilfvgs.org/index.php/online-data/mi/volume?source=IN&volume=13,%2306 works but not if it is used just after URL 1. If this call came after URL 1., jinput->get() returns $volume = "13,#03" instead of "13,#06"

If the volume is changed to "14,#02", it will work correctly (unless the previous call was for "14,#01"). So it appears that the volume parameter is only getting reloaded if the number at the start of the volume (e.g. 13 or 14) changes!

This fails regardless of the numbers involved. For example the same thing occurs if the volume is "10,#1" and "10,#2" for URL 1, and 2 (using an appropriate source).

Using Joomla! 2.5.16

  • 1
    It might not solve your problem, but you should really upgrade to the latest Joomla version for security. That's version 2.5.28. – johanpw Oct 18 '15 at 4:51
1

It could be due to some caching, where the code is executed again only for a "different" request - caching plugin may have a bug that they don't differentiate elements in URL after the comma

  • Excellent suggestion. I tried adding a "," after getting the volume parameter and it still didn't work. Then I tried eliminating the "#" from the volume parameter and leaving in the ",". Again I added the "#" back after getting the volume parameter and it works every time. So this does look like a bug in the caching plugin that stops differentiating after a special character (or at least after "#". – JimW Oct 18 '15 at 20:39
  • @JimW Looked at a list of characters allowed in an URL and it seems that while ´#´ is allowed it is classified as a "gen-delim", just like '?'. So it has the same precedence and cuts the sequence started by the '?'. I am guessing the jinput and caching are simply using different versions of the spec. And caching is actually more correct (read: uses more recent spec). For that matter it looks like the comma shouldn't work either, but caching passes parsing contents to jinput so it works. Either add a new parameter or use a special delimeter that isn't one in the URL spec. Like a letter. – Ville Niemi Oct 18 '15 at 21:21
  • @JimW LOL. Being dumb, I am. Obviously '#' has a specific meaning as a delimeter when used in an URL. Gen-delim indeed. Also an underscore might be a simpler delimeter in the parameter than a letter. You can of course complain to devs about caching decoding the url-encode %23 before parsing, it probably shouldn't be doing that. – Ville Niemi Oct 18 '15 at 21:31
0

It appears there is a bug in the Joomla caching plugin that doesn't refresh if the it thinks the URL has not changed. It apparently does not process the URL beyond a "#" character. I verified this by removing the "#" from the URL parameter (and then adding it back to make the following database query work) and the URL parameter was correctly updated every time. Thanks to Marko D for suggesting it might not be processing the parameter after the "," which was the right idea but not the right character.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.