? ?
avatar toivo
toivo
7 Dec 2020

Steps to reproduce the issue

Go to System - Control Panel.
Click Super User – Edit Account.
Go to any tab, for example User Profile and edit something, then click Save.
Or do not change anything and click Save.

Expected result

No warnings or errors.

Actual result

Message displayed: 0 Cannot access offset of type string on string
PHP error log:
[07-Dec-2020 12:10:42 UTC] PHP Warning: Uninitialized string offset 0 in C:\www\joomlatest\administrator\components\com_admin\models\profile.php on line 145

System information (as much as possible)

Windows 10, Wampserver 3.2.4
Apache 2.4.43a, MySQL 8.0.20, PHP 8.0.0

Additional comments

avatar toivo toivo - open - 7 Dec 2020
avatar joomla-cms-bot joomla-cms-bot - labeled - 7 Dec 2020
avatar N6REJ
N6REJ - comment - 7 Dec 2020

I cannot replicate the issue using php8 & staging.
@toivo any extensions installed or settings changed from default?
image

avatar toivo
toivo - comment - 7 Dec 2020

@N6REJ The earlier test site had a few extensions, but then I installed J3.9.23 from scratch, set up standard .htaccess and SEF, set error reporting to 'Maximum', went to Super User - Edit Account, clicked Save and got exactly the same PHP warning.

I will now download 3.9.24-dev and see what happens. Should've done that in the first instance...

screen shot 2020-12-07 at 15 03 10


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/31610.
avatar toivo
toivo - comment - 7 Dec 2020

@N6REJ - ran the update using the 3.9.24-dev patch package and got the same PHP warning in Edit Account - Save. I'll now install 3.9.24-dev from scratch and try again.


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

avatar toivo
toivo - comment - 7 Dec 2020

@N6REJ - ran the update using the 3.9.24-dev patch package and got the same PHP warning in Edit Account - Save. I'll now install 3.9.24-dev from scratch and try again.


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

avatar Fedik
Fedik - comment - 7 Dec 2020

it something with twofactor

// Handle the two factor authentication setup
if (array_key_exists('twofactor', $data))
{
$twoFactorMethod = $data['twofactor']['method'];
// Get the current One Time Password (two factor auth) configuration
$otpConfig = $this->getOtpConfig($user->id);
if ($twoFactorMethod !== 'none')

I guess you need to have it enabled, or previously used, to get this issue

avatar toivo
toivo - comment - 7 Dec 2020

@Fedik @N6REJ - just confirmed that the issue occurs also in an out-of-the-box 3.9.24-dev, where the only change in the default configuration was the level of error reporting 'Maximum'.

The only Super User was not updated before testing Edit Account. The only enabled authentication plugins are Cookie and Joomla. Therefore it looks like the user data has incorrect default value.


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

avatar Fedik
Fedik - comment - 7 Dec 2020

Therefore it looks like the user data has incorrect default value.

yeah, looks like
It seems default should be 'none', but $data['twofactor'] is empty.
I have no idea where it comes from.

avatar N6REJ
N6REJ - comment - 7 Dec 2020

the field is hidden

	<!-- Used to get the two factor authentication configuration -->
	<field
		name="twofactor"
		type="hidden"
	/>
avatar N6REJ
N6REJ - comment - 7 Dec 2020

why am I not getting the error.. hmmmm

avatar Fedik
Fedik - comment - 7 Dec 2020

why am I not getting the error

It can be seen only in PHP logs (if it enabled)
The error happens on "save" action, and following redirect will reload the page, that why.

avatar Fedik
Fedik - comment - 7 Dec 2020

btw, it not strict for php 8 version, but general mistake somewhere

avatar Fedik
Fedik - comment - 7 Dec 2020

@zero-24 can you please have a look? it seems was your changes 085f204

I not very know this part, I suspect it need to check if (!empty($data['twofactor']) or populate default value when it empty

avatar toivo
toivo - comment - 7 Dec 2020

@Fedik - the warning does not occur in PHP 7.4.13


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

avatar zero-24
zero-24 - comment - 7 Dec 2020

@zero-24 can you please have a look? it seems was your changes 085f204

I not very know this part, I suspect it need to check if (!empty($data['twofactor']) or populate default value when it empty

Well its based on the pre existing code. So when there are new issues with PHP8 it dhould be fixed there too.

avatar toivo
toivo - comment - 8 Dec 2020

@zero-24 - isn't this a new issue with PHP8 or am I missing something? Is it not possible to trace the origin of the incorrect default value and/or fix the code now?


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

avatar zero-24
zero-24 - comment - 8 Dec 2020

I have not checked the code myself i just wanted to mention that when there is an patch done here the other part should be taken care of too.

When we can find the root cause that would be even better for sure.

avatar toivo
toivo - comment - 8 Dec 2020

@zero-24 Ok, thanks.


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

avatar Fedik
Fedik - comment - 8 Dec 2020

@toivo do you have same issue on joomla 4? on j4 will be file UserModel.php (instead of profile.php) and line around 262

avatar HLeithner HLeithner - change - 8 Dec 2020
Labels Added: ?
avatar HLeithner HLeithner - labeled - 8 Dec 2020
avatar toivo
toivo - comment - 8 Dec 2020

The Save button works all right in 'Edit Account' in J4 Beta6-dev of 8 December in PHP 8.0.0.


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

avatar bayareajenn
bayareajenn - comment - 9 Dec 2020

Could not duplicate the problem in 3.9.23 and PHP 8.0.0. Error reporting is set to Dev. Changed username and Editor separate times. User saved just fine. No 0 error. Saved without making any change(s). User saved fine. No 0 error.

avatar alikon
alikon - comment - 10 Dec 2020

i've been able to replicate see #31628 for a solution

avatar gostn
gostn - comment - 10 Dec 2020

@alikon close this issue as you made a pr?

avatar alikon alikon - change - 10 Dec 2020
Status New Closed
Closed_Date 0000-00-00 00:00:00 2020-12-10 09:49:32
Closed_By alikon
avatar alikon alikon - close - 10 Dec 2020

Add a Comment

Login with GitHub to post a comment