?
avatar photodude
photodude
14 Mar 2016

Steps to reproduce the issue

Global configuration for Cache and Sessions needs to be set to memcache
Using a 3rdparty template as default (I used Rocket Theme template with Gantry 4)
Check Global configuration for Database is set to MySQLi (correct if needed)
Update site from 3.4.8 to 3.5RC2 or 3.5RC3
check database is up to date (fix if needed)
Update extensions that are out of date.
Update server to php7 (without memcache support)

  • Attempt changing from 3rd party template to a standard Joomla template by clicking the default star in the template list
  • Or attempt to change Global configuration setting once you're running php7 (without memcache)

Expected result

default template changes without error
Global configurations save without error

Actual result

An error has occurred.
[0] Call to a member function add() on null

System information (as much as possible)

Setting Value
PHP Built On Linux lamp x86_64
Database Version 5.5.42-cll-lve
Database Connection Collation utf8mb4_general_ci
Database Type MySQLi
PHP Version 7.0.0
Web Server Apache
WebServer to PHP Interface cgi-fcgi
Joomla! Version Joomla! 3.5.0-rc2
Joomla! Platform Version 13.1.0
User Agent Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/49.0.2623.87 Safari/537.36
Cache off
Session Handler database
Error Reporting development
Search Engine Friendly URLs yes
Use URL Rewriting yes, with default .htaccess
Session Memcache
Cache Memcache

Additional comments

After returning to the control panel and looking at the template list, the default template did change, But I don't think an error should have been thrown.

I'm also seeing this error popup in some other areas, save and close global settings after turning off all SEO settings triggered this as well.

This whole issue is due to using memcache prior to migrating to php7.
You must change the global configuration settings to default things like session-database and cache-file before switching to php7.

avatar photodude photodude - open - 14 Mar 2016
avatar brianteeman
brianteeman - comment - 14 Mar 2016

Following everything you have done but with my own template not gantry I was unable to replicate this


This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/9426.

avatar photodude
photodude - comment - 14 Mar 2016

I'm wondering if something broke when I updated (missing files maybe)

If you do want to try with a Gantry4 theme there is a Free one available

I'm restarting my update test, I'll see if the issue sticks around. I found a number of actions that resulted in An error has occurred. [0] Call to a member function add() on null

avatar brianteeman
brianteeman - comment - 15 Mar 2016

I really think this must be something local to you - perhaps an extension?


This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/9426.

avatar brianteeman
brianteeman - comment - 15 Mar 2016

Repeated the test again exactly as above but this time with afterburner2 - still no problem


This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/9426.

avatar mbabker
mbabker - comment - 15 Mar 2016

A full stack trace would help you and anyone else reading...

avatar photodude
photodude - comment - 15 Mar 2016

@mbabker I hate to admit it, but getting a full stack trace would currently be one of my developer weaknesses.

Would JApplicationCms::enqueueMessage(var_dump(debug_backtrace())); be sufficent to aquire that information? Or is this something I'm going to need pull using something like xdebug?

avatar mbabker
mbabker - comment - 15 Mar 2016

Nope. You'd have to know what file is trying to call the add() method on some object. JApplicationCms::enqueueMessage() won't catch this.

If it's triggering the error page, enable debug mode as the error page renders a backtrace from the error object if this is enabled.

avatar photodude
photodude - comment - 15 Mar 2016

Ok here is the Debug trace

An error has occurred.
 0 Call to a member function add() on null
Call stack
#   Function    Location
1   JApplicationCms->execute()  /administrator/index.php:51
2   JApplicationAdministrator->doExecute()  /libraries/cms/application/cms.php:257
3   JApplicationAdministrator->dispatch()   /libraries/cms/application/administrator.php:152
4   JComponentHelper::renderComponent() /libraries/cms/application/administrator.php:98
5   JComponentHelper::executeComponent()    /libraries/cms/component/helper.php:380
6   require_once()  /libraries/cms/component/helper.php:405
7   JControllerLegacy->execute()    /administrator/components/com_templates/templates.php:26
8   TemplatesControllerStyles->setDefault() /libraries/legacy/controller/legacy.php:728
9   TemplatesModelStyle->setHome()  /administrator/components/com_templates/controllers/styles.php:96
10  TemplatesModelStyle->cleanCache()   /administrator/components/com_templates/models/style.php:641
11  JModelLegacy->cleanCache()  /administrator/components/com_templates/models/style.php:721
12  JCacheController->__call()  /libraries/legacy/model/legacy.php:591
13  JCache->clean() /libraries/joomla/cache/controller.php:69
14  JCacheStorageMemcache->clean()  /libraries/joomla/cache/cache.php:292
15  JCacheStorageMemcache->lockindex()  /libraries/joomla/cache/storage/memcache.php:287

So the one thing to note about the setup, both Cache and sessions were set to "memcache" prior to switching to PHP7. but I don't think this sever is set up for Memcache with PHP7 as memcache is no longer an option in gobal configuration once I'm running php7.

Attempting to resave the global configuration results in the same error.

An error has occurred.
 0 Call to a member function add() on null
Call stack
#   Function    Location
1   JApplicationCms->execute()  /administrator/index.php:51
2   JApplicationAdministrator->doExecute()  /libraries/cms/application/cms.php:257
3   JApplicationAdministrator->dispatch()   /libraries/cms/application/administrator.php:152
4   JComponentHelper::renderComponent() /libraries/cms/application/administrator.php:98
5   JComponentHelper::executeComponent()    /libraries/cms/component/helper.php:380
6   require_once()  /libraries/cms/component/helper.php:405
7   ConfigControllerApplicationSave->execute()  /administrator/components/com_config/config.php:31
8   ConfigModelApplication->save()  /administrator/components/com_config/controller/application/save.php:90
9   ConfigModelCms->cleanCache()    /administrator/components/com_config/model/application.php:253
10  JCacheController->__call()  /components/com_config/model/cms.php:225
11  JCache->clean() /libraries/joomla/cache/controller.php:69
12  JCacheStorageMemcache->clean()  /libraries/joomla/cache/cache.php:292
13  JCacheStorageMemcache->lockindex()  /libraries/joomla/cache/storage/memcache.php:287

Switched back to php5.6.16 and resaved global configuration with cache set to file and sessions set to database. (no issue)...
Switched back to PHP7, the Call to a member function add() on null error is now gone.

so replication required memcache turned on for cache/session before switching to PHP7 (without memcache)

avatar mbabker
mbabker - comment - 15 Mar 2016

Memcache I don't know if anyone's doing an upgrade for that extension, and Memcached (note the d) is still in a feature branch pending a stable release on PHP 7. So you'd need to change the cache configs pre-upgrade to keep things working. APCu and I believe Redis (as well as the default files handler) should be PHP 7 compatible so long as you have all the prerequisites installed.

avatar photodude photodude - change - 15 Mar 2016
Title
3.5.RC2 `Call to a member function add() on null`
`Call to a member function add() on null` if memcache is selected before migrating to php7
avatar brianteeman
brianteeman - comment - 16 Mar 2016

(Ignore my test results above as I did not have cache enabled - the memcache requirement was discovered AFTER my initial tests)


This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/9426.

avatar brianteeman brianteeman - change - 16 Mar 2016
Category Cache
avatar brianteeman brianteeman - change - 16 Mar 2016
Labels Added: ?
avatar Sh4d0wF1gh7
Sh4d0wF1gh7 - comment - 26 Mar 2016

Hello,

i updated a few sites now to Joomla 3.5 stable but on one site, the same error appears on each saving.
I have no caching, also not before joomla update.

Are there solutions for this?

Greets

avatar photodude
photodude - comment - 26 Mar 2016

@Sh4d0wF1gh7 If your issue is this issue, this is related to having the global settings for the site for caching, sessions, or both set to Memcache prior to switching to PHP7.

If you can temporarily switch back to PHP5.6, you can switch the Global settings to cache = file, sessions = database; then make the php7 update. (once on php7 you could then see if there are other PHP7 options for

You could try and see if changing the global settings directly while on php 7, note: when you make the change and save, you will get the warning. But you should no longer get on subsequent changes if it worked.

If neither of those are an option, you will need to attempt manually editing the values in your configuration.php file.
$session_handler = 'database';
$cache_handler = 'file';

Warning, if you do something wrong in editing the configuration.php file you will break your site.

There is currently no other solutions.

If you try one or all of those options and nothing worked, you either have a 3rd party extension that is trying to use Memcache or you have a completely different issue.

avatar Sh4d0wF1gh7
Sh4d0wF1gh7 - comment - 26 Mar 2016

PERFECT.

The only thing i did, was to switch the $cache_handler = 'memcache'; in the configuration.php to 'file'.

Now it works...

Confuse that i had disabled complete caching since month but very nice thats now working.

Thank you

avatar photodude
photodude - comment - 26 Nov 2016

@mbabker Should this issue be closed?

avatar mbabker mbabker - change - 26 Nov 2016
The description was changed
Status New Closed
Closed_Date 0000-00-00 00:00:00 2016-11-26 19:03:01
Closed_By mbabker
avatar mbabker mbabker - close - 26 Nov 2016
avatar mbabker
mbabker - comment - 26 Nov 2016

Yes.

avatar alandarr
alandarr - comment - 11 Jul 2017

Guys, I see this is closed but I'm having the same issue.

I'm running Joomla! 3.7.2

The site started at Joomla! 3.5.x and memecache was never enabled.

I moved the site from a host to an internal server. This is when the issues started. I mostly see it when working in DOCman. After saving an article or category in DOCman, it does save what i'm working on but throws the error message. Could it possibly have something to do with rewrite options in the htaccess?

We definitely had to change a few things to get it to work on our internal LAMP setup and permissions were an issue for a while but everything else seems to be working fine but this.


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/9426.

avatar photodude
photodude - comment - 11 Jul 2017

@alandarr I suggest opening a new issue as this issue was specific to memcache being selected before migrating to php7

Please be sure to include in your issue all of your server details like PHP version for both the starting point internal server and your moved site.

Add a Comment

Login with GitHub to post a comment