Skip to content
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

rtrim() expects parameter 1 to be string, bool given vendor/magento/framework/Encryption/Adapter/Mcrypt.php(171): rtrim() #35464

Open
hoangngo-calvin opened this issue May 12, 2022 · 35 comments
Labels
Area: Install & Administer Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed Priority: P2 A defect with this priority could have functionality issues which are not to expectations. Progress: ready for dev Reproduced on 2.4.x The issue has been reproduced on latest 2.4-develop branch

Comments

@hoangngo-calvin
Copy link

Preconditions (*)

  1. Magento 2.4.3-p2
  2. php7.4.29
  3. MySQL 8.0
  4. Ubuntu 22.04

Steps to reproduce (*)

  1. Run composer to download source code
  2. run the install command
php bin/magento setup:install \
 --base-url=http://mc243p2.local/ \
 --db-host=127.0.0.1:8030 \
 --db-user=root \
 --db-password=RootAD111!!! \
 --backend-frontname=admin \
 --admin-firstname=admin \
 --admin-lastname=admin \
 --admin-email=adminwww@admin.com \
 --admin-user=admin \
 --admin-password=Admin111!!! \
 --use-rewrites=1 \
--elasticsearch-host=127.0.0.1 \
--elasticsearch-port=9230 \
--elasticsearch-index-prefix=demo_mc243p2 \
 --db-name=demo_mc243p2_01

Expected result (*)

Command run successfully

Actual result (*)

There is an exception

[Progress: 1015 / 1382]
Module 'Dotdigitalgroup_Email':
Installing data... Upgrading data... 
Enabling caches:
Current status:
layout: 1
block_html: 1
full_page: 1
rtrim() expects parameter 1 to be string, bool given#0 /var/www/mc243p2/vendor/magento/framework/Encryption/Adapter/Mcrypt.php(171): rtrim()
#1 /var/www/mc243p2/vendor/magento/framework/Encryption/Encryptor.php(452): Magento\Framework\Encryption\Adapter\Mcrypt->decrypt()
#2 /var/www/mc243p2/vendor/magento/module-config/Model/Config/Backend/Encrypted.php(111): Magento\Framework\Encryption\Encryptor->decrypt()
#3 /var/www/mc243p2/generated/code/Magento/Config/Model/Config/Backend/Encrypted/Interceptor.php(32): Magento\Config\Model\Config\Backend\Encrypted->processValue()
#4 /var/www/mc243p2/vendor/magento/framework/App/Config/MetadataConfigTypeProcessor.php(133): Magento\Config\Model\Config\Backend\Encrypted\Interceptor->processValue()
#5 /var/www/mc243p2/vendor/magento/framework/App/Config/MetadataConfigTypeProcessor.php(152): Magento\Framework\App\Config\MetadataConfigTypeProcessor->processScopeData()
#6 /var/www/mc243p2/vendor/magento/framework/App/Config/PostProcessorComposite.php(36): Magento\Framework\App\Config\MetadataConfigTypeProcessor->process()
#7 /var/www/mc243p2/generated/code/Magento/Framework/App/Config/PostProcessorComposite/Proxy.php(95): Magento\Framework\App\Config\PostProcessorComposite->process()
#8 /var/www/mc243p2/vendor/magento/module-config/App/Config/Type/System.php(397): Magento\Framework\App\Config\PostProcessorComposite\Proxy->process()
#9 /var/www/mc243p2/vendor/magento/framework/Cache/LockGuardedCacheLoader.php(136): Magento\Config\App\Config\Type\System->readData()
#10 /var/www/mc243p2/vendor/magento/module-config/App/Config/Type/System.php(281): Magento\Framework\Cache\LockGuardedCacheLoader->lockedLoadData()
#11 /var/www/mc243p2/vendor/magento/module-config/App/Config/Type/System.php(207): Magento\Config\App\Config\Type\System->loadDefaultScopeData()
#12 /var/www/mc243p2/vendor/magento/module-config/App/Config/Type/System.php(181): Magento\Config\App\Config\Type\System->getWithParts()
#13 /var/www/mc243p2/vendor/magento/framework/App/Config.php(132): Magento\Config\App\Config\Type\System->get()
#14 /var/www/mc243p2/vendor/magento/framework/App/Config.php(80): Magento\Framework\App\Config->get()
#15 /var/www/mc243p2/vendor/magento/framework/App/Config.php(93): Magento\Framework\App\Config->getValue()
#16 /var/www/mc243p2/vendor/dotmailer/dotmailer-magento2-extension/Setup/UpgradeData.php(400): Magento\Framework\App\Config->isSetFlag()
#17 /var/www/mc243p2/vendor/dotmailer/dotmailer-magento2-extension/Setup/UpgradeData.php(170): Dotdigitalgroup\Email\Setup\UpgradeData->upgradeFourFiveTwo()
#18 /var/www/mc243p2/setup/src/Magento/Setup/Model/Installer.php(1076): Dotdigitalgroup\Email\Setup\UpgradeData->upgrade()
#19 /var/www/mc243p2/setup/src/Magento/Setup/Model/Installer.php(960): Magento\Setup\Model\Installer->handleDBSchemaData()
#20 [internal function]: Magento\Setup\Model\Installer->installDataFixtures()
#21 /var/www/mc243p2/setup/src/Magento/Setup/Model/Installer.php(389): call_user_func_array()
#22 /var/www/mc243p2/setup/src/Magento/Setup/Console/Command/InstallCommand.php(231): Magento\Setup\Model\Installer->install()
#23 /var/www/mc243p2/vendor/symfony/console/Command/Command.php(255): Magento\Setup\Console\Command\InstallCommand->execute()
#24 /var/www/mc243p2/vendor/symfony/console/Application.php(1009): Symfony\Component\Console\Command\Command->run()
#25 /var/www/mc243p2/vendor/symfony/console/Application.php(273): Symfony\Component\Console\Application->doRunCommand()
#26 /var/www/mc243p2/vendor/magento/framework/Console/Cli.php(115): Symfony\Component\Console\Application->doRun()
#27 /var/www/mc243p2/vendor/symfony/console/Application.php(149): Magento\Framework\Console\Cli->doRun()
#28 /var/www/mc243p2/bin/magento(23): Symfony\Component\Console\Application->run()
#29 {main}

image

@m2-assistant
Copy link

m2-assistant bot commented May 12, 2022

Hi @Hoangss. Thank you for your report.
To speed up processing of this issue, make sure that you provided the following information:

  • Summary of the issue
  • Information on your environment
  • Steps to reproduce
  • Expected and actual results

Make sure that the issue is reproducible on the vanilla Magento instance following Steps to reproduce. To deploy vanilla Magento instance on our environment, Add a comment to the issue:

@magento give me 2.4-develop instance - upcoming 2.4.x release

For more details, review the Magento Contributor Assistant documentation.

Add a comment to assign the issue: @magento I am working on this

To learn more about issue processing workflow, refer to the Code Contributions.


⚠️ According to the Magento Contribution requirements, all issues must go through the Community Contributions Triage process. Community Contributions Triage is a public meeting.

🕙 You can find the schedule on the Magento Community Calendar page.

📞 The triage of issues happens in the queue order. If you want to speed up the delivery of your contribution, join the Community Contributions Triage session to discuss the appropriate ticket.

✏️ Feel free to post questions/proposals/feedback related to the Community Contributions Triage process to the corresponding Slack Channel

@hoangngo-calvin
Copy link
Author

hoangngo-calvin commented May 12, 2022

While I'm debugging I saw this method return false: openssl_decrypt() in:

\phpseclib\Crypt\Base::decrypt
vendor/phpseclib/phpseclib/phpseclib/Crypt/Base.php:1084

image

I'm not quite sure what is wrong.

Can it be because of this OpenSSL version?

$ php -i | grep 'OpenSSL\|openssl'

SSL Version => OpenSSL/3.0.2
libSSH Version => libssh/0.9.6/openssl/zlib
openssl
OpenSSL support => enabled
OpenSSL Library Version => OpenSSL 3.0.2 15 Mar 2022
OpenSSL Header Version => OpenSSL 3.0.2 15 Mar 2022
Openssl default config => /usr/lib/ssl/openssl.cnf
openssl.cafile => no value => no value
openssl.capath => no value => no value
Native OpenSSL support => enabled

@shoaibpnp
Copy link

I had the same issue today. I found out the php mcrypt library was not installed.

I just installed it on my server using apt install php7.4-mcrypt

Now installation worked perfectly

@edgarspatmalnieks
Copy link

The solution of @shoaibpnp worked for me as well.

Thanks!

@engcom-Dash engcom-Dash self-assigned this May 17, 2022
@m2-assistant
Copy link

m2-assistant bot commented May 17, 2022

Hi @engcom-Dash. 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: 👇

    1. Verify that issue has all the required information. (Preconditions, Steps to reproduce, Expected result, Actual result).
      DetailsIf the issue has a valid description, the label Issue: Format is valid will be added to the issue automatically. Please, edit issue description if needed, until label Issue: Format is valid appears.
    1. 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.
    1. Add Component: XXXXX label(s) to the ticket, indicating the components it may be related to.
    1. Verify that the issue is reproducible on 2.4-develop branch
      Details- Add the comment @magento give me 2.4-develop instance to deploy test instance on Magento infrastructure.
      - If the issue is reproducible on 2.4-develop branch, please, add the label Reproduced on 2.4.x.
      - If the issue is not reproducible, add your comment that issue is not reproducible and close the issue and stop verification process here!

@engcom-Dash engcom-Dash added Issue: Cannot Reproduce Cannot reproduce the issue on the latest `2.4-develop` branch Issue: needs update Additional information is require, waiting for response labels May 17, 2022
@m2-community-project m2-community-project bot moved this from Ready for Confirmation to Needs Update in Issue Confirmation and Triage Board May 17, 2022
@m2-community-project m2-community-project bot removed Issue: Cannot Reproduce Cannot reproduce the issue on the latest `2.4-develop` branch Issue: ready for confirmation labels May 17, 2022
@engcom-Dash engcom-Dash added Issue: ready for confirmation and removed Issue: needs update Additional information is require, waiting for response labels May 17, 2022
@m2-community-project m2-community-project bot moved this from Needs Update to Ready for Confirmation in Issue Confirmation and Triage Board May 17, 2022
@m2-community-project m2-community-project bot moved this from Needs Update to Ready for Confirmation in Issue Confirmation and Triage Board May 17, 2022
@engcom-Dash engcom-Dash added Issue: Cannot Reproduce Cannot reproduce the issue on the latest `2.4-develop` branch Issue: needs update Additional information is require, waiting for response labels May 17, 2022
@m2-community-project m2-community-project bot moved this from Ready for Confirmation to Needs Update in Issue Confirmation and Triage Board May 17, 2022
@m2-community-project m2-community-project bot removed Issue: Cannot Reproduce Cannot reproduce the issue on the latest `2.4-develop` branch Issue: ready for confirmation labels May 17, 2022
@engcom-Dash engcom-Dash removed the Issue: needs update Additional information is require, waiting for response label May 17, 2022
@m2-community-project m2-community-project bot moved this from Needs Update to Ready for Confirmation in Issue Confirmation and Triage Board May 17, 2022
@engcom-Dash engcom-Dash added Issue: needs update Additional information is require, waiting for response and removed Issue: ready for confirmation labels May 17, 2022
@m2-community-project m2-community-project bot moved this from Ready for Confirmation to Needs Update in Issue Confirmation and Triage Board May 17, 2022
@m2-community-project m2-community-project bot moved this from Ready for Confirmation to Needs Update in Issue Confirmation and Triage Board May 17, 2022
@engcom-Dash
Copy link

engcom-Dash commented May 17, 2022

Hello @Hoangss,

We have tried to reproduce the issue in Magento 2.4.3-p2 instance. the issue is not reproducible. Please refer the below screenshot for the reference;

Screenshot from 2022-05-17 17-45-35

We have followed the below steps in order to reproduce the issue:

  1. To Install Magento 2.4.3-p2 Instance
  2. Run setup Install Comment Without Mcrypt Extension.
  3. Command Ran Successfully.
    ...

Let us know in case we have missed anything.

Thanks

@hostep
Copy link
Contributor

hostep commented Jun 20, 2022

It's CE (which is called Open Source these days).
Just try setting up Magento 2.4.3-p2 again from scratch, maybe some dependency got some newer version and that bumps the number by one?

If you still run into the same problem when the mcrypt extension is not installed, try debugging these lines, and see why they return an Mcrypt instance and maybe also what exact data is trying to be decrypted, and where that data comes from.

@hoangngo-calvin
Copy link
Author

hi @hostep
According to this comment: #35464 (comment)
I tried to debug, IIRC It seems doesn't return the Mcrypt instance, It used OpenSSL to decrypt and the data returned by processValue() is false (in the image)
And then it throw the exception
rtrim() expects parameter 1 to be string, bool given#0 /var/www/mc243p2/vendor/magento/framework/Encryption/Adapter/Mcrypt.php(171): rtrim()

openssl_decrypt was called:
$plaintext = openssl_decrypt($ciphertext, $this->cipher_name_openssl, $this->key, $this->openssl_options);

@m2-assistant
Copy link

m2-assistant bot commented Jun 21, 2022

Hi @engcom-Hotel. 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: 👇

  • 1. Verify that issue has all the required information. (Preconditions, Steps to reproduce, Expected result, Actual result).

    DetailsIf the issue has a valid description, the label Issue: Format is valid will be added to the issue automatically. Please, edit issue description if needed, until label Issue: Format is valid appears.

  • 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.4-develop branch

    Details- Add the comment @magento give me 2.4-develop instance to deploy test instance on Magento infrastructure.
    - If the issue is reproducible on 2.4-develop branch, please, add the label Reproduced on 2.4.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. Add label Issue: Confirmed once verification is complete.

  • 6. Make sure that automatic system confirms that report has been added to the backlog.

@m2-community-project m2-community-project bot removed the Issue: Cannot Reproduce Cannot reproduce the issue on the latest `2.4-develop` branch label Jun 21, 2022
@engcom-Hotel
Copy link
Contributor

Thanks, @hostep for the guidance.

Hello @Hoangss,

We have tried to debug the issue as per this #35464 (comment) and add a breakpoint in the getCrypt method at line no. 517 and 538. As we can see, it always returns the SodiumChachaIetf object and does not break on line 538.

Thanks

@engcom-Hotel engcom-Hotel added the Issue: Cannot Reproduce Cannot reproduce the issue on the latest `2.4-develop` branch label Jun 21, 2022
@zeljko989
Copy link

I had the same issue today. I found out the php mcrypt library was not installed.

I just installed it on my server using apt install php7.4-mcrypt

Now installation worked perfectly

YEAH, that was issue with my setup also, and I got this error below ( maybe to someone will be helpful ):

  • During the upgrade command process
Type Error occurred when creating object: Magento\Framework\Locale\Resolver, rtrim() expects parameter 1 to be string, bool given
In AbstractFactory.php line 131:
  Type Error occurred when creating object: Magento\Framework\Locale\Resolver, rtrim() expects parameter 1 to be string, bool given

@engcom-Hotel
Copy link
Contributor

Hello @zeljko989,

Thanks for the contribution!

Please let us know from which version to which version you are trying to upgrade the Magento.

Thanks

@shuvoenr
Copy link

shuvoenr commented Jul 3, 2022

@engcom-Hotel

Please do try with configuration @hoangngo-calvin at first line.

Magento 2.4.3-p2
php7.4.30
MySQL 8.0
Ubuntu 22.04

With ubuntu 22.04.

I tried with that configuration and every-time found same issue & that's weird.

apt install php7.4-mcrypt install solved the issue but which obviously not optimal. As Magento release on 12 April. On the other hand ubuntu release on 21st april.

There may be compatibility issue

@engcom-Hotel
Copy link
Contributor

Hello @hoangngo-calvin @shuvoenr,

Thanks for the report and collaboration!

We are able to reproduce the issue with Magento 2.4.3-P2 with the below configuration:

  • PHP 7.4.30
  • Mysql 8.0
  • Ubuntu 22.04

Versions

Getting the error:
error

But after installing Mcrypt, the installation is successful:
after_mcrypt_installation

We have also tried to install Magento 2.4.4 and 2.4-develop with the below configuration:

  • PHP 8.1
  • Mysql 8.0
  • Ubuntu 22.04

The installation is successfully done.

So confirming this issue for 2.4.3-p2.

Thanks

@engcom-Hotel engcom-Hotel added Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed Reproduced on 2.4.x The issue has been reproduced on latest 2.4-develop branch Priority: P2 A defect with this priority could have functionality issues which are not to expectations. Area: Install & Administer labels Jul 7, 2022
@m2-community-project m2-community-project bot added this to Dev In Progress in High Priority Backlog Jul 7, 2022
@github-jira-sync-bot
Copy link

✅ Jira issue https://jira.corp.magento.com/browse/AC-5900 is successfully created for this GitHub issue.

@m2-assistant
Copy link

m2-assistant bot commented Jul 7, 2022

✅ Confirmed by @engcom-Hotel. Thank you for verifying the issue.
Issue Available: @engcom-Hotel, You will be automatically unassigned. Contributors/Maintainers can claim this issue to continue. To reclaim and continue work, reassign the ticket to yourself.

@m2-community-project m2-community-project bot moved this from Dev In Progress to Ready for Development in High Priority Backlog Jul 7, 2022
@hoangngo-calvin
Copy link
Author

Hi @engcom-Hotel
Thank you so much for your effort.

@webloft
Copy link

webloft commented Jan 13, 2023

This bug appeared out of nowhere yesterday. The mcrypt workaround solved the issue it seems.

What happens in background? The log says it tries to decrypt the value 'Paypal'. Is that something related to an invalid API key or something?

Magento\\Framework\\Encryption\\Encryptor->decrypt('PayPal')

@engcom-Hotel engcom-Hotel removed Issue: Cannot Reproduce Cannot reproduce the issue on the latest `2.4-develop` branch Issue: needs update Additional information is require, waiting for response labels Jan 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: Install & Administer Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed Priority: P2 A defect with this priority could have functionality issues which are not to expectations. Progress: ready for dev Reproduced on 2.4.x The issue has been reproduced on latest 2.4-develop branch
Projects
High Priority Backlog
  
Ready for Development
Development

No branches or pull requests