TypeError: explode() expects parameter 2 to be string, integer given
#13 <magento_path>/vendor/magento/framework/Encryption/Encryptor.php(266): explode
#12 <magento_path>/vendor/magento/framework/Encryption/Encryptor.php(266): getPasswordVersion
More recent versions of Magento sets the declare(strict_types=1); flag in most (all?) classes.
The hash version passed to the explode function is an integer
const HASH_VERSION_SHA256 = 1;
const HASH_VERSION_LATEST = 1;
const PASSWORD_VERSION = 2;
const DELIMITER = ':';
private $passwordHashMap = [
self::PASSWORD_VERSION => self::HASH_VERSION_LATEST
];
private function getPasswordVersion()
{
return array_map('intval', explode(self::DELIMITER, $this->passwordHashMap[self::PASSWORD_VERSION]));
}
Method definition of explode
array explode ( string $delimiter , string $string [, int $limit = PHP_INT_MAX ] )
Notice how the $string parameter requires a string type, but the given value resolves to an integer (1).
Hi @k4emic. Thank you for your report.
To help us process this issue please make sure that you provided the following information:
Please make sure that the issue is reproducible on the vanilla Magento instance following Steps to reproduce. To deploy vanilla Magento instance on our environment, please, add a comment to the issue:
@magento-engcom-team give me $VERSION instance
where $VERSION is version tags (starting from 2.2.0+) or develop branches (for example: 2.3-develop).
For more details, please, review the Magento Contributor Assistant documentation.
@k4emic do you confirm that you was able to reproduce the issue on vanilla Magento instance following steps to reproduce?
@magento-engcom-team give me 2.3-develop instance
Hi @k4emic. Thank you for your request. I'm working on Magento 2.3-develop instance for you
Hi @k4emic, here is your Magento instance.
Admin access: http://34.228.235.121/i-19187-2-3-develop//admin
Login: admin Password: 123123q
Instance will be terminated in up to 3 hours.
I'm unable to reproduce this on the vanilla instance given here. Could this be tied to PHP 7.2 exclusively? Is there any way of verifying the PHP version of the given instances?
Hi @engcom-backlog-nazar. Thank you for working on this issue.
In order to make sure that issue has enough information and ready for development, please read and check the following instruction: :point_down:
Issue: Format is valid will be added to the issue automatically. Please, edit issue description if needed, until label Issue: Format is valid appears.[x] 2. Verify that issue has a meaningful description and provides enough information to reproduce the issue. If the report is valid, add Issue: Clear Description label to the issue by yourself.
[ ] 3. Add Component: XXXXX label(s) to the ticket, indicating the components it may be related to.
[ ] 4. Verify that the issue is reproducible on 2.3-develop branchDetails
- Add the comment @magento-engcom-team give me 2.3-develop instance to deploy test instance on Magento infrastructure.
- If the issue is reproducible on 2.3-develop branch, please, add the label Reproduced on 2.3.x.
- If the issue is not reproducible, add your comment that issue is not reproducible and close the issue and _stop verification process here_!
[ ] 5. Verify that the issue is reproducible on 2.2-develop branch. Details
- Add the comment @magento-engcom-team give me 2.2-develop instance to deploy test instance on Magento infrastructure.
- If the issue is reproducible on 2.2-develop branch, please add the label Reproduced on 2.2.x
[ ] 6. Add label Issue: Confirmed once verification is complete.
[ ] 7. Make sure that automatic system confirms that report has been added to the backlog.
Hi @k4emic thank you for you report this issue has already fixed in 2.3-develop branch.
Hi @engcom-backlog-nazar
What leads you to this conclusion? No changes have been made in the respective file since June 7th, so why am I experiencing this on beta32? (Running EE in my case, but this is irrelevant for this bug).
The commit which caused this problem was added on May 13th link where some similar problems were fixed (notice the casting to string).
@k4emic this may be related to ee version, i set break point on this line, but the debugger won't stop there
@Parakoopa , Please follow these guidelines for proper tracking of your issue. You can report Commerce-related issues in one of two ways:
You can use the Support portal associated with your account
or
If you are a Partner reporting on behalf of a merchant, use the Partner portal.
GitHub is intended for Magento Open Source users to report on issues related to Open Source only. There are no account management services associated with GitHub.
is this solved finally? I get the same error in 2.3., with php 7.2
Got the same error with php7.1. If i debug this, the Problem happened like @k4emic told.
so it seems to be again the closed-but-not-fixed situation.
Hi @akosglue @ZFNerd please describe your steps because a lot of people can login in admin and have no this issue, can you share with your configuration ?
I lot of people can login indeed, and a lot of people cannot.
In our case the problem was probably that the user password hash was made with an older version of magento. After upgrade some users couldn't log in. Eventually we made a query to update password hashes and it seemed to work.
The users with problems had this kind of hash: 123123123abcd
We made an update to appen ::0 at the end.
So it became 123123123abcd::0
And that error with explode disappeared. The default integer 1 was not used any more.
However I don't know if it is the 'best practice'.
Most helpful comment
I lot of people can login indeed, and a lot of people cannot.
In our case the problem was probably that the user password hash was made with an older version of magento. After upgrade some users couldn't log in. Eventually we made a query to update password hashes and it seemed to work.
The users with problems had this kind of hash: 123123123abcd
We made an update to appen ::0 at the end.
So it became 123123123abcd::0
And that error with explode disappeared. The default integer 1 was not used any more.
However I don't know if it is the 'best practice'.