Notice: Trying to get property 'id' of non-object Topic is solved

Need help with the Administration of your Joomla! 3.x site? This is the spot for you.

Moderator: General Support Moderators

Forum rules
Forum Rules
Absolute Beginner's Guide to Joomla! <-- please read before posting, this means YOU.
Forum Post Assistant - If you are serious about wanting help, you will use this tool to help you post.
Windows Defender SmartScreen Issues <-- please read this if using Windows 10.
Post Reply
User avatar
TheAnt
Joomla! Explorer
Joomla! Explorer
Posts: 440
Joined: Wed Aug 31, 2005 7:43 am
Location: Milano - Italy

Notice: Trying to get property 'id' of non-object

Post by TheAnt » Thu Dec 21, 2023 11:35 am

Hello
I need to test locally my J! 3.10.11 site before to update it to J! 4. I'm on Mac using MAMP Free.
I copied files and db and configurated configuration.php file, the frontend is loading almost fine.
The problem is that in backend I can't login (using the correct username/password of course). I get this alert:

Code: Select all

Notice: Trying to get property 'id' of non-object in /Applications/MAMP/htdocs/site/libraries/src/Access/Access.php on line 454
on line 454 ther is this code:

Code: Select all

		// Now create save the components asset tree to preload memory.
		foreach ($assets as $asset)
		{
			if (!isset(self::$assetPermissionsParentIdMapping[$asset->name]))
			{
				self::$assetPermissionsParentIdMapping[$asset->name] = array($rootAsset->id => $rootAsset, $asset->id => $asset);
				self::$preloadedAssets[$asset->id]                   = $asset->name;
			}
		}
the only difference from production server is the Php version: 7.1.33 online, 7.4.33 locally.
I can choose 7.1.33 in MAMP.

Any suggestion to fix the login problem?
I already tried to change username and password via PhpMyAdmin.

User avatar
toivo
Joomla! Master
Joomla! Master
Posts: 17446
Joined: Thu Feb 15, 2007 5:48 am
Location: Sydney, Australia

Re: Notice: Trying to get property 'id' of non-object

Post by toivo » Thu Dec 21, 2023 10:18 pm

Edit the file configuration.php in the main Joomla folder to get rid of PHP notices:

Code: Select all

	public $error_reporting = 'simple';
The recommended setting for live sites:

Code: Select all

[code]	public $error_reporting = 'none;
The minimum PHP version for Joomla 4 is PHP 7.2.5. Older versions are not guaranteeds to work.

The recommended version of PHP for Joomla 4 and Joomla 5 is PHP 8.2. The test environment should use PHP 8.1 as the minimum version so that incompatible third party extensions can be uninstalled and replaced before your host removes unsupported versions of PHP.
Toivo Talikka, Global Moderator

User avatar
TheAnt
Joomla! Explorer
Joomla! Explorer
Posts: 440
Joined: Wed Aug 31, 2005 7:43 am
Location: Milano - Italy

Re: Notice: Trying to get property 'id' of non-object

Post by TheAnt » Fri Dec 22, 2023 6:56 am

Thank you Toivo but the problem was the login failure, not the notice and this is a Joomla 3 site.
I disabled some extensions via phpMyadmin and the login worked.
Now I can upgrade php and Joomla.


Post Reply

Return to “Administration Joomla! 3.x”