1

I am using the base64_decode() and base64_encode() in my code but PHPCS says

The use of function base64_decode() is discouraged so what's the equivalence of this core PHP function in Magento2?

1
  • There is literally no wrapper class for this function, closest you can go is \Magento\Framework\Serialize\Serializer\Serialize which json decode and base_64decode the string simultaneously, classic case of Magento being Magento. – Vivek Kumar Aug 4 '20 at 7:24
3

Magento does not have equivalence function of base64_decode() and base64_encode() method.

Using phpcs:ignore you can use these two methods.Like Below

// phpcs:ignore Magento2.Functions.DiscouragedFunction
    base64_decode($content);
// phpcs:ignore Magento2.Security.LanguageConstruct.ExitUsage
3

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.