Intermittent form errors after upgrade to 2.5.10 and 2.5.11

General questions relating to Joomla! 2.5. Note: All 1.6 and 1.7 releases have reached end of life and should be updated to 2.5. There are other boards for more specific help on Joomla! features and extensions.

Moderator: General Support Moderators

Forum rules
Forum Rules
Absolute Beginner's Guide to Joomla! <-- please read before posting.
Forum Post Assistant - If you are serious about wanting help, you should use this tool to help you post.
lrfandet
Joomla! Apprentice
Joomla! Apprentice
Posts: 9
Joined: Mon Apr 29, 2013 3:33 pm

Intermittent form errors after upgrade to 2.5.10 and 2.5.11

Postby lrfandet » Mon Apr 29, 2013 3:52 pm

When clients try to submit a php form which worked in 2.5.9, they sometimes get the following error and on many devices - but sometimes it all works ok:

Fatal error: Uncaught exception 'InvalidArgumentException' with message 'Invalid URI detected.' in /home/t/i/mysite/web/public_html/libraries/joomla/environment/uri.php:194 Stack trace: #0 /home/t/i/mysite/web/public_html/libraries/joomla/application/application.php(248): JURI::getInstance() #1 /home/t/i/mysite/web/public_html/includes/application.php(135): JApplication->route() #2 /home/t/i/mysite/web/public_html/index.php(36): JSite->route() #3 {main} thrown in /home/t/i/mysite/web/public_html/libraries/joomla/environment/uri.php on line 194

One client reported seeing a message that they did not have permission to view content - but they do - then the above message appeared when I used the form myself.

Cacheing is off, SEO is off, .htaccess is renamed htaccess.txt.

What's happening?

BenCollver
Joomla! Apprentice
Joomla! Apprentice
Posts: 14
Joined: Fri Apr 13, 2007 6:40 pm

Re: Intermittent form errors after upgrade to 2.5.10 and 2.5

Postby BenCollver » Mon Apr 29, 2013 4:49 pm

Joomla 2.5.10 introduced the change below. You can work around this error by changing your PHP code to use the rawurlencode() function instead of the urlencode() function.

-Ben

Code: Select all

--- 2.5.9/libraries/joomla/environment/uri.php      2013-02-03 17:23:49.000000000 -0800
+++ 2.5.10/libraries/joomla/environment/uri.php      2013-04-23 09:45:00.000000000 -0700
@@ -187,6 +187,12 @@
                                                $theURI .= '?' . $_SERVER['QUERY_STRING'];
                                        }
                                }
+
+                               // Check for quotes in the URL to prevent injections through the Host header
+                               if ($theURI !== str_replace(array("'", '"', '<', '>'), '', $theURI))
+                               {
+                                       throw new InvalidArgumentException('Invalid URI detected.');
+                               }
                        }
                        else
                        {

lrfandet
Joomla! Apprentice
Joomla! Apprentice
Posts: 9
Joined: Mon Apr 29, 2013 3:33 pm

Re: Intermittent form errors after upgrade to 2.5.10 and 2.5

Postby lrfandet » Mon Apr 29, 2013 8:35 pm

The check for quotes in the URI seems not to be the source of the problem: Others are using the component with Joomla 2.5.11 without any issues. What else could cause this?

User avatar
chrisjclay
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 132
Joined: Thu Sep 18, 2008 6:05 pm
Location: Vancouver Island, Canada
Contact:

Re: Intermittent form errors after upgrade to 2.5.10 and 2.5

Postby chrisjclay » Wed May 01, 2013 4:43 am

Hmm, the 2.5.10 change that BenCollver describes above broke my client's online booking system. Frustrating! My client is using Appointment Booking Pro... Now the booking form won't submit, and the developer reports that this error is the cause:

Fatal error: Uncaught exception 'InvalidArgumentException' with message 'Invalid URI detected.' in /home/admin2/public_html/J25_test/libraries/joomla/environment/uri.php:194 Stack trace: #0

The AB Pro developer is investigating further... I wonder if that change could have been done in a way that wouldn't break some Joomla components?

Chris
Clay & Co.
Web development powered by Joomla!

Web: www.clayco.ca
Twitter: http://www.twitter.com/clayco_ca

charoa
Joomla! Apprentice
Joomla! Apprentice
Posts: 25
Joined: Wed Jun 18, 2008 7:26 pm

Re: Intermittent form errors after upgrade to 2.5.10 and 2.5

Postby charoa » Wed May 01, 2013 3:03 pm

in my case it only happens with an apostrophe in the search or tag. I am reluctant to change the core of joomla since i will have to remember to make this change with every upgrade. Has anyone come up with another solution? does it also happen with apostrophes in the titles?

also i am not clear on what the changes are that i should make based on the code shown above. how does one change to rawurlencode() function instead?

lrfandet
Joomla! Apprentice
Joomla! Apprentice
Posts: 9
Joined: Mon Apr 29, 2013 3:33 pm

Re: Intermittent form errors after upgrade to 2.5.10 and 2.5

Postby lrfandet » Wed May 01, 2013 4:27 pm

I am also using Appointment Booking Pro. I plan to roll back to 2.5.9 until AB Pro catches up. Restoring the full site backup looks like a nightmare - soooo...

Would it be ok to just install 2.5.9 over 2.5.11? :-\

charoa
Joomla! Apprentice
Joomla! Apprentice
Posts: 25
Joined: Wed Jun 18, 2008 7:26 pm

Re: Intermittent form errors after upgrade to 2.5.10 and 2.5

Postby charoa » Wed May 01, 2013 5:47 pm

i just replaced the uri.php from 2.5.9 and nothing else and everything is working again. make sure you take a backup of the 2.5.11 uri in case you need to restore it.

lrfandet
Joomla! Apprentice
Joomla! Apprentice
Posts: 9
Joined: Mon Apr 29, 2013 3:33 pm

Re: Intermittent form errors after upgrade to 2.5.10 and 2.5

Postby lrfandet » Wed May 01, 2013 6:10 pm

Thanks Charoa.

Does anyone know the easiest place to find uri.php for 2.5.9?

Ah... :-[

http://www.php.joomlademo.de/nav.html?libraries/joomla/environment/uri.php.source.html
Last edited by lrfandet on Wed May 01, 2013 6:19 pm, edited 1 time in total.

charoa
Joomla! Apprentice
Joomla! Apprentice
Posts: 25
Joined: Wed Jun 18, 2008 7:26 pm

Re: Intermittent form errors after upgrade to 2.5.10 and 2.5

Postby charoa » Wed May 01, 2013 6:12 pm

2.5.9/libraries/joomla/environment/uri.php

lrfandet
Joomla! Apprentice
Joomla! Apprentice
Posts: 9
Joined: Mon Apr 29, 2013 3:33 pm

Re: Intermittent form errors after upgrade to 2.5.10 and 2.5

Postby lrfandet » Wed May 01, 2013 6:20 pm

Thank you Charoa

lrfandet
Joomla! Apprentice
Joomla! Apprentice
Posts: 9
Joined: Mon Apr 29, 2013 3:33 pm

Re: Intermittent form errors after upgrade to 2.5.10 and 2.5

Postby lrfandet » Wed May 01, 2013 8:25 pm

Appointment Booking Pro users will now find a solution which avoids changes to the Joomla core code or replacing uri.php with the obsolete version.

Find it in the Soft Ventures Inc. support forum - topic: InvalidArgumentException . :)

charoa
Joomla! Apprentice
Joomla! Apprentice
Posts: 25
Joined: Wed Jun 18, 2008 7:26 pm

Re: Intermittent form errors after upgrade to 2.5.10 and 2.5

Postby charoa » Wed May 01, 2013 10:18 pm

i don't use the appointment booking pro extension. i did however have this issue with k2 tags and joomla searches that contained an apostrophe. in my opinion there remains a functionality issue and though i haven't had a chance to test this on other 2.5.10+ sites with k2 and doing a search YET, i will surely post if the problem occurs again. i don't like to make changes in the core either so a better solution would be ideal if anyone has one.

cyberpasta
Joomla! Intern
Joomla! Intern
Posts: 81
Joined: Fri Feb 20, 2009 12:30 am

Re: Intermittent form errors after upgrade to 2.5.10 and 2.5

Postby cyberpasta » Thu May 02, 2013 10:56 am

I have this problem but I don't know where is produced. I don't use K2 nor any booking syste. I use joomla-kunena-communitybuilder-jReviews

User avatar
nonumber
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 223
Joined: Mon Sep 18, 2006 1:17 pm
Contact:

Re: Intermittent form errors after upgrade to 2.5.10 and 2.5

Postby nonumber » Fri May 03, 2013 11:02 am

To know what urls are causing this issue, you can change line 194 of file /libraries/joomla/environment/uri.php from:

Code: Select all

throw new InvalidArgumentException('Invalid URI detected.');

To:

Code: Select all

throw new InvalidArgumentException('Invalid URI detected in: ' . $theURI);

In my case I found that several urls were ending with a quote. This often happens when people are retweeting stuff and that tweet surrounded in quotes. Then the ending quote is seen as pat of the url.
Or it can happen when there is something wrong in the html output of the page containing the link.

Anyway, to fix these urls I simply added a rewrite rule in my .htaccess:

Code: Select all

RewriteRule ^(.*)['"$] /$1 [R=301,L]

PS: This line should be somewhere under the 'RewriteEngine On' line.
NoNumber.nl - Extensions for Joomla!
Advanced Module Manager, Articles Anywhere, Better Preview, CDN for Joomla!, Cache Cleaner, Components Anywhere, DB Replacer, Modals, Modules Anywhere, ReReplacer, Sliders, Sourcerer, Tabs, Tooltips, What? Nothing!

User avatar
hardyman
Joomla! Intern
Joomla! Intern
Posts: 57
Joined: Sat Nov 25, 2006 4:41 pm
Location: Corona, Ca

Re: Intermittent form errors after upgrade to 2.5.10 and 2.5

Postby hardyman » Tue Jul 16, 2013 1:15 am

I tried the HTACCESS fix on 3.1.1 and it didn't help any. Has anybody else found another fix?

webmasterhlc
Joomla! Fledgling
Joomla! Fledgling
Posts: 2
Joined: Wed Aug 21, 2013 6:37 pm

Re: Intermittent form errors after upgrade to 2.5.10 and 2.5

Postby webmasterhlc » Wed Aug 21, 2013 6:54 pm

Since updating to 2.5.14, I am getting this errors as well. It's like a regular expression has gone missing and the apostrophe ' character is no longer being parsed correctly. I have a custom component that passes GET variables and they are bombing the SEF when they contain an apostrophe. Interestingly, I can see that the space character is encoded correctly (from space to %20). Apostrophes should be encoded from ' to %27, but that's no longer happening (and it used to).

Also interesting: if i pass %27 in a URL, I get the error.

I tried the rewrite in .htaccess with no luck.

I replaced uri.php with the version from 2.5.9 and the problem is resolved.

I hope that the (amazing) Joomla dev team take a look at this and discover that something simple was just omitted!

tpepernic
Joomla! Intern
Joomla! Intern
Posts: 86
Joined: Mon May 23, 2011 3:12 am

Re: Intermittent form errors after upgrade to 2.5.10 and 2.5

Postby tpepernic » Wed Sep 11, 2013 3:10 am

Just came across this myself. This bug report seems to show progress: http://joomlacode.org/gf/project/joomla ... 36&start=0

Anyone know if this will get submitted to a release or where I can see the fix?

User avatar
Chacapamac
Joomla! Guru
Joomla! Guru
Posts: 738
Joined: Wed Feb 20, 2008 6:50 am
Location: Canada, Montreal
Contact:

Re: Intermittent form errors after upgrade to 2.5.10 and 2.5

Postby Chacapamac » Thu Nov 07, 2013 4:10 pm

FORGET THOSE UNRELATED

:-[
Last edited by Chacapamac on Thu Nov 07, 2013 6:21 pm, edited 1 time in total.
Can God help us?
Marketing, SEO, Web development - Powered by Joomla!
http://www.grafcomm.ca/

webmasterhlc
Joomla! Fledgling
Joomla! Fledgling
Posts: 2
Joined: Wed Aug 21, 2013 6:37 pm

Re: Intermittent form errors after upgrade to 2.5.10 and 2.5

Postby webmasterhlc » Thu Nov 07, 2013 4:17 pm

That bug report was closed in August. I don't see evidence of this being looked at it. :'(

User avatar
Chacapamac
Joomla! Guru
Joomla! Guru
Posts: 738
Joined: Wed Feb 20, 2008 6:50 am
Location: Canada, Montreal
Contact:

Re: Intermittent form errors after upgrade to 2.5.10 and 2.5

Postby Chacapamac » Thu Nov 07, 2013 4:28 pm

FORGET THOSE UNRELATED

:-[
Last edited by Chacapamac on Thu Nov 07, 2013 6:21 pm, edited 1 time in total.
Can God help us?
Marketing, SEO, Web development - Powered by Joomla!
http://www.grafcomm.ca/

User avatar
Chacapamac
Joomla! Guru
Joomla! Guru
Posts: 738
Joined: Wed Feb 20, 2008 6:50 am
Location: Canada, Montreal
Contact:

Re: Intermittent form errors after upgrade to 2.5.10 and 2.5

Postby Chacapamac » Thu Nov 07, 2013 4:45 pm

FORGET THOSE UNRELATED

:-[
Last edited by Chacapamac on Thu Nov 07, 2013 6:20 pm, edited 1 time in total.
Can God help us?
Marketing, SEO, Web development - Powered by Joomla!
http://www.grafcomm.ca/

User avatar
Chacapamac
Joomla! Guru
Joomla! Guru
Posts: 738
Joined: Wed Feb 20, 2008 6:50 am
Location: Canada, Montreal
Contact:

Re: Intermittent form errors after upgrade to 2.5.10 and 2.5

Postby Chacapamac » Thu Nov 07, 2013 5:05 pm

FORGET THOSE UNRELATED

:-[
Last edited by Chacapamac on Thu Nov 07, 2013 6:19 pm, edited 1 time in total.
Can God help us?
Marketing, SEO, Web development - Powered by Joomla!
http://www.grafcomm.ca/

User avatar
Chacapamac
Joomla! Guru
Joomla! Guru
Posts: 738
Joined: Wed Feb 20, 2008 6:50 am
Location: Canada, Montreal
Contact:

Re: Intermittent form errors after upgrade to 2.5.10 and 2.5

Postby Chacapamac » Thu Nov 07, 2013 5:51 pm

FORGET THOSE UNRELATED

:-[
Can God help us?
Marketing, SEO, Web development - Powered by Joomla!
http://www.grafcomm.ca/

zeneri
Joomla! Fledgling
Joomla! Fledgling
Posts: 1
Joined: Wed Mar 26, 2014 8:31 pm

Re: Intermittent form errors after upgrade to 2.5.10 and 2.5

Postby zeneri » Wed Mar 26, 2014 8:37 pm

In my case, it helped to change the following code from

Code: Select all

            // Check for quotes in the URL to prevent injections through the Host header
            if ($theURI !== str_replace(array("'", '"', '<', '>'), '', $theURI))
            {
               throw new InvalidArgumentException('Invalid URI detected.');
            }


to

Code: Select all

            // Check for quotes in the URL to prevent injections through the Host header
            if ($theURI !== str_replace(array('"', '<', '>'), '', $theURI))
            {
               echo $theURI;
               throw new InvalidArgumentException('Invalid URI detected.');
            }


Return to “General Questions/New to Joomla! 2.5”

Who is online

Users browsing this forum: No registered users and 5 guests