Skip to content

#critical bug getimagesize on svg don't work and breaking my saved card area in customer account.  #276

@4j4yk

Description

@4j4yk

Issue -

#

$asset = $this->ccConfig->createAsset('Swarming_SubscribePro::images/cc/' . strtolower($code) . '.svg');
$placeholder = $this->assetSource->findSource($asset);
if ($placeholder) {
list($width, $height) = getimagesize($asset->getSourceFile());
$this->icons[$code] = [
'url' => $asset->getUrl(),
'width' => $width,
'height' => $height,
'title' => __($label),
];
}
}
}

Steps to produce -

  • Create a subscription, and make sure the card is vaulted/saved
  • visit customer my saved card section, which will result in an error

error -

[2024-04-02T18:22:19.751039+00:00] report.CRITICAL: TypeError: PayPal\Braintree\Block\Customer\CardRenderer::getIconWidth(): Return value must be of type int, null returned in  /vendor/paypal/module-braintree-core/Block/Customer/CardRenderer.php:76
Stack trace:

Workaround -

  • Disable the plugin via di.xml

Solution -

  • Replace SVG image with png or use existing one.

Notes -

Magento native code uses png files.
https://github.com/magento/magento2/blob/2.4-develop/app/code/Magento/Payment/Model/CcConfigProvider.php#L74-L86

Di for plugin having issue -

<type name="Magento\Payment\Model\CcConfigProvider">
<plugin name="subscribepro_cc_icons" type="Swarming\SubscribePro\Plugin\Payment\CcConfigProvider" />
</type>

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions