Skip to content

Fix: Avoid division by zero error on zero installments #37

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

rafaelamiranda
Copy link

Description

This PR fixes a critical problem that causes a PHP DivisionByZeroError when the number of installments (_pagbank_credit_card_installments) is zero or not properly set.

When a payment fails or is rejected, this meta value is sometimes saved as zero, causing issues when the order details or emails are displayed, due to the division by the installment count.

Steps to reproduce:

  • Create an order with PagBank payment and purposely fail the transaction or simulate a rejected payment.
  • Try changing the order status from "Rejected" to other statuses directly from WooCommerce admin panel.
  • A fatal error will occur because of the division by zero.

Copy link

gate-sast bot commented Mar 26, 2025

Code Security - SAST Scan


Seu scan ja foi inserido na fila de processamento.

Em alguns instantes o resultado será entregue


Quer saber mais? Acesse a nossa FAQ


Copy link

gate-sast bot commented Mar 26, 2025

Code Security - SAST Scan


Resumo da Análise:


Quer saber mais? Acesse a nossa FAQ


Tip

Para acessar a pagina de resultados e verificar as correções necessárias acesse:
Resultados detalhados
** Para realizar uma nova análise basta comentar 'scan' nessa PR **

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant