Page 1 of 2

Fatal Error: Unsupported operand types router.php

Posted: Sat Feb 16, 2008 1:57 am
by ahuppert
I have no idea what happened, but I created a new user in my registration screen and went to login as that person (to test the system) and now when I click "Login", whether I enter a username and password or not, I get the following error:

Fatal error: Unsupported operand types in /home/ahuppert/public_html/popchurch/includes/router.php on line 141

Line 141 reads: $vars = $vars + $item->query;

I have looked all through Google and various support sites for Joomla... I'm not sure where to go as no one has posted a fix for this. Any suggestions?

If you want to see the error live, goto https://74.54.176.146/~ahuppert/popchurch/ and click on LOGIN at the bottom LEFT, or simply go to the following link:

https://74.54.176.146/~ahuppert/popchur ... d=usermenu

Andrew

Re: Fatal Error: Unsupported operand types router.php

Posted: Sat Feb 16, 2008 6:14 pm
by ahuppert
SOLUTION:

For anyone else running into this problem, I figured it out on my own. What happened was that in the MOD_LOGIN I had set the login redirect to a menu-item that I had created. The problem was that the menu-item was set to ARTICLE and the actual article it was linked to had been deleted in housekeeping. So, the code is correct, it is simply trying to return a VALUE that does not exist. Instead of returning an error or a 404 not found, it returns the ominous message that an operand type is unsupported.

All I had to do was link that menu item to another article and the code worked like a charm. I hope this helps anyone else looking for a solution to this problem.

I happened to notice that many of the other people with this same problem also used COMMUNITY BUILDER. Check your CB page pointers for once the person logs on correctly or incorrectly... perhaps it is pointing to a menu or an article or a form that simply does not exist..

Andrew

Re: Fatal Error: Unsupported operand types router.php

Posted: Thu Feb 28, 2008 5:39 pm
by April_Floyd
I get this type of error when I use the contac form, but only in firefox 2, not in ie7, or opera ior ie6

Re: Fatal Error: Unsupported operand types router.php

Posted: Fri Mar 07, 2008 5:39 pm
by Run4it
I am getting this error with the contact form also and the browser doesn't matter. I need a contact form. Does anyone have a solution, or even a path to look down? I am not a .php programmer so I am really in the dark on this one.

Re: Fatal Error: Unsupported operand types router.php

Posted: Sun Mar 09, 2008 9:36 pm
by BernardE
Thanks a lot Andrew, this is just the problem I had. I ever tried to reinstall. Just shows you - check the forum first!

Re: Fatal Error: Unsupported operand types router.php

Posted: Tue Mar 18, 2008 5:49 pm
by wadscookin
Hi Andrew, after much frustration I finally Googled the net and found your solution to this error! Many thanks for this and I kick myself for not checking the forums sooner. :)

Re: Fatal Error: Unsupported operand types router.php

Posted: Tue Sep 16, 2008 11:05 pm
by bas123
I just came across this error:
Fatal error: Unsupported operand types in JROOT/includes/router.php on line 140
The only time this happened was when trying to login while the page was showing search results.

I am not quite sure how I'd resolve this with Andrew's (ahuppert) solution.

Anyone else have a thought?

Re: Fatal Error: Unsupported operand types router.php

Posted: Mon Sep 22, 2008 5:51 pm
by quiquedcode
Hi bas123
I've also had this error this morning (sent by a client) and then googled and found this thread.

As far I've read in some forums, etc. it seems it is a problem related to SEF. Disable it, or change the way sef urls are generated, and this should solve the problem.

Let us know if this worked (it did for me)

Re: Fatal Error: Unsupported operand types router.php

Posted: Mon Jan 12, 2009 3:29 am
by sreekanth
Andrew,
Thanks much. I had the same problem and was able to find the reason with your helpful note.
Thanks for sharing.
-Sreekanth

Re: Fatal Error: Unsupported operand types router.php

Posted: Fri Feb 13, 2009 5:46 am
by matew
I got the same problem when I tried to send a mail in " Enquiry about the Product", in virtuemart.
As I got many Errors with virtuemart and joomla!, So I used a Patch Package of joomla to upgrade my current joomla.It Helped me to fix alot of bugs.But now again got an error saying that "Fatal error: Unsupported operand types in includes/router.php on line 148". Any Solution......

Thanks In advance. ;)

Re: Fatal Error: Unsupported operand types router.php

Posted: Mon Feb 16, 2009 8:41 pm
by cb3
fixed it for me too, thanks very much

Re: Fatal Error: Unsupported operand types router.php

Posted: Wed Mar 04, 2009 6:11 pm
by HeinzAhoy
This really IS cool: finding such a solution (on a silver plate) just when you needed it!!!
Thanks so much Andrew!!

Re: Fatal Error: Unsupported operand types router.php

Posted: Fri Mar 13, 2009 2:45 pm
by Santander
Great idea Guy !
Same problem and it was a confilct between Community Builder Login module and some other module which remainded after I had uninstalled CB.

Everything works perfect now
Many thanks

Re: Fatal Error: Unsupported operand types router.php

Posted: Mon Mar 30, 2009 10:57 am
by Gianluca949
Andrew, You are my hero!!! I had this problem and now it is OK ...... Thanks

Re: Fatal Error: Unsupported operand types router.php

Posted: Mon Mar 30, 2009 3:22 pm
by colorado2rein
Yep, links issue. Mine was not related to login, but general housekeeping and deleting old articles/menu items/cats/sections. Thanks for a quick point in the right direction for us newbs!

Re: Fatal Error: Unsupported operand types router.php

Posted: Fri Apr 03, 2009 7:47 am
by Kotsolis
All I had to do was link that menu item to another article and the code worked like a charm. I hope this helps anyone else looking for a solution to this problem.

I happened to notice that many of the other people with this same problem also used COMMUNITY BUILDER. Check your CB page pointers for once the person logs on correctly or incorrectly... perhaps it is pointing to a menu or an article or a form that simply does not exist..
Hi, can you tell me how to do all this stuff as I'm a noob? I didn't even realised what you're telling here.

Re: Fatal Error: Unsupported operand types router.php

Posted: Tue Apr 28, 2009 8:58 am
by magic22
Andrew, You made my day. Thank you.

Just to add that in my case, the article was there (and published), but the menu item that my login was redirected to, was disabled. Changed that and all is working fine.

Thanks again. This is the true and ideal society, helping each other without return expectations!

/MajicMan

Re: Fatal Error: Unsupported operand types router.php

Posted: Fri May 29, 2009 6:07 pm
by dannette
For those with the problem and the contact form - I had the problem too but found I couldn't just link to the contact form without it actually being a menu item first.

Re: Fatal Error: Unsupported operand types router.php

Posted: Sun May 31, 2009 4:02 pm
by azhararmar
ahuppert wrote:SOLUTION:

For anyone else running into this problem, I figured it out on my own. What happened was that in the MOD_LOGIN I had set the login redirect to a menu-item that I had created. The problem was that the menu-item was set to ARTICLE and the actual article it was linked to had been deleted in housekeeping. So, the code is correct, it is simply trying to return a VALUE that does not exist. Instead of returning an error or a 404 not found, it returns the ominous message that an operand type is unsupported.

All I had to do was link that menu item to another article and the code worked like a charm. I hope this helps anyone else looking for a solution to this problem.

I happened to notice that many of the other people with this same problem also used COMMUNITY BUILDER. Check your CB page pointers for once the person logs on correctly or incorrectly... perhaps it is pointing to a menu or an article or a form that simply does not exist..

Andrew

Wow, i had the exact problem.. i was redirecting the login module to the link that was deleted.. thanks for bringing it to notice.. everything is working fine now....:)

Re: Fatal Error: Unsupported operand types router.php

Posted: Mon Jun 15, 2009 3:45 am
by carterx
ahuppert wrote:SOLUTION:

For anyone else running into this problem, I figured it out on my own. What happened was that in the MOD_LOGIN I had set the login redirect to a menu-item that I had created. The problem was that the menu-item was set to ARTICLE and the actual article it was linked to had been deleted in housekeeping. So, the code is correct, it is simply trying to return a VALUE that does not exist. Instead of returning an error or a 404 not found, it returns the ominous message that an operand type is unsupported.

All I had to do was link that menu item to another article and the code worked like a charm. I hope this helps anyone else looking for a solution to this problem.

I happened to notice that many of the other people with this same problem also used COMMUNITY BUILDER. Check your CB page pointers for once the person logs on correctly or incorrectly... perhaps it is pointing to a menu or an article or a form that simply does not exist..

Andrew

Thanks, this was my issue.

Re: Fatal Error: Unsupported operand types router.php

Posted: Tue Jun 16, 2009 7:54 am
by fcsites
On my site, using JForms I´d unpublished a menu element linked also from a content article, so the form was visible and the visitors could see it (the form was published) but when they submitted the form... got the error.

Thanks.

Re: Fatal Error: Unsupported operand types router.php

Posted: Thu Jul 09, 2009 8:29 pm
by farrowz
Thanks for the hint Andrew, but I didn't like your solution as it doesn't fix all cases. I therefore decided to modify the code. Here is the original function.

Code: Select all

	
function _parseRawRoute(&$uri)
	{
		$vars   = array();

		$menu =& JSite::getMenu(true);

		//Handle an empty URL (special case)
		if(!$uri->getVar('Itemid') && !$uri->getVar('option'))
		{
			$item = $menu->getDefault();
			if(!is_object($item)) return $vars; // No default item set

			//Set the information in the request
			$vars = $item->query;

			//Get the itemid
			$vars['Itemid'] = $item->id;

			// Set the active menu item
			$menu->setActive($vars['Itemid']);

			return $vars;
		}

		//Get the variables from the uri
		$this->setVars($uri->getQuery(true));

		//Get the itemid, if it hasn't been set force it to null
		$this->setVar('Itemid', JRequest::getInt('Itemid', null));

		//Only an Itemid ? Get the full information from the itemid
		if(count($this->getVars()) == 1)
		{
			$item = $menu->getItem($this->getVar('Itemid'));
ERROR---->	$vars = $vars + $item->query;
		}

		// Set the active menu item
		$menu->setActive($this->getVar('Itemid'));

		return $vars;
	}
If you notice above the offending line, the function handles the "empty URL" case that redirects the user to the default menu. By modifying the original code, I tested for a valid object $item. If it is not valid (causing the error) I then redirect to the default page.

Here is the modified code:

Code: Select all

	function _parseRawRoute(&$uri)
	{
		$vars   = array();

		$menu =& JSite::getMenu(true);

		//Handle an empty URL (special case)
		if(!$uri->getVar('Itemid') && !$uri->getVar('option'))
		{
			$item = $menu->getDefault();
			if(!is_object($item)) return $vars; // No default item set

			//Set the information in the request
			$vars = $item->query;

			//Get the itemid
			$vars['Itemid'] = $item->id;

			// Set the active menu item
			$menu->setActive($vars['Itemid']);

			return $vars;
		}

		//Get the variables from the uri
		$this->setVars($uri->getQuery(true));

		//Get the itemid, if it hasn't been set force it to null
		$this->setVar('Itemid', JRequest::getInt('Itemid', null));

		//Only an Itemid ? Get the full information from the itemid
		if(count($this->getVars()) == 1)
		{
			$item = $menu->getItem($this->getVar('Itemid'));
// --- START OF NEW CODE ---
			if(!is_object($item)) {
				$item = $menu->getDefault();
				if(!is_object($item)) return $vars; // No default item set

				//Set the information in the request
				$vars = $item->query;

				//Get the itemid
				$vars['Itemid'] = $item->id;

				// Set the active menu item
				$menu->setActive($vars['Itemid']);

				return $vars;
			}
// --- END OF NEW CODE ---
			$vars = $vars + $item->query;
		}

		// Set the active menu item
		$menu->setActive($this->getVar('Itemid'));

		return $vars;
	}
I realize this is a core hack, but it solves my problems. Hope it helps :)

Re: Fatal Error: Unsupported operand types router.php

Posted: Thu Jul 23, 2009 3:11 pm
by Webbman66
Thanks to everyone trying to come up with fixes on this issue. I tried all possible solutions posted here but to no avail.
The only solution that worked for me was farrowz core hack. Thanks everyone!

Using J 1.5.12 with Chronoforms

Re: Fatal Error: Unsupported operand types router.php

Posted: Thu Sep 17, 2009 8:01 pm
by charleyhankins
I am getting the same error message when I try to enter a new event in JCal. I can enter an event from the admin section, but when I try from the front end, I receive that error. Any other thoughts?

Thanks,
CH

Re: Fatal Error: Unsupported operand types router.php

Posted: Sat Sep 26, 2009 1:26 am
by hearingv
Kotsolis wrote:
All I had to do was link that menu item to another article and the code worked like a charm. I hope this helps anyone else looking for a solution to this problem.
perhaps it is pointing to a menu or an article or a form that simply does not exist..
Hi, can you tell me how to do all this stuff as I'm a noob? I didn't even realised what you're telling here.
I found the same problem ,
Fatal error: Unsupported operand types in /home/hearingv/public_html/includes/router.php on line 148
I couldnt understand why, as I had directed it to the forum page which did exist
However When I checked, I found that there was two links for the forum in the menu selection for th log in module. I had clicked on the old one. Once I changed it to the new correct one I was okay.
If is a problem with the login- click Extensions/ then module manager. Click on "Log In Form" ( edit) Look at the Log In redirection setting on the Right hand side. There is one for Log in and one for Log Out. Ensure the menu item it is directed to DOES EXIST. That you havent since moved it or replaced it. Change it to one that does. CLick SAve. Then go and see what happens when you log in/ or out. Hopefully it will work. Mine does :)

Re: Fatal Error: Unsupported operand types router.php

Posted: Tue Sep 29, 2009 4:54 am
by masoesa
Thanks! It worked for me.

Re: Fatal Error: Unsupported operand types router.php

Posted: Mon Nov 09, 2009 7:25 am
by jotch_14
the best answer

Re: Fatal Error: Unsupported operand types router.php

Posted: Fri Dec 04, 2009 8:33 pm
by aalonie
This is EXACTLY what I needed! Much thanx

Re: Fatal Error: Unsupported operand types router.php

Posted: Fri Dec 04, 2009 9:34 pm
by solikatir
I have same problem with $vars = $vars + $item->query;
webmaster tool detect it but unable to find the bug.

Re: Fatal Error: Unsupported operand types router.php

Posted: Fri Dec 11, 2009 3:34 pm
by kentmorrison
I had a similar problem that started like this:

I created a new contact, for a special purpose.
Since I always have a TERRIBLE time figuring out the URL of such pages, I turned SEO OFF so that the real mangled numeric URL was visible.

I had neglected to turn the SEO back on.

When I turned it back on, the email contact form worked.
But it still does not send the Contact Form User to a THANK YOU FOR THE MESSAGE page... :(

Thanks to all for the expert help!

Regards,
Kent Morrison