Skip to main content

Magento2

Power your online business with the most flexible and scalable ecommerce platform

Notice: Undefined offset: 2 in Encryptor.php

Error : Notice: Undefined offset: 2 in vendor\magento\framework \Encryption\Encryptor.php

Some time you will have the below error after you move Magento2 from server to another server with different PHP version or even with the same PHP version , now what is the first solution we can do 

mostly this library will be missed 

php-sodium

So we need to install it , below is some command we can do to install it on Centos

How Magento2 format the product URL

I have looked at almost 100 articles to know how Magento format the URL without any success and finally I found it and it was really so easy , here is the quick way to see it using object manager

Note: please consider to use the dependency injection

 

$_productloader = $objectManager->get('\Magento\Catalog\Model\ProductFactory');
$product =  $_productloader->create()->load(1);


echo  $product->formatUrlKey({Your text here});

 

in this way Magento will give you the correct URL which will be used 

Magento 2 correct permissions

The most frequent question, asked by Magento users, is correct permissions. They can differ, whether you run your store in one-user mode, or many-user, and also can be different for different modes.

Single user mode

One-user mode is the simplest case. In this case user shall belong to group, which own Magento system and also runs web-server. For them the following rules apply:

Apply Magento2 Patch manually using GIT

The best easy way is to simulate the directory path, so lets assume you will need to fix the comparison page after you upgrade to Magento 2.3.5-p2

Filename: vendor/magento/module-catalog/Helper/Output.php

we need to replace this line 

- if (preg_match($pattern, $attributeHtml)) {

with this line 

+ if (preg_match($pattern, (string) $attributeHtml)) {

 

Now create those directories vendor/magento/module-catalog/Helper