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

Deprecated function: explode(): Passing null to parameter #2 ($string) of type string is deprecated in Drupal\file\Plugin\Field\FieldFormatter\FileMediaFormatterBase::mimeTypeApplies() (line 171 of Plugin/Field/FieldFormatter/FileMediaFormatterBase.php)

$
0
0

Problem/Motivation

If the list of allowed file extensions for a file field includes an unknown file extension, such as "foobaz", an error will be logged when viewing the rendered file field: Deprecated function: explode(): Passing null to parameter #2 ($string) of type string is deprecated in Drupal\file\Plugin\Field\FieldFormatter\FileMediaFormatterBase::mimeTypeApplies() (line 171 of core/modules/file/src/Plugin/Field/FieldFormatter/FileMediaFormatterBase.php)

Steps to reproduce

I suspect the list of allowed file extensions is processed in order, so the unknown file extension needs to precede the file extension used by the rendered file field. For example, set the allowed file extensions for a file field to "foobaz, mp3" and then create an entity with an attached mp3 file. The error will be logged when rendering the entity.

Proposed resolution

Remaining tasks

User interface changes

Introduced terminology

API changes

Data model changes

Release notes snippet


Rename $op with BC usage in update.php

$
0
0

Problem/Motivation

Follow-up to #3353545-26: Rename $op to $operation arguments

The script /update.php using \Drupal\Core\Update\UpdateKernel::setupRequestMatch() to provide $op operation for \Drupal\system\Controller\DbUpdateController::handle()

Proposed resolution

- provide both $op and $operation in UpdateKernel::setupRequestMatch()
- rename \DbUpdateController::handle() the $op argument to $operation
- find a way to throw deprecation message when $op is send

Remaining tasks

- patch and change record
- review
- commit

User interface changes

API changes

Data model changes

Release notes snippet

Issue with HTML ` ` not being correctly filtered out

$
0
0

Problem/Motivation

Hey, After updating to Drupal 10.2.5, I've encountered an issue in one of my projects where our automated tests related to the HTML filter are failing. The problem arises with HTML content that includes a non-breaking space (` `) within a URL, which should not be part of the URL.

Steps to reproduce

In our content, we have a `p` element with a URL that includes a non-breaking space at the end:

    For details of the Last Post Service: https://www.shrine.org.au/last-post-service-31-july 

Current output:

  For details of the Last Post Service: https://www.shrine.org.au/last-post-service-31-july 

Expected output:

  For details of the Last Post Service: https://www.shrine.org.au/last-post-service-31-july 

Screenshot

Drupal 10.2.5

Image 1

issue

Drupal 10.1.7

Image 2

no issue, and it looks good.
issue

it also happens on the situation below

<h2>
    Another Heading 2
</h2>
<p>
    &nbsp;
</p>
<h3>
    Another Heading 3
</h3>

Drupal 10.2.5

Image 3

10.2.x

Drupal 10.1.7

Image 4

no issue, and it looks good.
10.1.x

Temporary workaround:
I managed to resolve this issue temporarily by adding the following line in core/lib/Drupal/Component/Utility/Html::serialize just before the return statement:
$html = html_entity_decode($html, ENT_QUOTES, 'UTF-8');

I am looking for guidance or confirmation on whether this is an issue with the recent updates and if there is a planned fix for future releases. Any suggestions on alternative solutions or patches would also be greatly appreciated.

Thank you!

Theme hook template path overriden if template matches existing theme hook

$
0
0

Problem/Motivation

I have a theme hook called ca_container which uses a twig template from outside of the theme called container.html.twig (our approach has been to put templates alongside their component in our design system). However, at render time, the theme registry swaps out my custom path with the path to stable9's container.html.twig.

Here's what my theme hook looks like (using Pinto so this gets autogenerated via various traits)

Original theme hook

When debugging into ThemeManager::render, I can see that when it calls $info = $theme_registry->get($hook); it's returning the path to the stable9 template

Theme manager debug

I'm not sure if this is expected, or a bug. Obviously we can just change the template name and be happy but it'd be nice to have this working.

Steps to reproduce

See above.

Proposed resolution

Remaining tasks

User interface changes

Introduced terminology

API changes

Data model changes

Release notes snippet

admin/content/files is slow with many files

$
0
0

Problem/Motivation

admin/content/files is very slow for us on a site that has lots of files.

mysql> explain SELECT file_managed.filename AS file_managed_filename, file_managed.created AS file_managed_created, file_managed.changed AS file_managed_changed, file_managed.fid AS fid, SUM(file_usage_file_managed.count) AS file_usage_file_managed_count, MIN(file_managed.fid) AS fid_1
    -> FROM 
    -> file_managed file_managed
    -> LEFT JOIN file_usage file_usage_file_managed ON file_managed.fid = file_usage_file_managed.fid
    -> GROUP BY file_managed_filename, file_managed_created, file_managed_changed, file_managed.fid
    -> ORDER BY file_managed_created DESC
    -> LIMIT 51 OFFSET 0;
+----+-------------+-------------------------+------+------------------------------+---------+---------+-----------------------------+--------+---------------------------------+
| id | select_type | table                   | type | possible_keys                | key     | key_len | ref                         | rows   | Extra                           |
+----+-------------+-------------------------+------+------------------------------+---------+---------+-----------------------------+--------+---------------------------------+
|  1 | SIMPLE      | file_managed            | ALL  | NULL                         | NULL    | NULL    | NULL                        | 184075 | Using temporary; Using filesort |
|  1 | SIMPLE      | file_usage_file_managed | ref  | PRIMARY,fid_count,fid_module | PRIMARY | 4       | file_managed.fid |      1 | NULL                            |
+----+-------------+-------------------------+------+------------------------------+---------+---------+-----------------------------+--------+---------------------------------+

mysql>  SELECT /* sql_no_cache */ file_managed.filename AS file_managed_filename, file_managed.type AS file_managed_type, file_managed.created AS file_managed_created, file_managed.changed AS file_managed_changed, file_managed.fid AS fid, SUM(file_usage_file_managed.count) AS file_usage_file_managed_count, MIN(file_managed.fid) AS fid_1 FROM  file_managed file_managed LEFT JOIN file_usage file_usage_file_managed ON file_managed.fid = file_usage_file_managed.fid GROUP BY file_managed_filename, file_managed_type, file_managed_created, file_managed_changed, file_managed.fid ORDER BY file_managed_created DESC LIMIT 51 OFFSET 0;
...
51 rows in set (2.77 sec)

I thought it could be the order by on created which doesn't have an index, but changing to changed, which has doesn't change anything.

Proposed resolution

I guess it's join to the file usage table and then the optimization gets confused. IIRC, we had a similar problem with authors on admin/content that now loads the users separately. I think we should do the same with file usage. Stop trying to load the info but have a custom field plugin that just uses the file usage API to load that information for the files that are being displayed.

There is no API to get that information for multiple files, so we either have to live with doing 50 fast queries or querying the table directly (or extending the API). Since we already join the table directly, doing a direct query won't be a regression in terms of DB abstraction..

Without the SUM and LEFT join, the query is 0.06s instead of 2.7 even on created, with changed it's obviously 0.00. so not a big issue anymore. Explain:

mysql> explain SELECT file_managed.filename AS file_managed_filename, file_managed.created AS file_managed_created, file_managed.changed AS file_managed_changed, file_managed.fid AS fid FROM  file_managed file_managed ORDER BY file_managed_created DESC LIMIT 51 OFFSET 0;
+----+-------------+--------------+------+---------------+------+---------+------+--------+----------------+
| id | select_type | table        | type | possible_keys | key  | key_len | ref  | rows   | Extra          |
+----+-------------+--------------+------+---------------+------+---------+------+--------+----------------+
|  1 | SIMPLE      | file_managed | ALL  | NULL          | NULL | NULL    | NULL | 184075 | Using filesort |
+----+-------------+--------------+------+---------------+------+---------+------+--------+----------------+

mysql> explain SELECT file_managed.filename AS file_managed_filename, file_managed.created AS file_managed_created, file_managed.changed AS file_managed_changed, file_managed.fid AS fid FROM  file_managed file_managed ORDER BY file_managed_changed DESC LIMIT 51 OFFSET 0;
+----+-------------+--------------+-------+---------------+---------------------+---------+------+------+-------+
| id | select_type | table        | type  | possible_keys | key                 | key_len | ref  | rows | Extra |
+----+-------------+--------------+-------+---------------+---------------------+---------+------+------+-------+
|  1 | SIMPLE      | file_managed | index | NULL          | file_field__changed | 4       | NULL |   51 | NULL  |
+----+-------------+--------------+-------+---------------+---------------------+---------+------+------+-------+
1 row in set (0.00 sec)

Remaining tasks

User interface changes

API changes

Data model changes

field_purge_batch() should be in core components, not in field module

$
0
0

field_purge_batch() takes care of deleting Field API tables that have been renamed for batch deletion. But it's in Field module, which is optional.

However, code-defined fields can have dedicated tables: multi-valued entity base fields, and bundle fields, for instance.

These fields can exist even if Field module isn't enabled.

Therefore, it looks to me like in that case, the field tables would never get cleaned up.

Views incorrect display with filters, table and full pager

$
0
0

Changes from 3365367 in views.css for .view-content breaks views with filters, table and full pager, example on the screehshot
To reproduce create view with few pages, full pager(not reproducing with mini) and filter

Radio buttons are not center-aligned with labels in layout builder.

$
0
0

Problem/Motivation

While during the alignment of the image inserted through layout builder in the custom block, radio buttons are not center-aligned with labels.

Steps to reproduce

1. Home>Administration>Structure>Content types>Article,under layout options check layout builder.
2. Go to the article node, click on layout.
3. Add block, create a custom block.
4. Add content: title, body, and in the body add an image.
5. While inserting an image, you will be asked for its alignment by clicking radion buttons.

Please refer to the screenshot attached for reference.

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet


New throbber SVG images are lack of xmlns attribute

$
0
0

Problem/Motivation

According to MDN document, SVG requires xmlns attribute in outermost svg element. But current throbber SVG images has no xmlns attribute.

Steps to reproduce

Access to /core/misc/feed.svg using a web browser, this svg file is recognized as a SVG image. But access to /core/misc/throbber-active.svg, this svg file is recognized as a normal XML document.

The feed.svg is shown as an image file.

The throbber-inactive.svg is shown as a xml file.

Proposed resolution

Add xmlns attribute in the root svg element.

Remaining tasks

User interface changes

No.

API changes

No.

Data model changes

No.

DatabaseStorage, readMultiple throws error when receive empty array

$
0
0

Problem/Motivation

SQLSTATE[42000]: Syntax error or access violation: 1064 is triggered when we pass empty array with name to readMultiple method, when trying to get information about setting.

I hit a case where I pass empty array to this method and SQL error is thrown.

Drupal\Core\Database\DatabaseExceptionWrapper: SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ')' at line 1: SELECT "name", "data" FROM "config" WHERE "collection" = :collection AND "name" IN ( ); Array ( [:collection] => ) in Drupal\Core\Config\DatabaseStorage->readMultiple() (line 115 of core/lib/Drupal/Core/Config/DatabaseStorage.php).

Steps to reproduce

Inject config.storage.active into a class (as it is not public you should not be able to use \Drupal::service('config.storage.active')
Call $active_storage->readMultiple([]);

Proposed resolution

First check if the value is not empty, otherwise return empty array.

Remaining tasks

Review

"Contains" filter doesn't know whether the content field contains HTML-escaped strings so you can't reliably include characters like ampersands in searches

$
0
0

Problem/Motivation

In Drupal 10.2.4, Views, added "Full Html" field (body field) as exposed filter in the filter criteria.
While search term has "&" symbol, not getting the results.
Example: "jack & jill went up to the hill".

I will not get the results if I'm searching as "jack & jill", but if I type only "jack &", I will get the results.

Steps to reproduce

Step 1: Install Drupal 10.2.4

Step 2: Add some contents for "Article" content type, and in the body field, add some text with "&" symbol.

Step 3: Create a view with page.

i) Format: Fields

ii) Fields: Title and Body fields added.

iii) Filter criteria:

        Published = yes
        Content type ="Article"
        Add "Body" field and expose it. Operator selected as "contains".

iv) Apply and save the view.

Proposed resolution

I need to get the results when I type sometext with "&" symbol also.

FileOnTranslatedEntityTest should use API to set up language

$
0
0

Problem/Motivation

FileOnTranslatedEntityTest uses form submissions to change language settings.

This is expensive, and not what the test is covering.

Steps to reproduce

Proposed resolution

Change to API calls.

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet

Allow cardinality to be restricted (overriden and reduced) in the field instance settings

$
0
0

Modules can alter a widget and some of its settings via hook_field_widget_properties_alter.

Some settings though are in field instance settings and can not be altered right now. Examples:
* maximum number of values (note: don't get this wrong, this is not about field schema cardinality)
* widget type for widgets like og_complex that do kinda chaining

Simply passing settings by reference in $context allows modules to alter these.

(D8 killed that hook per pluginification)

Original summary

Original title: Allow cardinality to be restricted (overriden and reduced) in the field instance settings

It is Impossible to override the field cardinality for a specific instance even when set to unlimited. When a field's cardinality is set to unlimited it shouldn't be a problem when it is overridden to a fixed number for a specific instance.

This functionality would be very handy. An example would be the audience field of the Organic groups module; you can't limit the number of groups for one entity type while keeping it unlimited for another.

Or when using for example views you might want to list nodes of several types including a icon. It would be handy if you could use the same field. But what if you want to limit the number of images for the one node type while allowing multiple images for another.

Unfortunately getting this to work is impossible. There are no suitable hooks (I found one way, but that one is very very hacky).

Of course it would be possible for the field defining module to include a instance setting to limit the cardinality. Also a wrapper widget would be possible, except it might give unexpected results for widgets that handle multiple values themselves.

My request is to provide the possibility to limit the cardinality for field instances (when the field cardinality is set to unlimited) for any field type.

Fix some spelling words in test

$
0
0

Problem/Motivation

More words that only appear in tests.

Steps to reproduce

Proposed resolution

Remaining tasks

User interface changes

Introduced terminology

API changes

Data model changes

Release notes snippet

Incorrect behaviour for block page visibility

$
0
0

Problem/Motivation

When leaving the "listed pages" text area empty in "Pages" block visibility, the options "Show for the listed pages" and "Hide for the listed pages" do the exact opposite of what they claim, they work as though there was an entry * in the list, i.e.:

  • Show for the listed pages will result in the block showing on all pages when the list is empty
  • Hide for the listed pages will result in the block showing nowhere when the list is empty

For an empty list, "Show on the listed pages" should not show the block anywhere. And, "Hide on the listed pages", should have the block show up on every page, when the list is empty.

Proposed resolution

Add a new radio button option for "Show on all pages", select this by default, hide the text area when this is selected, then validate that the box is not empty if either of the other two options are selected. See #19

One consideration is that the default currently causes the block to show everywhere, which in itself is probably a good default. It's just that it is being achieved by combining "Show on the listed pages" with an empty list, which at least caused me to select "Hide on the listed pages", expecting that to result in the block showing everywhere.

Another consideration is to ensure that the descriptive test (Not Restricted/Restricted to certain pages) in the Pages tab is correct.

Remaining tasks

  1. Decide on resolution
  2. Implement resolution
  3. code review
  4. add change record - suitable for a novice. There are instructions for adding a change record.

User interface changes

Before

After

API changes

None.


No matter what I do, I can't swap the class of the SDC plugin

$
0
0

Problem/Motivation

In a 3rd-party I want to swap the SDC plugin class, which currently is src/Plugin/Component.

  • As we use to do that in Drupal, I first looked for something like `hook_SOMETHING_info_alter()`. But the SDC plugin manager says:
    // Note that we are intentionally skipping $this->alterInfo('sdc_info');
    // We want to ensure that everything related to a component is in the
    // single directory. If the alteration of a component is necessary,
    // component replacement is the preferred tool for that.
    

    and doesn't provide such a hook

  • No problem, I said. I will swap the plugin manager class, using a *ServiceProvider magic class, and I will add my own class in `DefaultPluginManager::$defaults`.
  • No way, the `ComponentPluginManager` plugin manager class is final.
  • Then I went with decorating. I've intercepted the definition in MyPluginManagerClass::processDefinition() and changed the class. It works.
  • But now it crashes in `\Drupal\sdc\Twig\TwigComponentLoader::__construct()` because the plugin manager, passed as 1st argument, is strict-typed to `\Drupal\sdc\ComponentPluginManager`, so I can't pass the custom class that swapped SDC plugin manager.

Trying to extend SDC in any direction seems quite impossible, not only when to comes to my scope. The whole module seems so hermetic.

This is also helpful for cl_editorial as would help to switch from form alters to plugin forms:

  • Swap the Component plugin class with one that extend Component but also implements PluginFormInterface
  • Implement PluginFormInterface::buildConfigurationForm() and inside, use ComponentInputToForm to build/return the form
  • Then, with a SDC plugin instance say $component_plugin, you can easily get the component form: $component_plugin->buildConfigurationForm() instead of form alters

Steps to reproduce

See "Problem/Motivation"

Proposed resolution

  • Allow to alter plugin definitions, as we allow in any Drupal plugin type.
  • Remove "final" from plugin & plugin manager classes.
  • Create a `ComponentInterface` so that we can properly strict-typing parameters, class properties and variables.
  • Revisit strict-typing of parameters and and sure they're using the interface, not specific class

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet

Ajax calls broken Intermitently in Drupal 10

$
0
0

Problem/Motivation

I am working on Drupal 10 site. On servers, intermittently ajax calls gets break and page redirects on ajax calls.
When i am clearing Drupal cache, it started working again.
Can someone please help me?

Steps to reproduce

Proposed resolution

Remaining tasks

User interface changes

Introduced terminology

API changes

Data model changes

Release notes snippet

ModuleConfigureRouteTest is slow

$
0
0

Problem/Motivation

This single kernel test takes 165s, if we use a foreach instead of a data provider we can cut it down to about 10.

Steps to reproduce

Proposed resolution

Remaining tasks

User interface changes

Introduced terminology

API changes

Data model changes

Release notes snippet

ConfigFactoryOverrideInterface::loadOverrides not invoked after content type creation in Drupal 10.3.0+

$
0
0

Problem/Motivation

In our Drupal site, we are extending ConfigFactoryOverrideInterface and overriding the loadOverrides function to assign permissions to a user role dynamically. This functionality works as expected in Drupal version 10.2.7. However, starting from Drupal version 10.3.0, the loadOverrides method is no longer invoked after creating a new content type, which causes our dynamic permission assignment to fail.

Steps to reproduce

Implement ConfigFactoryOverrideInterface and override the loadOverrides function to assign permissions to a user role dynamically.
Create a new content type, e.g., 'test_content'.

Observe that in Drupal 10.2.7, the loadOverrides method is invoked, and permissions are assigned correctly.
Upgrade to Drupal 10.3.0 or later.
Create the same content type 'test_content'.
Observe that the loadOverrides method is not invoked, and permissions are not assigned.

Starting from Drupal 10.3.0, the loadOverrides method is not invoked after creating a new content type, causing dynamic permission assignments to fail.

Code snippets demonstrating the ConfigFactoryOverrideInterface implementation.

 class PermissionOverrides implements ConfigFactoryOverrideInterface {

/**
  * {@inheritdoc}
  */
public function loadOverrides($names) {
  $overrides = [];
  $role = 'user.role.test_role';
  if (in_array($role, $names)) {
    $types = $this->entityTypeManager()->getStorage('node_type')->loadMultiple();
    foreach ($types as $type) {
      $permission = 'Test permission ' . $type->id();
      $overrides[$role]['permissions'][$permission] = $permission;
    }
  }

  return $overrides;
}

/**
 * @return string
 */
public function getCacheSuffix() {
  return static::class;
}

/**
 * @param string $name
 *
 * @return \Drupal\Core\Cache\CacheableMetadata
 */
public function getCacheableMetadata($name) {
  return new CacheableMetadata();
}

/**
 * @param mixed $name
 * @param string $collection
 *
 * @return \Drupal\Core\Config\StorableConfigBase|null
 */
public function createConfigObject($name, $collection = StorageInterface::DEFAULT_COLLECTION) {
  return NULL;
}

}

Code snippets for Content type creation.

$this->drupalCreateContentType(['type' => 'test_content', 'name' => 'test_content']);

Proposed resolution

The loadOverrides method should be invoked after creating a new content type, as it does in Drupal 10.2.7, to ensure dynamic permission assignments work correctly.

Integrate the Tour module into the Navigation

$
0
0

Problem/Motivation

Navigation module does not have a capability to integrate the Tour module.

Steps to reproduce

Proposed resolution

Remaining tasks

User interface changes

Introduced terminology

API changes

Data model changes

Release notes snippet

Viewing all 298251 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>