Quantcast
Channel: Issues for Drupal core
Viewing all 300222 articles
Browse latest View live

Remove long request protection from Drupal\FunctionalJavascriptTests\Tests\JSWebAssertTest


Allow SDCs to specify what components are allowed in its respective slots

$
0
0

Problem/Motivation

SDCs should be able to limit what components are allowed within its respective slots.

An example use case of this is that an accordion_group component should only allow an accordion_item component in it's main slot.

Similar use cases are tab groups and tab items, or a card carousel and a card.

We also need to ensure this works if the replaces key is being used where a theme replaces a module's component with its own.

Note that this is a vital use case for Experience Builder which is due Q3 this year.

Steps to reproduce

Proposed resolution

Remaining tasks

User interface changes

Introduced terminology

API changes

Data model changes

Release notes snippet

Update documentation for project versions in \Drupal\Core\Extension\InfoParserInterface::parse

$
0
0

Problem/Motivation

The feature added in #2205271: Project namespace for dependencies was missing some documentation of the new 'project' key. Let's add it here.

Steps to reproduce

Proposed resolution

In \Drupal\Core\Extension\InfoParserInterface::parse change
* - (versions): Version information, consisting of one or more
to
* - (versions): (optional) Version information, consisting of one or more

Remaining tasks

MR with the recommended change
Review
Commit

User interface changes

API changes

Data model changes

Release notes snippet

[random test failure] JSWebAssertTest::testJsWebAssert

$
0
0

Problem/Motivation

Drupal\FunctionalJavascriptTests\Tests\JSWebAssertTest::testJsWebAssert sometimes fails randomly as per the output below.

    JSWeb Assert (Drupal\FunctionalJavascriptTests\Tests\JSWebAssert)
     ✘ Js web assert
       ┐
       ├ WebDriver\Exception\StaleElementReference: stale element reference: stale element not found in the current frame
       ├   (Session info: chrome-headless-shell=127.0.6533.119)                                                          
       │
       │ /builds/issue/drupal-1822440/vendor/lullabot/php-webdriver/lib/WebDriver/Exception.php:198
       │ /builds/issue/drupal-1822440/vendor/lullabot/php-webdriver/lib/WebDriver/AbstractWebDriver.php:227
       │ /builds/issue/drupal-1822440/vendor/lullabot/php-webdriver/lib/WebDriver/Execute.php:56
       │ /builds/issue/drupal-1822440/vendor/lullabot/php-webdriver/lib/WebDriver/Session.php:530
       │ /builds/issue/drupal-1822440/vendor/lullabot/mink-selenium2-driver/src/Selenium2Driver.php:353
       │ /builds/issue/drupal-1822440/vendor/lullabot/mink-selenium2-driver/src/Selenium2Driver.php:315
       │ /builds/issue/drupal-1822440/vendor/lullabot/mink-selenium2-driver/src/Selenium2Driver.php:621
       │ /builds/issue/drupal-1822440/vendor/behat/mink/src/Element/NodeElement.php:142
       │ /builds/issue/drupal-1822440/core/tests/Drupal/FunctionalJavascriptTests/Tests/JSWebAssertTest.php:124
       ┴

Here's the relevant part of the test, the last line being the one that fails ($result->getAttribute('id')):

// Ensure that the javascript has replaced the element 1100 times.
$assert_session->waitForText('New Text!! 1100');
$result = $page->find('named', ['id', 'test_text']);
$this->assertSame('test_text', $result->getAttribute('id'));

The waitForText call returns TRUE or FALSE, but we don't check which we get. If the element doesn't exist we continue anyway.

Furthermore, it's possible the controller logic is flawed:

// Clear the interval after 1.1 seconds as this is shorter than the 10 seconds
// JSWebAssert::waitForElementVisible() waits for.

The comments suggest the the loop should take 1.1 seconds to complete, but in my browser it feels more like 5 seconds. I added some profiling and it varies from 4300 ms to 4600 ms for me. It's not unthinkable that this could take more than 10 seconds in some CI environments.

So in the case of a slow runner, waitForText is possibly exceeding the threshold. Then $page->find finds an element from loop number 1050 (for example). Then by the time we try to fetch the id attribute, the element has been replaced a further 50 times.

Steps to reproduce

https://git.drupalcode.org/issue/drupal-1822440/-/jobs/4730776

Proposed resolution

  1. Refactor the controller so there's no way it takes 10+ seconds, but still requires a wait
  2. Assert that we've actually found an element after waiting, possibly also assert it doesn't exist first
  3. Ensure the loop has stopped by the time we try to fetch the attribute from the element

Remaining tasks

User interface changes

Introduced terminology

API changes

Data model changes

Release notes snippet

[meta] Known intermittent, random, and environment-specific test failures

$
0
0

This issue is intended as a tracking issue only to list all of the known intermittent test failures affecting Drupal core. Some issues are due to bugs in Drupal core; others may be due to issues with DrupalCI infrastructure.

Only open issues should be listed in the summary.

Consistent failures

Intermittent failures

  1. #2825845: DST-related test failures in FilterDateTimeTest
  2. #2920590: (canard?) Big Bos of Random Fails is ChainedFastBackend::markAsOutdated()
  3. #3041318: Various random fails due to mis-triggered Mink deprecation error
  4. #3143812: [random test failure] Table 'sequences' already exists.
  5. #3150040: [random test failure] ScaffoldUpgradeTest and ScaffoldTest rely on packagist.org
  6. #3203712: [random test failure] EntityDisplayTest::testExtraFields()
  7. #3203712: [random test failure] EntityDisplayTest::testExtraFields()
  8. #3273626: Resolve issue with tests for Drupal Media JavaScript causing database locks on SQLite
  9. #3317520: [random test failure] Drupal\Tests\settings_tray\FunctionalJavascript\SettingsTrayBlockFormTest::testEditModeEnableDisable
  10. #3354138: [random test failure] MenuUiTest::testMenuAdministration can generate "escaped locator"
  11. #3387939: [random test failure] ToolbarClaroOverridesTest fails intermittently
  12. #3389994: [random test failure] MediaTest::testViewMode
  13. #3390881: [random test failure] Drupal.Tests.media_library.FunctionalJavascript.FieldUiIntegrationTest
  14. #3393137: [random test failure] SettingSummariesContentTypeTest::testWorkflowSummary
  15. #3393477: [random test failure] LocaleUpdateTest
  16. #3397387: [random test failure] MediaLinkabilityTest sometimes fails
  17. #3400150: [random test failure] TimestampFormatterWithTimeDiffTest::testTimestampFormatterWithTimeDiff
  18. #3406418: [gitlab-runner] invalid limit quantity for empty volume
  19. #3414321: [random test failure] Fail in mysql\ConnectionUnitTest::testOpenQueryPrefetchClose
  20. #3420399: [META] Random failures in Functional JavaScript Performance test(s)
  21. #3468830: [random test failure] BlockCacheTest::testCachePermissions()
  22. #3477586: [random test failure] LayoutBuilderBlocksTest::testBlockPlaceholder failing
  23. #3514924: [random test failure] JSWebAssertTest::testJsWebAssert

Low fail rate or may be resolved

Investigation and hardening for past random failures

If your patch has an unexpected test failure

  1. Always click on the test results link to see what tests actually failed.
  2. Check the test results on https://www.drupal.org/node/3060/qa. If the same test appears to be failing on the "tested on commit" environments, HEAD may be broken.
  3. Most test failures are actually caused by bugs in patches. Even if a failure appears to be random, consider that the patch may be introducing the bug.
  4. If the test result says "CI error" or "CI aborted", that generally indicates an issue with the infrastructure and not with the patch. Wait a bit, then requeue the tests for the patch.
  5. If the test says "Fatal error" with no other information, click "View results on dispatcher", then "Console Output", then "Full log", and search on the page for "segmentation fault". #2859704: Intermittent segfaults on DrupalCI (some "did not complete due to a fatal error" with no additional info) is a known issue that may cause the test runner to report a fatal in different tests.
  6. If the test failure appears to be one of the above known failures, there is no need to add additional reports of it (unless the issue specifically requests so). Usually, once a fail is identified, Drupal.org maintainers can locate other, similar fails in server logs if needed. However, you should document on your issue which specific known issue caused the failure.
  7. If there is an unexpected test failure that is not covered by one of the above issues, file a new critical issue and add it to this issue's summary.

Use Drupal Core Leadership terminology in MAINTAINERS.txt

Clean up the node_uid_revision handlers

$
0
0

Problem/Motivation

  1. As per https://www.php.net/manual/en/pdo.prepare.php"you cannot use a named parameter marker of the same name more than once in a prepared statement"
  2. We should let the database query optimizer do its job and write EXISTS where the intention is that. As written the system would need to retrieve all revisions written by a user, sort them by vid, keep only one per vid and then check whether the result set is empty or not. With EXISTS if the engine has such optimization, when a match is made, the execution can stop.
  3. The filter has a superfluous $args passed to addWhereExpression -- likely the thing is so complex the author of it just got confused by the end. No wonder.
  4. This complicated query is written twice. Let's move it to a trait.
  5. The title/description of it is very hard to search for. A suggested change is attached.

Steps to reproduce

The problem is inherent in the way the queries are written, nothing is broken as we have passing tests.

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet

Add array return to functions in global namespace

$
0
0

Problem/Motivation

Split #3513326: Add return type to functions in global namespace in to manageable chunks

Steps to reproduce

See parent

Proposed resolution

Run ReturnTypeFromStrictNewArrayRector on module, inc, engine, theme, profile, sh, post_update.php files. Anything not detected by this rector rule is out of scope.

Manually fix @return annotations that are added but out of scope

Remaining tasks

User interface changes

Introduced terminology

API changes

Data model changes

Release notes snippet


There are references in comments to nonexistent \Drupal\Core\TypedData\ListDefinitionInterface

$
0
0

Problem/Motivation

In code comments, there are three references to the interface \Drupal\Core\TypedData\ListDefinitionInterface, which does not seem to exist. If you encounter references to \Drupal\Core\TypedData\ListDefinitionInterface in code comments or documentation, they might be erroneous, as this interface does not exist in Drupal 11.

Steps to reproduce

$ grep -R 'ListDefinitionInterface' .
./core/lib/Drupal/Core/TypedData/ListInterface.php: * @see \Drupal\Core\TypedData\ListDefinitionInterface
./core/lib/Drupal/Core/TypedData/DataDefinitionInterface.php: * @see \Drupal\Core\TypedData\ListDefinitionInterface
./core/lib/Drupal/Core/TypedData/DataDefinitionInterface.php:   * \Drupal\Core\TypedData\ListDefinitionInterface interface
$ ls -lah core/lib/Drupal/Core/TypedData/ListDefinitionInterface.php
ls: core/lib/Drupal/Core/TypedData/ListDefinitionInterface.php: No such file or directory

Proposed resolution

In Drupal 11, there is no interface named \Drupal\Core\TypedData\ListDefinitionInterface. If you're looking for the interface that defines data definitions for lists, you should use \Drupal\Core\TypedData\ListDataDefinitionInterface instead.

Remaining tasks

Check the commit history to verify that the name change is correct.

Add user access checks to 'more' link

$
0
0

Problem/Motivation

when a custom URL under "Link display" is used for a given display, there is not anything in views to check user access to these links.

@dawehner suggested using the access system provided by the routing system.

this was discovered in #2020393-11: Convert "Recent content" block to a View, when a "More" link was being added.

Steps to reproduce

Instructions to reproduce the issue:

  1. Install fresh Drupal (standard profile)
  2. Go to /admin/structure/views/add, to add new view
    1. Name the view as "Admin only"
    2. Select "Create a page"
    3. Click "Save and edit"
    4. Under "Page Settings" choose a link after "Access: Permissions". By default it's "View published content".
    5. Choose "Administer blocks"
    6. Save the view
  3. Go to /admin/structure/views/add, to add new view.
    1. Name the view as "Public"
    2. Select "Create a block"
    3. Click "Save and edit"
    4. Under "Pager" choose link after "More link:". By default it's no.
    5. Select "Create more link" and "Always display the more link"
    6. Click "Apply"
    7. Under "Pager" choose link after "Link display:". By default it's "none".
    8. Select "Custom URL" and enter "admin-only" to the field
    9. Click "Apply"
    10. Save the view
  4. Go to /admin/structure/block
    1. Add the Public block to the sidebar
    2. Click "Save Block"
  5. Log out
  6. Go to the front page
  7. Link "more" is showing on a public block.

Proposed resolution

Check if user has access to the read more link.

Remaining tasks

Code review

User interface changes

NA

API changes

NA

Data model changes

NA

Release notes snippet

NA

Update to selenium/standalone-chrome:134

Add 'view' link to Node revisions overview "Operations" links

$
0
0

On the Node Revisions overview table, there is no link for the "View" operation in the "operations" dropdown button.
See screenshot:

Node revisions table

The "View" link for the revision is generated in the "Revision" column as MMDDYY - H:i which is not always obvious.

1) As we already have an Operations column with a list of links operations that can be done on a revision, and
2) as "viewing" a revision is fact an operation,
I think we might add the "View" link as the first one on the Operations dropdown menu.

I'm attaching here a really small patch to cover this request.

Screenshot after I've applied the supplied patch:

Revisions table with applied patch.

Views text area plugin does not declare a dependency on the text format it uses

Deprecation in Html::cleanCssIdentifier()

$
0
0

Problem/Motivation

Fuzzing reveals that Html::cleanCssIdentifier() triggers a deprecation when called with a malformed string:

   DEPRECATED  preg_replace(): Passing null to parameter #3 ($subject) of type array|string is deprecated in core/lib/Drupal/Component/Utility/Html.php on line 129.

Steps to reproduce

This can be reproduced with the attached file:

\Drupal\Component\Utility\Html::cleanCssIdentifier(file_get_contents('/var/www/crash-990e7227d1b261b58910c41def8090bb.txt'))

Proposed resolution

The code should probably check if $identifier is NULL before calling preg_replace.

Remaining tasks

User interface changes

Introduced terminology

API changes

Data model changes

Release notes snippet

Consider using the administration theme when editing or creating content by default

$
0
0

Problem/Motivation

Unless you're using the Standard profile, the default value of the Use the administration theme when editing or creating content option on the Appearance page is false, which means that node forms are rendered using the frontend theme. I feel like since the progress in the Admin UI and JavaScript Modernisation Initiative, the Claro theme set as default admin theme and the rise in popularity of Gin theme this is no longer a sensible default. Maybe I'm biased since I have never had to integrate admin forms with custom frontend themes, but is this still a thing nowadays?

Steps to reproduce

Set up a fresh Drupal installation with the Minimal install profile and visit the Appearance admin page. The option is turned off.

Proposed resolution

Turn on the Use the administration theme when editing or creating content by default for new installations.

Remaining tasks

Do it.

User interface changes

Node forms will be rendered in the admin theme by default.


LanguageFormatter is not used for nodes because it's still hard coded in NodeViewBuilder

$
0
0

Problem/Motivation

NodeViewBuilder hardcodes the display of the langcode field ignoring any formatter configuration. This is a barrier if you want to create new formatter such as:

  • Display name with native names
  • Add flag icons for languages
  • Display source language

Proposed resolution

Remove the hardcode langcode element in NodeViewBuilder and keep the wrapper for BC.

Remaining tasks

Review

User interface changes

The display of the language field will change a little, because the 'field-language-display' wrapper will be gone.

API changes

The 'field-language-display' wrapper will be gone. However, this fixes a potential issue with having multiple same ID's on the same page, e.g. on a node list.

Data model changes

None

Release notes snippet

Through the removal of the hardcoded display of the langcode field, are <a href="https://www.drupal.org/node/3325438">developers be able to provide new formatters</a>, so that sitebuilder can configure a different output.

-- Original report --

Any options that are selected for language field formatter are ignored and the language field is always displayed as plain text language name.

Steps to reproduce:

  1. Enable translations.
  2. Create translatable content type.
  3. Select language field to be displayed.
  4. Check formatter option "Link to the Content".
  5. Create new node.
  6. View the node and you'll see plain text language name instead of a link.

I have noticed this when I was writing custom field formatter for the language field. It's easy to see the problem once you try to change the output for the core's language field. For example try this formatter:

namespace Drupal\custom_formatter\Plugin\Field\FieldFormatter;

use Drupal\Core\Field\FieldItemInterface;
use Drupal\Core\Field\Plugin\Field\FieldFormatter\LanguageFormatter as BaseFormatter;

/**
 * Plugin implementation of the 'custom_formatter' formatter.
 *
 * @FieldFormatter(
 *   id = "language_custom_fomatter",
 *   label = @Translation("Language with flag"),
 *   field_types = {
 *     "language"
 *   }
 * )
 */
class LanguageCustomFormatter extends BaseFormatter {

  /**
   * {@inheritdoc}
   */
  protected function viewValue(FieldItemInterface $item) {
    $view = parent::viewValue($item);

    $view['#plain_text'] .= ' Test';

    return $view;
  }
}

The formatter itself is registered correctly, you can enable it for the language field. The settings form works fine, but the actual output of the formatter is totally ignored. For example instead of seeing "English Test" I always get "English".

Views keyword search bug when using node revisions

$
0
0

Problem/Motivation

An invalid query is produced on a node revisions view when adding a relationship to the actual content and adding an exposed filter on Search keywords

Steps to reproduce

Install the standard profile on Drupal 10.1.x
Import the attached views config (making sure to rename it to remove the underscore from views.view_
Visit admin/structure/views/view/test_revisions
Submit the filter in the view preview.

Proposed resolution

Original report

A view that is based on node revisions will create an incorrect query if a keyword search filter is included. I've attached the simplest of views from a new drupal 8.7 install to reproduce this. In trying to debug this on a client site I stepped through the search views plugin but it seems like the error in creating table aliases happens earlier which is why I assume the node module.

Here is a base query that works:

SELECT "node_field_revision"."vid" AS "vid", "node_field_data_node_field_revision"."nid" AS "node_field_data_node_field_revision_nid"
FROM
{node_field_revision} "node_field_revision"
LEFT JOIN {node_field_data} "node_field_data_node_field_revision" ON node_field_revision.nid = node_field_data_node_field_revision.nid AND node_field_data_node_field_revision.langcode = node_field_revision.langcode
WHERE "node_field_revision"."status" = '1'

Here's the query that throws an exception when adding a search word of "test":

SELECT SUM(node_field_data_node_field_revision_node_search_index.score * search_total.count) AS "score", MIN(node_field_revision.vid) AS "vid", MIN(node_field_data_node_field_revision.nid) AS "node_field_data_node_field_revision_nid"
FROM
{node_field_revision} "node_field_revision"
LEFT JOIN {node_field_data} "node_field_data_node_field_revision" ON node_field_revision.nid = node_field_data_node_field_revision.nid AND node_field_data_node_field_revision.langcode = node_field_revision.langcode
LEFT JOIN {search_index} "node_field_data_node_field_revision_node_search_index" ON node_field_data_node_field_revision.nid = node_field_data_node_field_revision_node_search_index.sid AND (node_search_index.type = 'node_search' AND node_search_index.langcode = node_field_data.langcode)
LEFT JOIN {search_total} "search_total" ON node_field_data_node_field_revision_node_search_index.word = search_total.word
WHERE ("node_field_revision"."status" = '1') AND (("node_field_data_node_field_revision_node_search_index"."type" = 'node_search') AND (""."data" LIKE '% test %' ESCAPE '\\') AND ("node_field_data_node_field_revision_node_search_index"."word" = 'test'))
GROUP BY "node_field_data_node_field_revision_node_search_index"."sid"
HAVING (COUNT(*) >= '1')

The '.data' in the third WHERE condition should get replaced by something like 'node_field_data_node_field_revision_node_search_dataset.data' but the search plugin never gets passed any table aliases to use for replacements. line 175 of core/modules/search/src/Plugin/views/filter/Search.php
$search_dataset = $this->query->addTable('node_search_dataset'); returns FALSE:

I was able to alter the query just for my view and that's basically what I had to do. I'm also hoping to figure out where this needs to be patched but I haven't figured that out myself yet.

Deprecate #type fieldgroup

$
0
0

Problem/Motivation

#type fieldgroup exists only to add a class and after #3512236: Move fieldgroup CSS to its own library a library.

The only place it's used in core is the installer site configure form. Field UI uses the fieldgroup class without using the #type (don't ask me why).

I think we can deprecate and remove this entirely.

Steps to reproduce

Proposed resolution

Remaining tasks

User interface changes

Introduced terminology

API changes

Data model changes

Release notes snippet

TypeError: array_filter(): Argument #1 ($array) must be of type array, null given in array_filter()

$
0
0

Problem/Motivation

Error message

TypeError: array_filter(): Argument #1 ($array) must be of type array, null given in array_filter() (line 723 of /app/web/core/modules/views/src/Plugin/views/field/EntityField.php).

Also, confirmed in Drupal 10.4 and Drupal 11.0.

Steps to reproduce

  • Add node
  • Create a view to display node ids with aggregation
  • Set aggregation settings of ID field in the view to COUNT
  • Save View
  • Change aggregation settings of ID field in the view to MAX results in AJAX error

Proposed resolution

TBA

Remaining tasks

NA

User interface changes

NA

Introduced terminology

NA

API changes

NA

Data model changes

NA

Release notes snippet

TBA

Block layout overflow issue and Incorrect style for all draggable table on mobile.

$
0
0

Problem/Motivation

Block layout overflow issue and Incorrect style for all draggable table on mobile.

Steps to reproduce

1. login as admin
2. use claro or olivero (issue in both)
3. goto => structure => block layout
4. switch to mobile device you will see contents are overflowing outside page from right.

Proposed resolution

the fix is to add overflow scroll to table wrapper

Remaining tasks

Need review and test

User interface changes

scroll added for table and align for text and buttons are also fixed

Release notes snippet

Drupal version 11

Viewing all 300222 articles
Browse latest View live


Latest Images