• Resolved Pawa Tecnologia

    (@pawatecnologia)


    Eu procurei o codigo de vocês no github para abrir uma issue, mas não achei. Então vou postar aqui mesmo.

    Existem vários Undefined array key. que poderia facilmente ser resolvido com uma valida se a chave existe no array.

    Exemplo: em wp-content/plugins/woo-asaas/includes/split/repository/class-split-legacy-repository.php na linha 13 mudar DE: return null !== $gateway->settings[ self::LEGACY_WALLET_COUNT_KEY ]; PARA: return ($gateway->settings[self::LEGACY_WALLET_COUNT_KEY] ?? null) !== null; .

    Tem também um preg_replace(): Passing null to parameter #3 que é resultado mais uma vez de falta de verificação da existência da chave no array. Lá em wp-content/plugins/woo-asaas/includes/meta-data/class-customer.php linha 315 basta mudar DE: preg_replace( $phone_clean_regex, '', $data['billing_cellphone'] ) PARA: preg_replace($phone_clean_regex, '', (string) ($data['billing_cellphone'] ?? ''))

    Bom isso são so exemplos de implementação existe várias outras formas como fazer uma função única que valida a presença da chave no array, etc.

    LOG do servidor:

    [24-Jun-2025 22:01:14 UTC] PHP Warning: Undefined array key "billing_cellphone" in /site/public_html/wp-content/plugins/woo-asaas/includes/meta-data/class-customer.php on line 315

    [24-Jun-2025 22:01:14 UTC] PHP Deprecated: preg_replace(): Passing null to parameter #3 ($subject) of type array|string is deprecated in /site/public_html/wp-content/plugins/woo-asaas/includes/meta-data/class-customer.php on line 315

    [24-Jun-2025 22:01:15 UTC] PHP Warning: Undefined array key "wallets" in /site/public_html/wp-content/plugins/woo-asaas/includes/split/repository/class-split-legacy-repository.php on line 13

    [24-Jun-2025 22:01:18 UTC] PHP Warning: Undefined property: stdClass::$split in /site/public_html/wp-content/plugins/woo-asaas/includes/split/repository/class-split-order-repository.php on line 17

    [24-Jun-2025 22:01:18 UTC] PHP Warning: foreach() argument must be of type array|object, null given in /site/public_html/wp-content/plugins/woo-asaas/includes/split/repository/class-split-order-repository.php on line 17

    [24-Jun-2025 22:07:21 UTC] PHP Warning: Undefined array key "wallets" in /site/public_html/wp-content/plugins/woo-asaas/includes/split/repository/class-split-legacy-repository.php on line 13

    [24-Jun-2025 22:09:27 UTC] PHP Warning: Undefined array key "url" in /site/public_html/wp-content/plugins/woo-asaas/includes/webhook/class-webhook-ajax.php on line 199

    [24-Jun-2025 22:09:27 UTC] PHP Warning: Undefined array key "url" in /site/public_html/wp-content/plugins/woo-asaas/includes/webhook/class-webhook-ajax.php on line 205

    [24-Jun-2025 22:09:27 UTC] PHP Warning: Undefined array key "api_key" in /site/public_html/wp-content/plugins/woo-asaas/includes/webhook/class-webhook-ajax.php on line 215

    [24-Jun-2025 22:10:05 UTC] PHP Warning: Undefined array key "wallets" in /site/public_html/wp-content/plugins/woo-asaas/includes/split/repository/class-split-legacy-repository.php on line 13

The topic ‘Undefined array key | Passing null to parameter’ is closed to new replies.