Skip to content

Fatal error em PHP 8.1 – Cannot access offset of type string on string (class-wc-paghiper-admin.php:129) #102

@renandepaula

Description

@renandepaula

Usano o PHP 8.1, o plugin quebrou o admin do WooCommerce com erro fatal.

Passo a passo pra reproduzir

  1. Ative o plugin na versão 2.4.3.
  2. Com PHP ≥ 8.1 ativo, abra um pedido no admin:
  3. /wp-admin/admin.php?page=wc-orders&action=edit&id=123.
  4. A tela cai direto em erro 500.

StackTrace

Uncaught TypeError: Cannot access offset of type string on string
in wp-content/plugins/woo-boleto-paghiper/includes/class-wc-paghiper-admin.php:129
Stack trace:
#0 wp-admin/includes/template.php(1456): WC_Paghiper_Admin->metabox_content()
#1 wp-content/plugins/woocommerce/src/Internal/Admin/Orders/Edit.php(502): do_meta_boxes()
...

Raiz do problema

$transaction às vezes chega como string JSON, não array.
No PHP 8.1 a tentativa de ler $transaction['bar_code_url'] gera fatal.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions