- Issue created by @mariaioann
- Status changed to Postponed: needs info
almost 2 years ago 12:32pm 31 January 2023 The inability to support trailing commas in function calls points to that PHP is actually < 7.3 on that system. Can you verify?
This pretty much shows what I mean:
# docker run -it php:7.4-cli /bin/sh # php -a Interactive shell php > $foo = 'bar'; php > var_dump($foo,); string(3) "bar" # docker run -it php:7.2-cli /bin/sh # php -a Interactive shell php > $foo = 'bar'; php > var_dump($foo,); Parse error: syntax error, unexpected ')' in php shell code on line 1
This is a more concrete demonstration:
$ docker run -it -v $PWD:/drupal php:7.4-cli /bin/sh # cd /drupal # php -l core/modules/ckeditor/src/Plugin/CKEditorPlugin/DrupalImageCaption.php No syntax errors detected in core/modules/ckeditor/src/Plugin/CKEditorPlugin/DrupalImageCaption.php # exit $ docker run -it -v $PWD:/drupal php:7.2-cli /bin/sh # cd /drupal # php -l core/modules/ckeditor/src/Plugin/CKEditorPlugin/DrupalImageCaption.php Parse error: syntax error, unexpected ')' in core/modules/ckeditor/src/Plugin/CKEditorPlugin/DrupalImageCaption.php on line 39 Errors parsing core/modules/ckeditor/src/Plugin/CKEditorPlugin/DrupalImageCaption.php
- 🇬🇷Greece mariaioann
Correct, trailing commas in functions are allowed from PHP 7.3+.
I do have PHP 7.4.
I should have mentioned that the error appears in browser console when using ajax in views, and the exact error message is the following:Drupal.AjaxError {message: 'An AJAX HTTP error occurred.HTTP Result Code: 20…rc/Plugin/CKEditorPlugin/DrupalImageCaption.php).', name: 'AjaxError'} message: "An AJAX HTTP error occurred. HTTP Result Code: 200 Debugging information follows. Path: /en/quickedit/attachments StatusText: OK ResponseText: ParseError: syntax error, unexpected ')' in Composer\\Autoload\\includeFile() (line 39 of web/core/modules/ckeditor/src/Plugin/CKEditorPlugin/DrupalImageCaption.php)." Error at http://local-d9/core/misc/ajax.js?v=9.5.2:642:3
- 🇬🇷Greece mariaioann
The same error is thrown at: /admin/config/content/formats/manage/full_html
My composer version is 1.10.26 if it is relevant with composer autoloading.ParseError: syntax error, unexpected ')' in Composer\Autoload\includeFile() (line 39 of core/modules/ckeditor/src/Plugin/CKEditorPlugin/DrupalImageCaption.php). Composer\Autoload\includeFile('/home/drupal9/web/core/modules/ckeditor/src/Plugin/CKEditorPlugin/DrupalImageCaption.php') (Line: 322) Composer\Autoload\ClassLoader->loadClass('Drupal\ckeditor\Plugin\CKEditorPlugin\DrupalImageCaption') spl_autoload_call('Drupal\ckeditor\Plugin\CKEditorPlugin\DrupalImageCaption') class_exists('Drupal\ckeditor\Plugin\CKEditorPlugin\DrupalImageCaption') (Line: 96) Drupal\Component\Plugin\Factory\DefaultFactory::getPluginClass('drupalimagecaption', Array, 'Drupal\ckeditor\CKEditorPluginInterface') (Line: 17) Drupal\Core\Plugin\Factory\ContainerFactory->createInstance('drupalimagecaption', Array) (Line: 83) Drupal\Component\Plugin\PluginManagerBase->createInstance('drupalimagecaption') (Line: 146) Drupal\ckeditor\CKEditorPluginManager->getButtons() (Line: 191) Drupal\ckeditor\Plugin\Editor\CKEditor->buildConfigurationForm(Array, Object) (Line: 165) editor_form_filter_format_form_alter(Array, Object, 'filter_format_edit_form') (Line: 562)
- 🇬🇷Greece mariaioann
OK, fair enough. Although both
drush status
andphp --version
report using PHP 7.4
and I have explicitly set php version to 7.4 with:sudo a2enmod php7.4 sudo update-alternatives --set php /usr/bin/php7.4
maybe I have a misconfiguration at some part of my stack that hardcodes the php version to < 7.3.
In that case, I suppose that this issue can be closed. - Status changed to Closed: works as designed
almost 2 years ago 4:16pm 1 February 2023 drush status and php --version are CLI commands. That site is certainly using a different version on the web. The PHPINFO section of the Drupal status report page will report the true version.