Jump to content

Fatal error: Call to a member function setError()


Recommended Posts

Hi,

I've upgraded from CubeCart 5 to the latest verison of 6 and had no problems when it was running on MAMP.

Now I've moved to my live server I'm getting the following message

Fatal error: Call to a member function setError() on null in /usr/local/www/sitename/classes/admin.class.php on line 393

I get this when logging in with the correct login details but a 500 error when using the wrong details.

Any help would be greatly appreciated.

Sam

Link to comment
Share on other sites

I am thinking somewhere along the way, when CubeCart admin is waking up with a user/pass, part of that process is to engage the GUI (technically, instantiate the GUI class).

The first thing the GUI wants to do when instantiated is get a fresh list of installed skins and assign a bunch of data to the template rendering engine (Smarty).

When the Admin _authenticate() function can't find a valid user/pass, it will want to give to the GUI a message about "wrong username or password".

If the GUI went away because of a problem, or never did instantiate, then the above will be the PHP Fatal Error logged. A fatal error is..., well..., fatal.

So, we need to determine if the GUI went away or had a problem getting instantiated.

To do so, we need to look at PHP's error_log.

Link to comment
Share on other sites

Hi,

Slightly wrong on my first post.

In the logs we get this on a wrong password:

[Tue Jun 07 11:22:27.833195 2016] [:error] [pid 19926:tid 35106422784] [client 31.205.51.193:50022] PHP Fatal error:  Call to a member function setError() on null in /usr/local/www/www.sitename.co.uk/classes/admin.class.php on line 393, referer: http://www.sitename.co.uk/admin.php

On correct password we just get a screen refresh.

there is nothing else in the PHP log.

Sam

Link to comment
Share on other sites

If you know how, please have your browser show you CubeCart's cookie being received and set, and then the cookie the browser sends back to CubeCart. Hopefully, the browser does send the cookie back.

Then, you will need to determine how the PHP on the live server is managing sessions. With respect to CubeCart, if the cookie is wrong or missing, or if PHP cannot record a session (a few ways to do this) based on that cookie, then you won't be getting into the admin.

On a related note, on the storefront, place an item in the basket then go to View Cart. Are the item(s) still in the cart?

The error message above does not look familiar. It seems to be a variation of the standard web server's error log when PHP is being controlled by Apache's mod_php, as opposed to PHP being a stand-alone FastCGI.

 

Link to comment
Share on other sites

Hi @bsmither

Items do not stay in the cart and we get the following error:

substr() expects parameter 3 to be long, string given in /usr/local/www/www.sitename.co.uk/classes/catalogue.class.php on line 1292

Our server is running FreeBSD with the following PHP extensions:

mod_php56-5.6.22 PHP Scripting Language
php56-5.6.22 PHP Scripting Language
php56-ctype-5.6.22 The ctype shared extension for php
php56-curl-5.6.22 The curl shared extension for php
php56-filter-5.6.22 The filter shared extension for php
php56-gd-5.6.22 The gd shared extension for php
php56-hash-5.6.22 The hash shared extension for php
php56-json-5.6.22 The json shared extension for php
php56-mbstring-5.6.22 The mbstring shared extension for php
php56-mysql-5.6.22 The mysql shared extension for php
php56-mysqli-5.6.22 The mysqli shared extension for php
php56-openssl-5.6.22 The openssl shared extension for php
php56-session-5.6.22 The session shared extension for php
php56-simplexml-5.6.22 The simplexml shared extension for php
php56-xml-5.6.22 The xml shared extension for php
php56-xmlwriter-5.6.22 The xmlwriter shared extension for php
php56-zip-5.6.22 The zip shared extension for php
php56-zlib-5.6.22 The zlib shared extension for php

Thanks

Sam

Link to comment
Share on other sites

The above error suggests to me that in CubeCart's admin, Store Settings, Layout tab, "Length of product precis" has a value that does not look like a number.

I think this is not a Fatal Error, so I believe this is not the cause of your server environment not maintaining a session state.

Google will have some forum discussions at the top of its results from this search, freebsd php session support. From reading those conversations, especially this one, I think some configuration of your FreeBSD environment may be necessary.

 

Link to comment
Share on other sites

Hi,

Here are the current settings:

session.auto_start => Off => Off
session.cache_expire => 180 => 180
session.cache_limiter => nocache => nocache
session.cookie_domain => no value => no value
session.cookie_httponly => Off => Off
session.cookie_lifetime => 0 => 0
session.cookie_path => / => /
session.cookie_secure => Off => Off
session.entropy_file => /dev/urandom => /dev/urandom
session.entropy_length => 32 => 32
session.gc_divisor => 1000 => 1000
session.gc_maxlifetime => 1440 => 1440
session.gc_probability => 1 => 1
session.hash_bits_per_character => 5 => 5
session.hash_function => 0 => 0
session.name => PHPSESSID => PHPSESSID
session.referer_check => no value => no value
session.save_handler => files => files
session.save_path => no value => no value
session.serialize_handler => php => php
session.upload_progress.cleanup => On => On
session.upload_progress.enabled => On => On
session.upload_progress.freq => 1% => 1%
session.upload_progress.min_freq => 1 => 1
session.upload_progress.name => PHP_SESSION_UPLOAD_PROGRESS => PHP_SESSION_UPLOAD_PROGRESS
session.upload_progress.prefix => upload_progress => upload_progress
session.use_cookies => On => On
session.use_only_cookies => On => On
session.use_strict_mode => Off => Off
session.use_trans_sid => 0 => 0

We are overriding the session path in ini-custom.inc.php with session_save_path(CC_ROOT_DIR.'/sessions'); session files are being persisted there.

Also here are our Loaded Apache Modules, apache set to use SESSION_COOKIE.
 
core_module (static)
 so_module (static)
 http_module (static)
 access_compat_module (shared)
 authz_core_module (shared)
 authn_file_module (shared)
 authz_host_module (shared)
 authn_core_module (shared)
 auth_basic_module (shared)
 authz_user_module (shared)
 cgi_module (shared)
 reqtimeout_module (shared)
 filter_module (shared)
 mime_module (shared)
 log_config_module (shared)
 unixd_module (shared)
 dir_module (shared)
 alias_module (shared)
 ssl_module (shared)
 rewrite_module (shared)
 headers_module (shared)
 socache_shmcb_module (shared)
 deflate_module (shared)
 mpm_worker_module (shared)
 php5_module (shared)

Thanks

Sam

 

Also attached config from web server

1465478675.png

Link to comment
Share on other sites

Nothing looks strange or problematic, and you say session files are showing up in CC_ROOT_DIR/sessions. So, obvious questions:

Does the folder/file permissions allow for Apache/PHP to read these files?

Is Apache/PHP receiving the cookie from the browser client?

The table above suggests that Cookies are enabled, so however you got the above table, scroll to the PHP Variables table and look for _SERVER["HTTP_COOKIE"].

 

Link to comment
Share on other sites

Hey guys, Sam opened an internal ticket and I've been looking into this too. Thanks Brian for all your help here.. fantastic help as always! :)  

A var_dump in the _authenticate method (in the admin class) of $GLOBALS['gui'] returns null. To check other objects a var_dump of $GLOBALS['db'] WAS there. 

We are losing the gui class for some reason. 

Just to test I cloned the store locally and it worked as expected. I'm really struggling to get to the bottom of this. 

CubeCart has seen compatibility issues with other operating systems. For example Solaris can't work with the braces of the PHP glob function used in CubeCart. 

.... I just don't know how to debug this. Does the web server log tell us anything at all?

Link to comment
Share on other sites

Oddly.. on login fail the autoloader classes are not all initiated. The lists below show the classes autoloaded prior to error in order. 

On the broken store:
Cache
Database
Config
Debug
Sanitize
Session
Admin
Password

Fatal error: Call to a member function setError() on null in /usr/local/www/www.xxx.co.uk/classes/admin.class.php on line 396

On the cloned store (working on OSX MAMP):
Cache
Database
Config
Debug
Sanitize
Session
Smarty
Smarty_Internal_Data
Language
HookLoader
GUI
Smarty_Internal_Method_GetTemplateVars
Smarty_Undefined_Variable
SEO
SSL
Catalogue
ACP

Admin
Password

Link to comment
Share on other sites

These is my SPL classes:

From splmax yours also has.

SplMaxHeap, SplObjectStorage, SplPriorityQueue, SplQueue, SplStack, SplTempFileObject, UnderflowException, UnexpectedValueException

I'm getting out my depth here a bit. 

 

Screen Shot 2016-06-09 at 17.32.25.png

2 minutes ago, tomatonetwork said:

Hi Al,

We managed to progress past the issue by commenting out:

//              session_name('CCS_'.strtoupper(substr(md5(ROOT_REL), 0,10)));

Now shows the GUI.

We have another lot of errors to work through though.

Sam

Ok maybe I am barking up the wrong tree entirely or there is more than one issue.

What other errors do you see? Please note that only "Fatal" errors are of real significance. 

Link to comment
Share on other sites

I think a lot more would be missing if the classes listed in red were actually not getting instantiated.

"Cookie as received by Apache"

The cookie PHPSESSID, later changed to CCS_A7865DF9A9, is not being received.

Link to comment
Share on other sites

2 minutes ago, bsmither said:

I think a lot more would be missing if the classes listed in red were actually not getting instantiated.

"Cookie as received by Apache"

The cookie PHPSESSID, later changed to CCS_A7865DF9A9, is not being received.

good point! :rolleyes:

Link to comment
Share on other sites

It looks like the cookie domain isn't set properly "cookie_domain" do you know where it's set in the config?

Sam

Was set to:

$cookie_domain = '.sitename';
                        ini_set('session.cookie_domain',$cookie_domain);

Manually set to:

$cookie_domain = '.sitename.co.uk';
                        ini_set('session.cookie_domain',$cookie_domain);

Now all working.

Link to comment
Share on other sites

It's set from within the admin control panel under the SSL tab of the stores settings. 

You could always hard code the value into line 88 of classes/session.class.php

Find:

$cookie_domain = $GLOBALS['config']->get('config', 'cookie_domain');

Replace with:

$cookie_domain = '.example.com';

 

Link to comment
Share on other sites

Fixed :)

We just have these errors on checkout now:

Notice: Error: Hook 'Google_Checkout/hooks/class.cubecart.display_gateways.php' was not found in /usr/local/www/www.hearts-delight.co.uk/classes/hookloader.class.php on line 288

Notice: Error: Hook 'Google_Checkout/hooks/class.cubecart.display_basket.alternate.php' was not found in /usr/local/www/www.hearts-delight.co.uk/classes/hookloader.class.php on line 288

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...