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

Joomla 3.4 update causes Catchable fatal error: #28

Open
kirancheema opened this Issue Feb 25, 2015 · 15 comments

Comments

Projects
None yet
6 participants
@kirancheema

kirancheema commented Feb 25, 2015

Hi Shaun

Just updated an Install to Joomla 3.4 and the following is happening:

Catchable fatal error: Argument 1 passed to Joomla\Utilities\ArrayHelper::getValue() must be of the type array, string given, called in C:\UniServer\www\scwcsu\libraries\joomla\utilities\arrayhelper.php on line 264 and defined in C:\UniServer\www\scwcsu\libraries\vendor\joomla\utilities\src\ArrayHelper.php on line 242

If you turn off the sync on login for the LDAP Profile plugin It goes through fine ... I have tracked it to

the profile.php line 235 (Ish) $adapter = SHFactory::getUserAdapter($username);

@kirancheema

This comment has been minimized.

Show comment
Hide comment
@kirancheema

kirancheema Feb 25, 2015

quick fix is to turn off "sync on login"

kirancheema commented Feb 25, 2015

quick fix is to turn off "sync on login"

@kirancheema

This comment has been minimized.

Show comment
Hide comment
@kirancheema

kirancheema Feb 25, 2015

factory.php needs changing

150 to
$username = strtolower(JArrayHelper::getValue($user, 'username', null, 'array')[0]);

kirancheema commented Feb 25, 2015

factory.php needs changing

150 to
$username = strtolower(JArrayHelper::getValue($user, 'username', null, 'array')[0]);

@ShMaunder

This comment has been minimized.

Show comment
Hide comment
@ShMaunder

ShMaunder Feb 25, 2015

Owner

I'll get right on this in a couple of hours.

Owner

ShMaunder commented Feb 25, 2015

I'll get right on this in a couple of hours.

@ShMaunder

This comment has been minimized.

Show comment
Hide comment
@ShMaunder

ShMaunder Feb 25, 2015

Owner

I can't understand how it can't be an array as there is a check before hand:

if (is_array($user))
{
$username = strtolower(JArrayHelper::getValue($user, 'username', null, 'string'));
....
}

You sure its occurring from that? I can't get to my test environment for another couple of hours yet.

Owner

ShMaunder commented Feb 25, 2015

I can't understand how it can't be an array as there is a check before hand:

if (is_array($user))
{
$username = strtolower(JArrayHelper::getValue($user, 'username', null, 'string'));
....
}

You sure its occurring from that? I can't get to my test environment for another couple of hours yet.

@kirancheema

This comment has been minimized.

Show comment
Hide comment
@kirancheema

kirancheema Feb 25, 2015

actually ignore the previous..

the issue is 227 I think
if ($password = JArrayHelper::getValue($user, 'password', false))

changed this to
if ($password = JArrayHelper::getValue($credentials, 'password', false))
and it works fine

kirancheema commented Feb 25, 2015

actually ignore the previous..

the issue is 227 I think
if ($password = JArrayHelper::getValue($user, 'password', false))

changed this to
if ($password = JArrayHelper::getValue($credentials, 'password', false))
and it works fine

@kirancheema

This comment has been minimized.

Show comment
Hide comment
@kirancheema

kirancheema Feb 25, 2015

Profile.php onLdapSync line 232 is passing in $username as a string to the getuseradapter function

kirancheema commented Feb 25, 2015

Profile.php onLdapSync line 232 is passing in $username as a string to the getuseradapter function

@ShMaunder

This comment has been minimized.

Show comment
Hide comment
@ShMaunder

ShMaunder Feb 25, 2015

Owner

Yes, OK. Can only guess that Joomla have enforced that parameter. Can confirm in a minute.

Owner

ShMaunder commented Feb 25, 2015

Yes, OK. Can only guess that Joomla have enforced that parameter. Can confirm in a minute.

@ShMaunder

This comment has been minimized.

Show comment
Hide comment
@ShMaunder

ShMaunder Feb 25, 2015

Owner

Yea as expected, they enforced the array in 3.4:

In 2.5 it was https://github.com/joomla/joomla-cms/blob/2.5.x/libraries/joomla/utilities/arrayhelper.php#L277 whereas now its https://github.com/joomla/joomla-cms/blob/staging/libraries/vendor/joomla/utilities/src/ArrayHelper.php#L242

I shouldn't have allowed anything but an array to go through so that is pretty bad. But in previous versions it just returned null if it wasn't an array. I will go round and ensure all calls to ArrayHelper::getValue is checking the first parameter is an array. I cannot start this until I'm back at my computer. Maybe hacking Joomla at /libraries/vendor/joomla/utilities/src/ArrayHelper.php by changing:

public static function getValue(array $array, $name, $default = null, $type = '')
to
public static function getValue($array, $name, $default = null, $type = '')

is a better temporary solution until I release a proper fix later today.

Owner

ShMaunder commented Feb 25, 2015

Yea as expected, they enforced the array in 3.4:

In 2.5 it was https://github.com/joomla/joomla-cms/blob/2.5.x/libraries/joomla/utilities/arrayhelper.php#L277 whereas now its https://github.com/joomla/joomla-cms/blob/staging/libraries/vendor/joomla/utilities/src/ArrayHelper.php#L242

I shouldn't have allowed anything but an array to go through so that is pretty bad. But in previous versions it just returned null if it wasn't an array. I will go round and ensure all calls to ArrayHelper::getValue is checking the first parameter is an array. I cannot start this until I'm back at my computer. Maybe hacking Joomla at /libraries/vendor/joomla/utilities/src/ArrayHelper.php by changing:

public static function getValue(array $array, $name, $default = null, $type = '')
to
public static function getValue($array, $name, $default = null, $type = '')

is a better temporary solution until I release a proper fix later today.

@kirancheema

This comment has been minimized.

Show comment
Hide comment
@kirancheema

kirancheema Feb 25, 2015

No worries its seems stable for the moment so will leave as is until your official fix

kirancheema commented Feb 25, 2015

No worries its seems stable for the moment so will leave as is until your official fix

@ShMaunder

This comment has been minimized.

Show comment
Hide comment
@ShMaunder

ShMaunder Feb 25, 2015

Owner

I have just built http://server.shmanic.co.uk/jmml_builds/2.0.3.1/packages/ which I have just started to test. Instead of changing logic in many places, I have just forked the method from Joomla 3.3 and performed a sed across all instances of JArrayHelper::getValue(). Question now is whether there are other changes like this.

Owner

ShMaunder commented Feb 25, 2015

I have just built http://server.shmanic.co.uk/jmml_builds/2.0.3.1/packages/ which I have just started to test. Instead of changing logic in many places, I have just forked the method from Joomla 3.3 and performed a sed across all instances of JArrayHelper::getValue(). Question now is whether there are other changes like this.

@ShMaunder

This comment has been minimized.

Show comment
Hide comment
@ShMaunder

ShMaunder Feb 25, 2015

Owner

If anybody could test http://server.shmanic.co.uk/jmml_builds/2.0.3.1/packages/ then that'll be great. From initial tests, it looks like it works correctly and if no further issues are found I will release this in the coming hours and push an auto-update as well.

Owner

ShMaunder commented Feb 25, 2015

If anybody could test http://server.shmanic.co.uk/jmml_builds/2.0.3.1/packages/ then that'll be great. From initial tests, it looks like it works correctly and if no further issues are found I will release this in the coming hours and push an auto-update as well.

@nmo-hosting

This comment has been minimized.

Show comment
Hide comment
@nmo-hosting

nmo-hosting Feb 26, 2015

I did a test with lib_shmanic.zip 25-Feb-2015 18:47

  1. Update lib
  2. Update to J3.4
  3. Tested Login again
  4. works

Are you going to push this by the web updater?
Thanks!

nmo-hosting commented Feb 26, 2015

I did a test with lib_shmanic.zip 25-Feb-2015 18:47

  1. Update lib
  2. Update to J3.4
  3. Tested Login again
  4. works

Are you going to push this by the web updater?
Thanks!

@RM-rvf

This comment has been minimized.

Show comment
Hide comment
@RM-rvf

RM-rvf Mar 5, 2015

Awesome guys :). Thanks a bunch, you saved me a headache

RM-rvf commented Mar 5, 2015

Awesome guys :). Thanks a bunch, you saved me a headache

@patgaytx

This comment has been minimized.

Show comment
Hide comment
@patgaytx

patgaytx Mar 12, 2015

I can also confirm that the updated lib_shmanic.zip 25-Feb-2015 18:47 resolved the issue. Here's what I did:

  1. Visit http://server.shmanic.co.uk/jmml_builds/2.0.3.1/packages/
  2. Download lib_shmanic.zip 25-Feb-2015 18:47
  3. Backup my site
  4. Using the Joomla Installer, install lib_shmanic.zip
  5. Done

patgaytx commented Mar 12, 2015

I can also confirm that the updated lib_shmanic.zip 25-Feb-2015 18:47 resolved the issue. Here's what I did:

  1. Visit http://server.shmanic.co.uk/jmml_builds/2.0.3.1/packages/
  2. Download lib_shmanic.zip 25-Feb-2015 18:47
  3. Backup my site
  4. Using the Joomla Installer, install lib_shmanic.zip
  5. Done
@conconnl

This comment has been minimized.

Show comment
Hide comment
@conconnl

conconnl Jan 20, 2017

@ShMaunder I think this one can be closed

conconnl commented Jan 20, 2017

@ShMaunder I think this one can be closed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment