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

Replace substr($a, 0, $i) with str_starts_with()

$
0
0

Problem/Motivation

Part of #3324560: Replace strpos/substr with PHP 8's str_starts_with() / str_contains() / str_ends_with().

Proposed resolution

  1. Replace most substr($a, 0, $i) == $b with str_starts_with($b).
  2. A few are deliberately omitted where they would cause merge conflicts with other child issues.

Remaining tasks

  • When reviewing, consider using git diff --color-words or git diff --porecelain.
  • Pay attention to the fact that $i should be the length of $b.

User interface changes

N/A

API changes

N/A

Data model changes

N/A

Release notes snippet

N/A


Avoid warning from imagecreatefrompng when loading png with obscure iCCP profiles

$
0
0

Problem/Motivation

When a PNG (and some other rarely used formats) image contains iCCP chunk with sRGB IEC61966-2.1 color profile, libpng triggers warning:

Warning: imagecreatefrompng(): gd-png: libpng warning: iCCP: known incorrect sRGB profile in Drupal\system\Plugin\ImageToolkit\GDToolkit->load() (line 201 of core/modules/system/src/Plugin/ImageToolkit/GDToolkit.php).

This warning is printed for any such image, but they're still valid and displayed correctly.

Steps to reproduce

You need an image with iCCP chunk in it and sRGB IEC61966-2.1 color profile. You can achieve this in several ways.

You can find this color profile in attachments for that issue — sRGB IEC61966-2.1.zip. Extract it first to get .icc profile.

For examples, I will use core/tests/fixtures/files/image-test.png. It will be called image-test.png in commands below without full path.

ImageMagick CLI (convert)

Assuming that color profile (.icc) and image (image-test.png) in the same folder.

  1. convert image-test.png -profile sRGB\ IEC61966-2.1.icc -strip -profile sRGB\ IEC61966-2.1.icc -define png:include-chunk=zTXt,iCCP image-1-icpp.png
  2. Upload this image into Drupal and try to process it by any image style.

GIMP (OpenSource image editor)

  1. Open image-test.png in GIMP.
  2. Go to Image | Color Management | Assign Color Profile…
  3. In Assign section in select element chose Select color profile from disk…
  4. Select downloaded .icc profile.
  5. Click Assign.
  6. Save the image by File | Save as chose name and path and click Export. In open modal window, make sure you have checked Save color profile, and then again Export.
  7. Upload this image into Drupal and try to process it by any image style.

Proposed resolution

Add @ symbol before calling imagecreatefrompng() to suppress this warning.

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet

Improve NotBlank DX in config (schema) validation

$
0
0

Problem/Motivation

Surfaced at #3397493: Add validation constraints to block_content.type.*, specifically at https://git.drupalcode.org/project/drupal/-/merge_requests/5170/diffs#no...

#3404061: When setting `NotNull` constraint on type: required_label, two validation errors appear improved the DX for using NotBlank in the "required value" case.

But turns out that in the "optional value" case, we can improve it too!

Steps to reproduce

Proposed resolution

Always set $constraints['NotBlank']['allowNull'] = TRUE; because:

  1. when it is required (i.e. nullable: false, which is the default), null will trigger the NotNull constraint, and NotBlank should not generate an equivalent message again
  2. when it is optional (i.e. nullable: true, which must be explicitly specified), then null is a valid value and NotBlank should not complain

Remaining tasks

User interface changes

None.

API changes

None.

Data model changes

None.

Release notes snippet

None.

Replace deprecated functions in Nightwatch tests

$
0
0

Problem/Motivation

In order to make the jump to the next major version of Nightwatch as painless as possible (hah!), let's replace the deprecated functions in this issue before attempting to make the jump.

Steps to reproduce

The output of the GitLab CI Nightwatch job currently tells us that they are present with a cheery This command has been deprecated and is removed from the W3C Webdriver standard.

Proposed resolution

Deprecated command keys()

Replace the keys() command with an extended Selenium user actions API command.

Before:

.keys(some.key)

After:

.perform(function () {
  return this.actions().sendKeys(some.key);
})

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet

Remove calls to Request::hasSession()

Support Yaml::PARSE_CUSTOM_TAGS in \Drupal\Component\Serial::decodeization\YamlSymfony::

$
0
0

Problem/Motivation

Symfony 3.4 provides a shortcut to inject all services tagged with a specific tag, which is a common need in some applications, so you don't have to write a compiler pass just for that.

However, when you use a tagged argument the YAML decoder needs to support 'custom tags'.
Which at the moment is not supported in Drupal.

There is more that can be done with custom tags since Symfony 3.3. to mention a few, here are some of the custom tags that are already supported by Symfony YAML component.

!!binary for storing binary data
!php/const: for referring to PHP constants.
It already supports also defining your own custom YAML tags (Custom tags are arbitrary strings that start with the ! character, such as the !my_tag value).
The above can only be possible if the Yaml::PARSE_CUSTOM_TAGS flag is supported in Drupal.

Proposed resolution

Update Drupal\Component\Serialization\YamlSymfony::decode and pass in the flag 'SymfonyYaml::PARSE_CUSTOM_TAGS'

Remaining tasks

User interface changes

None

API changes

No change.

Data model changes

None

Translated media loses file if you set mapping from the file to the name

$
0
0

Problem/Motivation

In some circumstances you can lose translated media files.
It seems to be tied to the mapping set up in the media type.

Steps to reproduce

I created a new install on simplytest.me to reproduce this.

  1. Enable Media
  2. Enable Content translation
  3. Enable Language
  4. Go to admin/config/regional/language
  5. Add spanish
  6. Go to admin/structure/media/add
  7. Create name document library
  8. Set source to file
  9. Save the new media type
  10. edit the new media type and
  11. Set field mapping name to file ( This seems to be where the issue lies)
  12. Save again
  13. Go to admin/config/regional/content-language
  14. Check media
  15. Check document library
  16. Leave only name and file checked
  17. Save
  18. Go to /media/add/document_library
  19. Add a media item
  20. name something like test en
  21. Add file
  22. save
  23. Click add translation for the media entity you just created
  24. Remove the file
  25. Add new file and upload
  26. Hit save
  27. Edit the translation again, the file is missing

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet

Ajax view is not updating due to JQuery dependent once function usage

$
0
0

Problem/Motivation

Core module views have ajax_view.js which has function which used to refresh view to set defined values. which is used my other modules to develop functionality.

I had seen issue with views_infinite_scroll due to this and in return breaking functionality. Because what thing is required from view is returning undefined as not refreshing view and it's value.

Inside the console i can see the error:
Uncaught TypeError: $(...).once is not a function

Proposed resolution

What is there:

this.$view.once('ajax-refresh').each(function () {
      _this.refreshViewAjax = Drupal.ajax(selfSettings);
    });

What actually required:

once('ajax-refresh',this.$view).forEach(function () {
      _this.refreshViewAjax = Drupal.ajax(selfSettings);
    });

After doing these changes it's fixed and views getting updated as expected.


Add validation constraints to block_content.type.*

$
0
0

Problem/Motivation

Date formats have 1 property paths that are not yet validatable:

./vendor/bin/drush config:inspect --filter-keys=block_content.type.banner_block --detail --list-constraints --fields=key,validatability,constraints
➜  🤖 Analyzing…

 ------------------------------------------------------------ ------------- --------------------------------------------------------------------------------------------- 
  Key                                                          Validatable   Validation constraints                                                                       
 ------------------------------------------------------------ ------------- --------------------------------------------------------------------------------------------- 
  block_content.type.banner_block                              91%           ValidKeys: '<infer>'                                                                         
   block_content.type.banner_block:                            Validatable   ValidKeys: '<infer>'                                                                         
   block_content.type.banner_block:_core                       Validatable   ValidKeys:                                                                                   
                                                                               - default_config_hash                                                                      
   block_content.type.banner_block:_core.default_config_hash   Validatable   NotNull: {  }                                                                                
                                                                             Regex: '/^[a-zA-Z0-9\-_]+$/'                                                                 
                                                                             Length: 43                                                                                   
                                                                             ↣ PrimitiveType: {  }                                                                        
   block_content.type.banner_block:dependencies                Validatable   ValidKeys: '<infer>'                                                                         
   block_content.type.banner_block:description                 Validatable   Regex:                                                                                       
                                                                               pattern: '/([^\PC\x09\x0a\x0d])/u'                                                         
                                                                               match: false                                                                               
                                                                               message: 'Text is not allowed to contain control characters, only visible characters.'↣ PrimitiveType: {  }                                                                        
   block_content.type.banner_block:id                          Validatable   Regex:                                                                                       
                                                                               pattern: '/^[a-z0-9_]+$/'                                                                  
                                                                               message: 'The %value machine name is not valid.'                                           
                                                                             Length:                                                                                      
                                                                               max: 166                                                                                   
                                                                             ↣ PrimitiveType: {  }                                                                        
   block_content.type.banner_block:label                       Validatable   Regex:                                                                                       
                                                                               pattern: '/([^\PC])/u'                                                                     
                                                                               match: false                                                                               
                                                                               message: 'Labels are not allowed to span multiple lines or contain control characters.'    
                                                                             NotBlank: {  }                                                                               
                                                                             ↣ PrimitiveType: {  }                                                                        
   block_content.type.banner_block:langcode                    Validatable   NotNull: {  }                                                                                
                                                                             Choice:                                                                                      
                                                                               callback: 'Drupal\Core\TypedData\Plugin\DataType\LanguageReference::getAllValidLangcodes'↣ PrimitiveType: {  }                                                                        
   block_content.type.banner_block:revision                    NOT           ⚠️  @todo Add validation constraints to config entity type: block_content.type.*             
   block_content.type.banner_block:status                      Validatable   ↣ PrimitiveType: {  }                                                                        
   block_content.type.banner_block:uuid                        Validatable   Uuid: {  }                                                                                   
                                                                             ↣ PrimitiveType: {  }                     

On my local umami install, they are also with 4 in the top 10 of config objects the closest to 100% validatability. (See ./vendor/bin/drush config:inspect --todo=50)

Steps to reproduce

  1. Get a local git clone of Drupal core 11.x.
  2. composer require drupal/config_inspector— or manually install https://www.drupal.org/project/config_inspector/releases/2.1.5 or newer (which supports Drupal 11!)
  3. composer require drush/drush
  4. vendor/bin/drush config:inspect --filter-keys=block_content.type.banner_block --detail --list-constraints

Proposed resolution

Add validation constraints to:

  1. block_content.type.*:revision

This requires looking at the existing code and admin UI (if any) to understand which values could be considered valid. Eventually this needs to be reviewed by the relevant subsystem maintainer.

For examples, search *.schema.yml files for the string constraints:😊

Reach out to @borisson_ or @wimleers in the #distributions-and-recipes.

Remaining tasks

  1. block_content.type.*:revision

User interface changes

None.

API changes

None.

Data model changes

More validation 🚀

Release notes snippet

None.

Video media needs playsinline option

$
0
0

Problem/Motivation

Currently there is no way to add the playsinline attribute on <video> elements being output by the new Drupal code Media module. The playsinline attribute is required for background video to work on iOS devices. (Note: a similar to the same issue filed on the file_entity project a few years ago – this one is specifically a reference to the core Drupal media entity and file formatter.)

Proposed resolution

New checkbox should be added to the display options "plays inline".

Remaining tasks

Need an update hook and an ENTITY_TYPE_presave hook to ensure exported configuration stays in sync with the addition of the new property. See #43

User interface changes

Adds a new checkbox to the "Manage display" options for the media video type.
Screenshot of the new checkboxes

API changes

n/a

Data model changes

Adds playsinline to the media video schema.

Release notes snippet

Original report by chris_wearebraid

It would be excellent to add a playsinline option to media elements

Modules uninstall filter does not filter by machine name

$
0
0

Problem/Motivation

When you visit /admin/modules/uninstall and search for a module machine_name, you will not find a result. The problem gets really visible, when you use modules where the module's machine_name differs from the human-readable name.

Examples in Core and Contrib:

  • Database Logging (dblog)
  • Chaos tools (ctools)

Especially in contrib we see more such examples, where also the module project page presents another name, as the human-readable name (see Chaos tool suite, Configuration Update Manager).

Those inconsistencies let developers (when not using drush) to filter the module list by the module's machine_name. That is working fine at the module list, because the machine_name is part of the description, but not on the uninstall page).

Steps to reproduce the problem

Different behavior between the module list and uninstall module page.

Module list

  1. Go to /admin/modules
  2. Filter for dblog
  3. You'll see the "Database Logging" module

Uninstall module

  1. Go to /admin/modules/uninstall
  2. Filter for "dblog"
  3. You'll see no results

Proposed resolution

Make the filter by module machine_name working in the table at /admin/modules/uninstall.

Tasks

  • Decide, if it is a bug/feature request and/or should be fixed
  • DONE. Going to add machine name into a new details element. Decide, if we should
    • NO. Show the module machine_name in the description column, or in it's own column.. Rejected because it takes up too much page space.
    • NO. or include it visibility-hidden (if it would be allowed UX-wise) to only make it searchable. Presenting content to screen reader users but not to sighted users isn't inclusive design, rejected on accessibility grounds.
    • YES. Convert the description into a openable details element and add the machine name into it.
  • Update the system-modules-uninstall.html.twig template.
    • DONE. Add module machine name to template variables via preprocess hook.
    • DONE. Document the machine name variable in template docblock.
    • DONE. Convert description to a details element.
    • DONE. Add details machine name column to the new details element.
    • DONE. Add the show-all-columns feature. {{ attach_library('core/drupal.tableresponsive') }} in the form.
    • DONE. Make the description column responsive, by adding priority-low to match the install page.
    • DONE. Copy the template to Claro and adjust css classes to align with Claro install template.
    • DONE. Expand the javascript test to use the Claro theme in addition to the default, to test filtering on the new template.

User interface changes

Introduces a new machine name table column on the modules uninstall page. The machine name becomes searchable in the filter.
Make the uninstall table responsive, because the install page is already responsive.

Before

before

After - original solution

after - original

After - final solution

after - new

API changes

None

Data model changes

None

Create an interface and initial class for the batch processor service

$
0
0

Problem/Motivation

There are times when the functionality to for the processing of batches is required to be swapped out.

Proposed resolution

Create an interface and class for the processing of batches and add it as a service.

The current functionality is not to be changed at this stage. The default batch processor service class will call the existing functions. Further issues will be created to migrate the functionality to the service class at a later stage. See #2875151.

User interface changes

None.

API changes

A service is to be introduced for processing of batches.

Data model changes

None.

Fix PostgeSQL column name escaping in field constraints

$
0
0

Problem/Motivation

The field name for the column that has the great than zero check is not quoted.

Steps to reproduce

Create a custom entity type with entity reference field named "order".
Try to install it.
The following error will be thrown.

Exception thrown while performing a schema update. SQLSTATE[42601]: Syntax error: 7 ERROR: syntax error at or near "order"
LINE 5: "order" bigint CHECK (order >= 0) NULL,

Proposed resolution

Add the quotes to the field name.

Remaining tasks

None

User interface changes

None

API changes

None

Data model changes

None

Release notes snippet

TBD

Cannot read properties of null (reading 'nodeType') on node.page.body

$
0
0

Problem/Motivation

On /admin/structure/types/manage/page/fields/node.page.body page we're getting Uncaught TypeError: Cannot read properties of null (reading 'nodeType') error in console.

Steps to reproduce

Go to /admin/structure/types/manage/page/fields/node.page.body
check the console, you will see the error - Uncaught TypeError: Cannot read properties of null (reading 'nodeType')

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet

Improve vertical tabs in forced colors mode

$
0
0

Problem/Motivation

Vertical tabs are not working optimally in forced colors mode. See videos for reference: https://youtu.be/6j0Z62R2bEA and https://youtu.be/VtWjPn5p5-w.

Steps to reproduce

  1. Install drupal 11.x-dev.
  2. Navigate to the vertical tabs.
  3. Added custom block and the palce in any region.
  4. At the bottom of left side, See the visibility of vertically tabs.

Proposed resolution

-Apply appropriate border colour on active tab.
tab


Fix the deprecation URL for #3356894 and #3372097

$
0
0

Problem/Motivation

The CRs of #3356894: Make field selection less overwhelming by introducing groups and #3372097: Consider replacing hook_field_type_category_info with YML based plugin discovery were merged into because they are sequential changes of the same feature an someone trying to understand what has been changes should reconstruct the development process as both issues were delivered in 10.2.

So, one CR (https://www.drupal.org/node/3364271) has been deleted and the other contains both changes. But the https://www.drupal.org/node/3364271 is now 404

Steps to reproduce

Go to https://www.drupal.org/node/3364271 (which is the URL from the deprecation message)

Proposed resolution

Fix the deprecation message

Remaining tasks

None.

User interface changes

None.

API changes

None.

Data model changes

None.

Release notes snippet

None.

Incorrect typehint of LOGGED_IN and LOGGED_OUT consts in UserAuthenticationController

$
0
0

Problem/Motivation

The @var annotation of UserAuthenticationController::LOGGED_IN and UserAuthenticationController::LOGGED_OUT suggest these constants are strings when they are in fact ints.

Steps to reproduce

Proposed resolution

Fix annotation

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet

Insert Image icon is not showing in full html format

$
0
0
  1. Go to "/admin/config/content/formats/manage/full_html"
  2. Check Insert image icon is empty in the toolbar

Do not allow to save view with external Url in path (from page display)

$
0
0

Problem/Motivation

The current version of view allow users to set a external url in page path (which makes no sense). However, when users do that, the site breaks and throws the following error.

InvalidArgumentException: The internal path component 'https://example.com' is external. You are not allowed to specify an external URL together with internal:/. in Drupal\Core\Url::fromInternalUri() (line 422 of /var/www/html/core/lib/Drupal/Core/Url.php).

Steps to reproduce

  1. Go to /admin/structure/views and create a view with page display
  2. Add external Url (for eg: https://example.com/) in the path field in Page settings of the view and then Save the view
  3. Go back to /admin/structure/views page and you'll see the error

Proposed resolution

Add validation and throw error when user tries to add external url in view page field.

      if (UrlHelper::isExternal($uri_parts['path'])) {
        throw new \InvalidArgumentException("The internal path component '{$uri_parts['path']}' is external. You are not allowed to specify an external URL together with internal:/.");
      }

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet

Password reset form error makes no sense when the account is locked

$
0
0

Problem/Motivation

When the same mailbox requests to recover the password 5 times, it will prompt Password reset form was submitted with an unknown or inactive account: test@drupal.com.. But the user is actually locked. This problem needs to be debugged to find out, and will not directly prompt the user to be locked

Steps to reproduce

  1. install new drupal 9 latest
  2. login and goto /admin/people/create create user, username and email is test@drupal.com and set active
  3. logout and go to /user/password enter email test@drupal.com 5 times
  4. will now prompt: If test@drupal.com is a valid account, an email will be sent with instructions to reset your password.the truth is that this mailbox has been blocked

Proposed resolution

We should tell the user that this email is locked. Instead of other prompts

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet

Viewing all 297439 articles
Browse latest View live


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