Fatal Error when 404 page is thrown

davez

Member
Here's a weird little bug.

If I set my default home page as a Fabrik list, I get the following error when a user gets a 404, Page Not Found error:

Fatal error: Call to a member function getData() on a non-object in /.../components/com_fabrik/views/form/view.html.php on line 84

To clarify, this error only occurs on a page not found when a Fabrik list is set to the home page.

Lots of folks out there with this problem and they don't know it.
 
I found it occurring on the latest with update and 3.5 without the update. But if you check out the google search above, you'll see that it seems to be occurring widespread.

Edit: Oh, and you asked about Joomla version: 3.6.2
 
Last edited:
I can replicate.
It's only with SEF enabled.
It doesn't matter if the home menu is a Fabrik list or form (error is always ...components\com_fabrik\views\form\view.html.php on line 84

Notice: Undefined index: form in C:\xampp54\htdocs\j35\libraries\legacy\view\legacy.php on line 436
Notice: Undefined index: in C:\xampp54\htdocs\j35\libraries\legacy\view\legacy.php on line 436

Fatal error
: Call to a member function getData() on a non-object in C:\xampp54\htdocs\j35\components\com_fabrik\views\form\view.html.php on line 84
 
Hmmm. Yeah, seems like we don't have any 404 handling in our sef router.

And looking at the way other extensions handle this, it varies.

What J! seems to do is, if it can't determine the 'option' part of a SEF route, ie. can't figure out which extension it is, it grabs the home page menu item, and just sets the Itemid and the option, and calls the extensions route parser. In other words, it leaves it up to whatever extension has the home page menu item to decide what to do if the route doesn't exist. Some extensions then just toss a 404, and others will show their own "home" page, or whatever default page makes sense.

I'm in two minds as to what to do, so I've coded this up:

If our router is run and it can't figure out what the view is (which is the case when Fabri is the home menu item but it's a junk URL) it looks at the active menu, and if that it a com_fabrik one, it then breaks the menu link down and uses that to build the SEF vars for J!. In other words, it acts as if the home menu link was being loaded. But it puts up a syste info msg of "Resource not found".

If it can't parse the home menu item, it then throws a "real" 404.

What I can't really decide is whether I should bother trying to grok the home page link, or just throw a 404. In other words, if it's a junk link, should Fabrik throw a 404, or show the home page (but with that addition of a simple info message about the resource not found).

https://github.com/Fabrik/fabrik/commit/e57774775d8925d9c21c6080b060e08c178a8fd6

(and the following commit, which adds the info msg)

-- hugh
 
I installed your modification and that certainly works for me. I'm not concerned that a 404 page is thrown. However, I expect others might prefer that the user know that a page is dead (or in some cases a page does not exist, link went bad, etc.), especially if they use the Joomla Redirect component.

Thank you.
 
Yup, that was my thought. Which is why I added that info msg.

It's really just a question of whether it only throws an error, or renders the home page normally with an info msg.

-- hugh
 
Hi,
I've just upgraded my sites to Joomla & Fabrik 3.7.
I then noticed how 404 our now handled in Fabrik...

Thing is that if you don't send a 404 header when the url is different, it's a duplicate content. Meaning you'll create dozens of duplicated pages for the fabrik pages :
- mysite.com is the right page
- mysite.com/sdqsdsdqsdhhh is a 404 but shows up like the homepage and no 404 header... so it's a duplicate.

... and same thing for all menus/folders of the site :
- mysite.com/myfolder/mypage.html is a fk list page
- mysite.com/myfolder/qsfsdfsdfsd is a 404 but looks like my list and is a duplicate.

All my SEO efforts will be killed.

In my opinion, best way to deal with this would be to :
- send a 404 header
- call a 404 page/content

If you use the joomla 404 page, I think we can still use the Joomla template substitution if we want a custom 404 page and headers.
... or maybe having a custom 404 page with fabrik, but maybe easier to grab the Joomla 404 ?

Could please you take this into consideration ?
Thanks,
Theo
 
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top