#Specific chunk of PHP code consistently causes "Something went wrong..."

5 messages · Page 1 of 1 (latest)

cyan verge
#

Bug Report:

Pasting in code from a specific open source PHP Drupal module, commerce_authnet, causes ChatGPT (GPT-4) to error. This happens consistently across conversations. One reproducible example is below but other code from these modules has caused the same result.

Steps to reproduce:

  1. On chat.openai.com, open a new conversation with GPT-4
  2. Paste in the following PHP code (this is part of the main .module file from open source code in Drupal module commerce_authnet)
<?php

/**
 * Implements hook_form_alter().
 */
function commerce_authnet_form_alter(&$form, FormStateInterface $form_state, $form_id) {
  if (!empty($form['#step_id']) && $form['#step_id'] == 'review') {
    $build_info = $form_state->getBuildInfo();
    /** @var Drupal\commerce_checkout\Plugin\Commerce\CheckoutFlow\MultistepDefault $checkout_flow */
    $checkout_flow = $build_info['callback_object'];
    $order = $checkout_flow->getOrder();
    if (!$order->payment_gateway->isEmpty()) {
      $payment_gateway_plugin_id = $order->payment_gateway->entity->getPluginId();
      if ($payment_gateway_plugin_id === 'authorizenet_visa_checkout') {
        $form['actions']['next']['#value'] = t('Proceed to next step to finish with Visa Checkout');
      }
    }
  }
}

/**
 * Implements hook_cron().
 */
function commerce_authnet_cron() {
  $verifier = \Drupal::getContainer()->get('commerce_authnet.echeck_transaction_verifier');
  $payments = $verifier->getPayments();
  foreach ($payments as $payment) {
    $verifier->processPayment($payment);
  }
}

Expected result:

An explanation of the code or contextual response based on a question about the code

Actual result:

Error: Something went wrong. If this issue persists please contact us through our help center at help.openai.com.

Additional information

Browser: Chrome
OS: MacOS

weak rivet
#

i try.. same with this short code

lunar mortar
#

I also get the same error.

thorn harness
stable cipher
#

@cyan verge can you DM me the email you're using with chatgpt?