Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Call to a member function on a non-object #1450

Closed
robocoder opened this issue Jun 27, 2010 · 20 comments
Closed

Call to a member function on a non-object #1450

robocoder opened this issue Jun 27, 2010 · 20 comments
Assignees
Labels
Bug For errors / faults / flaws / inconsistencies etc. Major Indicates the severity or impact or benefit of an issue is much higher than normal but not critical.
Milestone

Comments

@robocoder
Copy link
Contributor

See: http://modxcms.com/forums/index.php?topic=32891.msg295437#msg295437

@mattab
Copy link
Member

mattab commented Jul 13, 2010

sounds like a bug in the modx plugin specifically?

@robocoder
Copy link
Contributor Author

Also reported in http://forum.piwik.org/index.php?showtopic=11541

@anonymous-matomo-user
Copy link

This is not invalid, I am having the same error and do not run modx. v0.5.4 was fine. Upgraded to 0.7.0 and this error started for some sites when trying to load a widget with visits summary & graph (VisitsSummary Index).

Fatal error: Call to a member function getTimezone() on a non-object in /san/home/piwik0.7.0/core/Controller.php on line 212

@robocoder
Copy link
Contributor Author

DriverDan: can you try 0.8? There was no feedback on the Piwik forum from the original poster.

On the modx forum, the OP says:
If you are using piwik in a multiple site format- each site must be pulling stats, example if you have like in my case sites 1,2,3,4 and you dont have 2 installed piwikx throws an error. Why Im not sure but its probably worth investigating. I deleted the #2 site where piwikx was not installed yet and all the errors went away.

Are your errors and configuration similar?

@anonymous-matomo-user
Copy link

We're running this across many live sites and have a lot of ones that are now inactive (>50%). I cannot delete them because we save the data for reference. I will try to upgrade to 0.8.0 as soon as I have time. I've made a lot of template changes and due to the way Piwik organizes its views/templates upgrades are very time consuming.

@mattab
Copy link
Member

mattab commented Aug 3, 2010

I've made a lot of template changes and due to the way Piwik organizes its views/templates upgrades are very time consuming.

Maybe it would be a good thing to work on theming for Piwik. see #5597
if you want to help with this let us know!

@mattab
Copy link
Member

mattab commented Aug 5, 2010

Please reopen if the issue is still here in 0.8, with steps to reproduce.

@anonymous-matomo-user
Copy link

Still happening in 0.9:
Fatal error: Call to a member function getTimezone() on a non-object in piwik0.9.0/core/Controller.php on line 216

This is trying to load the Visits summary overview with graph widget using token_auth. If I log into the account everything in the dashboard works. If I log out and try accessing the widget with token_auth I get the error.

@mattab
Copy link
Member

mattab commented Aug 14, 2010

I haven't replicated yet, but leaving open as reminder

@mattab
Copy link
Member

mattab commented Aug 26, 2010

(In [2982]) Fixes #1450

  • properly catching and propagating the error when missing privileges
  • improving the iframeWidget_localhost helper file by loading custom parameters. Now all widgets load from localhost in this one page helper.

@mattab
Copy link
Member

mattab commented Aug 26, 2010

DriverDan, can you please try the patch and see if it fixes the issue for you?

@anonymous-matomo-user
Copy link

I finally had an opportunity to upgrade to 1.0.0. The previous error has been replaced by a new one.
Fatal error: Class 'HTML_QuickForm2_InvalidArgumentException' not found in piwik1.0.0/libs/HTML/QuickForm2/Renderer.php on line 161

Looks like the Exception.php file in libs/HTML/QuickForm2/ isn't being included. When I changed it to a regular exception I got "Renderer type 'smarty' is already registered".

@robocoder
Copy link
Contributor Author

(In [3040]) refs #1450 - some of the exception classes don't follow PEAR naming convention; use explicit require_once

@anonymous-matomo-user
Copy link

Thanks for fixing that issue. This ticket should still be open though, the "Renderer type 'smarty' is already registered" error isn't going to be fixed by including the exceptions. Here's a backtrace when the exception is thrown:

#0 HTML_QuickForm2_Renderer::register(smarty, HTML_QuickForm2_Renderer_Smarty) called at [/san/home/piwik1.0.0/core/View.php:176]
#1 Piwik_View->addForm(Piwik_Login_FormLogin Object ([] => Array ([0] => form_login,[1] => form_password,[2] => form_nonce),[] => Array (),[] => Array ([0] => id,[1] => method),[] => Array ([0] => HTML_QuickForm2_Element_InputText Object ([] => Array ([type] => text,[name] => form_login,[id] => form_login-1),[] => Array ([0] => id,[1] => name,[2] => type),[] => ,[] => ,[] => Piwik_Login_FormLogin Object ( *RECURSION*,[] => Array (),[] => Array ([0] => Array ([0] =>  HTML_QuickForm2_Rule_Required Object ([] => HTML_QuickForm2_Element_InputText Object ( *RECURSION*,[] => Username required,[] => 1,[] => Array ([0] => Array ())),[1] => 1)),[] => Array (),[] => ,[] => 0,[] => ),[1] => HTML_QuickForm2_Element_InputPassword Object ([] => Array ([type] => password,[name] => form_password,[id] => form_password-1),[] => Array ([0] => id,[1] => name,[2] => type),[] => ,[] => ,[] => Piwik_Login_FormLogin Object ( *RECURSION*,[] => Array (),[] => Array ([0] => Array ([0] => HTML_QuickForm2_Rule_Required Object ([] => HTML_QuickForm2_Element_InputPassword Object ( *RECURSION*,[] => Password required,[] => 1,[] => Array ([0] => Array ())),[1] => 1)),[] => Array (),[] => ,[] => 0,[] => ),[2] => HTML_QuickForm2_Element_InputHidden Object ([] => Array ([type] =>  hidden,[name] => form_nonce,[id] => form_nonce-1),[] => Array ([0] => id,[1] => name,[2] => type),[] => ,[] => ,[] => Piwik_Login_FormLogin Object ( *RECURSION*,[] => Array (),[] => Array (),[] => Array (),[] => ,[] => 0,[] => ),[3] => HTML_QuickForm2_Element_InputSubmit Object ([] => Array ([type] => submit,[name] => submit,[id] => submit-1),[] => ,[] => Array ([0] => id,[1] => name,[2] => type),[] => ,[] => ,[] => Piwik_Login_FormLogin Object ( *RECURSION*,[] => Array (),[] => Array (),[] => Array (),[] => ,[] => 0,[] => )),[] => ,[] => ,[] => ,[] => Array (),[] => Array (),[] => Array (),[] => ,[] => Array ([action] => ?module=Widgetize&action=iframe&moduleToWidgetize=VisitsSummary&actionToWidgetize=index&disableLink=1&idSite=62&period=day&date=2010-09-01&token_auth=fc708dc6238181c26322816a6b5caac0,[name] => loginform,[id] => loginform,[method] => post),[] => 0,[] => )) called at [/san/home/piwik1.0.0/plugins/Login/Controller.php:66]
#2 Piwik_Login_Controller->login() called at [/san/home/piwik1.0.0/plugins/Login/Controller.php:28]
#3 Piwik_Login_Controller->index()
#4 call_user_func_array(Array ([0] => Piwik_Login_Controller Object ([] => Login,[] => ,[] => ,[] => 62,[] => ),[1] => index), Array ()) called at [/san/home/piwik1.0.0/core/FrontController.php:126]
#5 Piwik_FrontController->dispatch(Login, ) called at [/san/home/piwik1.0.0/core/Controller.php:434]
#6 Piwik_Controller->redirectToIndex(Login, index) called at [/san/home/piwik1.0.0/core/Controller.php:331]
#7 Piwik_Controller->setGeneralVariablesView(Piwik_View Object ([] => /san/home/piwik1.0.0/plugins/Widgetize/templates/iframe.tpl,[] => Piwik_Smarty Object ([template_dir] => Array ([0] => /san/home/piwik1.0.0/plugins,[1] => /san/home/piwik1.0.0/themes/default,[2] => /san/home/piwik1.0.0/themes),[compile_dir] => /san/home/piwik1.0.0/tmp/templates_c,[config_dir] => configs,[plugins_dir] => Array ([0] => /san/home/piwik1.0.0/core/SmartyPlugins,[1] => /san/home/piwik1.0.0/libs/Smarty/plugins),[debugging] => 0,[error_reporting] => 6143,[debug_tpl] => ,[debugging_ctrl] =>  NONE,[compile_check] => 1,[force_compile] => ,[caching] => 0,[cache_dir] => /san/home/piwik1.0.0/tmp/cache,[cache_lifetime] => 3600,[cache_modified_check] => ,[php_handling] => 0,[security] => ,[secure_dir] => Array (),[security_settings] => Array ([PHP_HANDLING] => ,[IF_FUNCS] => Array ([0] => array,[1] => list,[2] => isset,[3] => empty,[4] => count,[5] => sizeof,[6] => in_array,[7] => is_array,[8] => true,[9] => false,[10] => null),[INCLUDE_ANY] => ,[PHP_TAGS] => ,[MODIFIER_FUNCS] => Array ([0] => count),[ALLOW_CONSTANTS] => ,[ALLOW_SUPER_GLOBALS] => 1),[trusted_dir] => Array (),[left_delimiter] => {,[right_delimiter] => },[request_vars_order] => EGPCS,[request_use_auto_globals] => 1,[compile_id] => ,[use_sub_dirs] => ,[default_modifiers] => Array (),[default_resource_type] => file,[cache_handler_func] => ,[autoload_filters] => Array (),[config_overwrite] => 1,[config_booleanize] => 1,[config_read_hidden] => ,[config_fix_newlines] => 1,[default_template_handler_func] => ,[compiler_file] => Smarty_Compiler.class.php,[compiler_class] => Smarty_Compiler,[config_class] => Config_File,[_tpl_vars] => Array ([SCRIPT_NAME] => /tr/index.php,[tag] => piwik=1.0,[piwikUrl] => https://www.idealsweepstakes.com/tr/,[date] => ,[period] => day,[otherPeriods] => Array ([1] => week,[2] => month,[3] =>  year),[periodsNames] => Array ([day] => Array ([singular] => Day,[plural] => days),[week] => Array ([singular] => Week,[plural] => weeks),[month] => Array ([singular] => Month,[plural] => months),[year] => Array ([singular] => Year,[plural] => years))),[_smarty_vars] => ,[_sections] => Array (),[_foreach] => Array (),[_tag_stack] => Array (),[_conf_obj] => ,[_config] => Array ([0] => Array ([vars] => Array (),[files] => Array ())),[_smarty_md5] => f8d698aea36fcbead2b9d5359ffca76f,[_version] => 2.6.26,[_inclusion_depth] => 0,[_compile_id] => ,[_smarty_debug_id] => SMARTY_DEBUG,[_smarty_debug_info] => Array (),[_cache_info] => Array (),[_file_perms] => 420,[_dir_perms] => 505,[_reg_objects] => Array (),[_plugins] => Array ([modifier] => Array (),[function] => Array (),[block] => Array (),[compiler] => Array (),[prefilter] => Array (),[postfilter] => Array (),[outputfilter] => Array ([cachebuster] => Array ([0] => smarty_outputfilter_cachebuster,[1] => ,[2] => ,[3] => 1,[4] => 1),[ajaxcdn] => Array ([0] => smarty_outputfilter_ajaxcdn,[1] => ,[2] => ,[3] => 1,[4] => 1),[trimwhitespace] => Array ([0] => smarty_outputfilter_trimwhitespace,[1] => ,[2] => ,[3] => 1,[4] => 1)),[resource] => Array (),[insert] => Array ()),[_cache_serials] => Array (),[_cache_include] => ,[_cache_including] => ),[] => Array (),[] => text/html; charset=utf-8)) called at [/san/home/piwik1.0.0/plugins/Widgetize/Controller.php:67]
#8 Piwik_Widgetize_Controller->iframe() #9 call_user_func_array(Array ([0] => Piwik_Widgetize_Controller Object ([] => Widgetize,[] => ,[] => ,[] => 62,[] => ),[1] => iframe), Array ()) called at [/san/home/piwik1.0.0/core/FrontController.php:126]
#10 Piwik_FrontController->dispatch() called at [/san/home/piwik1.0.0/index.php:60]

@robocoder
Copy link
Contributor Author

In [3041], fixes comment:ticket:1450:17 - redirect to Login when user doesn't have view access to that site's stats

@anonymous-matomo-user
Copy link

Applying this patch fixes the exception issues but shows a login page when trying to access widgets using the API key for the account I was using. Using the API key of a newly created account works as it should. It seems something in the database related to accounts and permissions wasn't updated on an upgrade (unknown version) which was causing my issue. I deleted the previous user and replaced it with a new one to solve the problem.

@robocoder
Copy link
Contributor Author

Next time you encounter this, please check that the user has view/admin access to that site.

When a site is added, existing users (except the superuser) have no access to the new site.

@anonymous-matomo-user
Copy link

Thanks for the help. I'm well aware of how permissions work. I tried removing access for the account, changing it to view or admin and auth key access still didn't work. This is probably an edge case. I consider this closed and not worth any more time unless other people complain.

@mattab
Copy link
Member

mattab commented Nov 16, 2010

DriverDan, you suggest there is still a bug on "edge case" - can you please explain the steps to reproduce?

@anonymous-matomo-user
Copy link

Unfortunately I can't. I'm pretty certain it was caused by a database change missing from an upgrade at some point, but I've been running this installation of Piwik for almost 3 years now so I have no idea which update caused the problem. Unless a lot of other people complain I wouldn't worry about it.

@robocoder robocoder added this to the Piwik 0.9.9 - Stable release milestone Jul 8, 2014
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug For errors / faults / flaws / inconsistencies etc. Major Indicates the severity or impact or benefit of an issue is much higher than normal but not critical.
Projects
None yet
Development

No branches or pull requests

3 participants