Syntax Error in 2.0.6

Created on 11 January 2024, 6 months ago
Updated 30 January 2024, 5 months ago

Problem/Motivation

Syntax error in 2.0.6

Steps to reproduce

Install module
Clear cache OR
Either attempt to visit the config page
Error message:

The website encountered an unexpected error. Please try again later.
ParseError: syntax error, unexpected ')', expecting variable (T_VARIABLE) in Composer\Autoload\{closure}() (line 167 of modules/contrib/oauth_server_sso/src/Form/MiniorangeServerMapping.php).
Composer\Autoload\{closure}() (Line: 427)
Composer\Autoload\ClassLoader->loadClass()
spl_autoload_call()
class_exists() (Line: 73)
Drupal\Core\Entity\EntityResolverManager->getControllerClass() (Line: 212)
Drupal\Core\Entity\EntityResolverManager->setRouteOptions() (Line: 48)
Drupal\Core\EventSubscriber\EntityRouteAlterSubscriber->onRoutingRouteAlterSetType()
call_user_func() (Line: 142)
Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher->dispatch() (Line: 189)
Drupal\Core\Routing\RouteBuilder->rebuild() (Line: 83)
Drupal\Core\ProxyClass\Routing\RouteBuilder->rebuild() (Line: 585)
drupal_flush_all_caches() (Line: 205)
Drupal\admin_toolbar_tools\Controller\ToolbarController->flushAll()
call_user_func_array() (Line: 123)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 564)
Drupal\Core\Render\Renderer->executeInRenderContext() (Line: 124)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext() (Line: 97)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 169)
Symfony\Component\HttpKernel\HttpKernel->handleRaw() (Line: 81)
Symfony\Component\HttpKernel\HttpKernel->handle() (Line: 58)
Drupal\Core\StackMiddleware\Session->handle() (Line: 48)
Drupal\Core\StackMiddleware\KernelPreHandle->handle() (Line: 106)
Drupal\page_cache\StackMiddleware\PageCache->pass() (Line: 85)
Drupal\page_cache\StackMiddleware\PageCache->handle() (Line: 50)
Drupal\ban\BanMiddleware->handle() (Line: 48)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle() (Line: 134)
Drupal\cloudflare\CloudFlareMiddleware->handle() (Line: 51)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle() (Line: 23)
Stack\StackedHttpKernel->handle() (Line: 709)
Drupal\Core\DrupalKernel->handle() (Line: 19)

Proposed resolution

Remove comma at end of $vars in the func

Proposed corrected code, starting with line 167 of modules/contrib/oauth_server_sso/src/Form/MiniorangeServerMapping.php:

    public function createRow($key, $value, $type='', $custom_fields=array()){
        $config = \Drupal::config('oauth_server_sso.settings');
        if($type=='custom' || $type=='constant'){
            $row_form['name']= array(
            '#type' => 'textfield',
            '#attributes' => ['placeholder' => t('Enter Attribute Name'),],
            '#disabled' => true,
            );
            if($type=='constant'){
                $row_form['value']= array(
                    '#type' => 'textfield',
                    '#attributes' => ['placeholder' => t('Enter the Value'),],
                    '#disabled' => true,
                );
            }else{
                $row_form['value']= array(
                    '#type' => 'select',
                    '#options' => $custom_fields,

                );
            }
            $row_form['mo_minus_button'] = array(
                    '#type' => 'button',
                    '#value' => t('Remove'),
                    '#disabled' => true,
                    '#attributes' => ['class' => ['button--small button--primary']]
            );
        }elseif($type=='basic'){
            $row_form[$key.'_name']=array(
                '#type' => 'textfield',
                '#default_value' => $config->get($value.'_attr_name'),
                '#required' =>true,
            );
            $row_form[$key.'_value']=array(
            '#type' => 'textfield',
            '#default_value' => $value,
            '#disabled' => true,
             );
        }
     return $row_form;
    }
}

Remaining tasks

Roll a patch

User interface changes

None

API changes

None

Data model changes

None

πŸ› Bug report
Status

Fixed

Version

2.0

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States jghyde

Live updates comments and jobs are added and updated live.
  • PHP 8.0

    The issue particularly affects sites running on PHP version 8.0.0 or later.

Sign in to follow issues

Comments & Activities

Production build 0.69.0 2024