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

Fix 'Access to an undefined property' PHPStan L0 errors in test code


Replace REQUEST_TIME in procedural code

$
0
0

Problem/Motivation

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet

Scaffold ReplaceOp::copyScaffold() throws an error for empty files

$
0
0

Problem/Motivation

If you scaffold an empty file, (one which exists in the source directory, but has length=0), the scaffold plugin throws an error.

Steps to reproduce

Proposed resolution

ReplaceOp::copyScaffold() says this:

    $success = file_put_contents($destination->fullPath(), $this->contents());
    if (!$success) {
      throw new \RuntimeException($interpolator->interpolate("Could not copy source file <info>[src-rel-path]</info> to <info>[dest-rel-path]</info>!"));
    }

file_put_contents() can return 0 for the length of the written file, or FALSE on failure. Since we're checking for !$success, we generate an error in either case.

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet

INSERT code in menu.inc does not perform boundary checks, causing PDO error (WSOD)

$
0
0

API page: https://api.drupal.org/api/drupal/includes%21menu.inc/7.x

Enter a descriptive title (above) relating to menu.inc, then describe the problem you have found:

After updating something my Drupal 7, Ubercart 3 website started to WSOD (WHITE SCREEN OF DEATH).

I eventually figured out what was wrong by running index.php in the console like so:

# php index.php

I started to see screens and screens of errors, the pertinent part of which are

PDOException: SQLSTATE[22001]: String data, right truncated: 1406 Data too long for column 'link_title' at row 18:

and

PDOException: SQLSTATE[22001]: String data, right truncated: 1406 Data too long for column 'title' at row 18:

So I had a look a the database tables and determined that the two columns in question were of type VARCHAR(255).

The error is due to the lack of boundary checking on the values composing a database INSERT statement in menu.inc with respect to those two columns. The code does not take into account the potential for very long menu titles.

Here's the TWO (2) fixes I applied to menu.inc (bad-bad-hacking-core!) to get my system up and running again.

Around line ~3267 add the following TWO (2) lines of code just before the db_update('menu_links') statement

# GL 2022-06-19 Added to prevent database PDO error due to overflow of database column 'link_title' (varchar 255)
if (strlen($item['link_title'] > 254)) $item['link_title'] = substr($item['link_title'], 0, 254);

db_update('menu_links')
->fields(array(
'menu_name' => $item['menu_name'],
'plid' => $item['plid'],
'link_path' => $item['link_path'],
'router_path' => $item['router_path'],
'hidden' => $item['hidden'],
'external' => $item['external'],
'has_children' => $item['has_children'],
'expanded' => $item['expanded'],
'weight' => (int) $item['weight'],
'depth' => $item['depth'],
'p1' => $item['p1'],
'p2' => $item['p2'],
'p3' => $item['p3'],
'p4' => $item['p4'],
'p5' => $item['p5'],
'p6' => $item['p6'],
'p7' => $item['p7'],
'p8' => $item['p8'],
'p9' => $item['p9'],
'module' => $item['module'],
'link_title' => $item['link_title'],
'options' => serialize($item['options']),
'customized' => $item['customized'],
))
->condition('mlid', $item['mlid'])
->execute();

Around line ~3892 add the following TWO (2) lines of code just before the $insert->values(array( statement

# GL 2022-06-19 Added to prevent PDO error on overflow of database column 'title' (varchar 255)
if (strlen( $item['title'] > 254)) $item['title'] = substr($item['title'], 0, 254);

$insert->values(array(
'path' => $item['path'],
'load_functions' => $item['load_functions'],
'to_arg_functions' => $item['to_arg_functions'],
'access_callback' => $item['access callback'],
'access_arguments' => serialize($item['access arguments']),
'page_callback' => $item['page callback'],
'page_arguments' => serialize($item['page arguments']),
'delivery_callback' => $item['delivery callback'],
'fit' => $item['_fit'],
'number_parts' => $item['_number_parts'],
'context' => $item['context'],
'tab_parent' => $item['tab_parent'],
'tab_root' => $item['tab_root'],
'title' => $item['title'],
'title_callback' => $item['title callback'],
'title_arguments' => ($item['title arguments'] ? serialize($item['title arguments']) : ''),
'theme_callback' => $item['theme callback'],
'theme_arguments' => serialize($item['theme arguments']),
'type' => $item['type'],
'description' => $item['description'],
'position' => $item['position'],
'weight' => (int) $item['weight'],
'include_file' => $item['include file'],
));

After these changes my website was able to load, enabling to be able to begin to figure out how and why a 254+ length menu title and link had happened!

Add support for contextual filter reset via exposed form options

$
0
0

I ran across an instance where I needed to reset all user-accessible filters for a given view (exposed & contextual). I noticed that views doesn't have support for this out of the box, only providing the ability to reset exposed filters and then leave contextual filters as-is.

The patch submitted with this issue implements the desired feature by creating an additional option in the View > Display > Exposed Form > Exposed form style > Settings menu that's named "Filter reset button behavior." This new option allows the user to choose how they want views to handle a filter reset:

  1. exposed: Reset only exposed filters (default)
  2. contextual: Reset only contextual filters
  3. all: Reset all filters

Please review the attached patch and let me know of any change requests.

Replace REQUEST_TIME in tests

$
0
0

Problem/Motivation

REQUEST_TIME is a deprecated global. There are several issues to remove it's use in core.

This issue is to remove it from just tests.

Proposed resolution

- Adjust KTB and BTB to add the service as a protected method
- Adjust KTB and BTB to add a protected variable for the request time
- This one of these throughout the tests

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet

Fix or ignore 15 words used in Help Topics

$
0
0

Problem/Motivation

Some words on the dictionary and the core's code doesn't exists or are misspelled.

Proposed resolution

Fix or ignore the following list of words on the code and remove them from the dictionary:

  • anotherwordenglish > fix
  • anotherwordgerman > fix
  • asdrsad > ignore
  • barmm > ignore
  • foomm > ignore
  • hilfetestmodul > ignore
  • nonwordgerman > fix
  • nonworditem > fix
  • notawordenglish > fix
  • notawordgerman > fix
  • sdeeeee > ignore
  • sqruct > ignore
  • wcsrefsdf > ignore
  • übersetzung > ignore

Remaining tasks

Do a reroll; update the IS. Review

Fix 'should return {type} but return statement is missing' PHPStan L0 errors in test code

$
0
0

Problem/Motivation

We have currenlty baselined PHPStan #method.*should return .* but return statement is missing# errors.

Proposed resolution

In this issue, fix the error in test classes and test modules, and cleanup the baseline.

Remaining tasks

User interface changes

no

API changes

no

Data model changes

no

Release notes snippet


Fix a comment typo in FileFieldWidgetTest

$
0
0

When running tests, I noticed that a test in the file module uses the word "then" instead of the proper word "than".

Changing this will have no effect on any code, but will make me feel better. I found no other instances of this problem in the file module.

Incorrect composer update instructions for Drupal core metapackages

$
0
0

Problem/Motivation

The documentation in composer/Metapackage/README.txt says:

Note that a project that uses both drupal/core-recommended and
drupal/core-dev-pinned must update them both at the same time, e.g.:

composer update drupal/core-recommended drupal/core-dev-pinned --with-updates

But there is no such option (--with-updates) for the composer update command.

I believe the option intended here is "--with-dependencies". That's what the similar instructions in composer/Template/README.txt say.

Proposed resolution

Update composer/Metapackage/README.txt. Change "--with-updates" to "--with-dependencies".

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet

PHPStan error LinkItemTest

$
0
0

Problem/Motivation

From issue #3178534: Start running PHPStan on Drupal core (level 0): Start running PHPStan on Drupal core (level 0)

     Internal error: Internal error: Cannot assign an empty string to a string offset in file /app/core/modules/link/tests/src/Kernel/LinkItemTest.php                                                                
     Run PHPStan with --debug option and post the stack trace to:                                                                                                                                                     
     https://github.com/phpstan/phpstan/issues/new?template=Bug_report.md     

Steps to reproduce

Proposed resolution

Probably this should be checked explicitly that this is not a string.

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet

[PP-upstream] Add baseline for deprecation testing

$
0
0

Problem/Motivation

symfony/phpunit-bridge 5.2.0 will bring the capability to add baseline files for deprecations, https://github.com/symfony/symfony/pull/37733

We should implement that to make simpler to avoid introducing new usages of deprecated things while legacy codebase is being cleaned up.

Steps to reproduce

Proposed resolution

MR 2372 is about GENERATING the baseline

MR 1660 is about USING the baseline

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet

Include a 'Lazy Load' animation in Olivero

$
0
0

It would be nice to include a 'Lazy Load' animation in Olivero.

Suggestion: Olivero theme should place comment titles above authoring info in comment.html.twig in order to enhance screenreader experience

$
0
0

Problem/Motivation

The Olivero theme places the comment author and comment post date above the comment title in comment.html.twig.

As a screenreader user, this breaks my preferred method for quickly navigating/scanning through a list of comments.

My use case is to use the screenreader's ability to navigate by heading. With the current theming this has focus land on the title of comments. It seems (at least to me) counter-intuitive and a less than optimal user experience to then have to move backwards in the page to locate the comment author and post date.

This behaviour also introduces some level of inconsistency, as site content has the more typical placement of authoring information below the content title.

As a screenreader user, consistent across the site and a natural flow of focus is highly desirable. In my opinion, the current thumbing of comments is a hit on my user experience and ability to navigate comments in the most productive way.

This is a great shame, as Olivero is proving to be a great user experience in so many other ways.

I'm not a web accessibility professional, so quite possibly the current theming of comments has a logic and good practice that I am not aware of. However, it would be desirable in my opinion if the comment title were to be relocated to be the first element of a comment. This is likely a style of semantic markup that others will be familiar with and likely expect.

Proposed resolution

Make changes to comment.html.twig so that comment title is the first element of a comment.

Remaining tasks

Make suggested changes to comment.html.twig.

User interface changes

When viewing comments added to content the comment title will be located above the authoring information - new icon, author, post date, and visually hidden elements for screenreader users.

API changes

None

Data model changes

None

Release notes snippet

The right mark of the secondary menu is too large

$
0
0

It would be nice to halve the right margin of the secondary menu.

The Logo at :

padding-left: 2.25rem;

The secondary menu should have :

padding-right: 2.25rem;

and no right margin.


There is a ghost sidebar on items

$
0
0

I seem to have opened an issue on this topic months ago, but can't find it.

On article pages, when there is no block in the sidebar, white space in the sidebar appears next to the content region.

This only happens on the article content type. Do you have a patch to fix this?

In the screenshots there is an article type content with empty sidebar space and another content type without this problem.

Fixing missing use statement in ConfigOverrider test class

$
0
0

Problem/Motivation

Just a quick fix for one of the baseline errors found by phpstan.

Steps to reproduce

Its in the baseline If you review the class you'll see the class isn't included. This doesn't currently throw any errors or warnings because the code isn't actually used.

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet

Use SourcePluginBase::getSourceModule() in DrupalSqlBase::checkRequirements()

$
0
0

Problem/Motivation

Drupal migration source plugins should use SourcePluginBase::getSourceModule() to check their requirements instead of simply checking their plugin definition. (This method was unused until #2936365: Migrate UI - allow modules to declare the state of their migrations aka https://git.drupalcode.org/project/drupal/-/commit/c1734c61852faecf3f358... was commited).

Proposed resolution

Use getSourceModule in DrupalSqlBase
Modify tests that need the source module enabled in the database so that requirements are met.

Remaining tasks

Identify and address BC issues.

User interface changes

Nothing.

API changes

Data model changes

Release notes snippet

[regression] With Drupal 9.4, can no longer call Database::getConnection() from within settings.php due to driver classes not yet in autoloader

$
0
0

Problem/Motivation

In Drupal 9.3, it was possible to do the following within settings.php:

$databases['default']['default'] = [
...
];
Database::setMultipleConnectionInfo($databases);
try {
  Database::getConnection();
}
catch (Exception $e) {
  // Do something
}

In Drupal 9.4, this now fails because the database driver is in core/modules/$driver, and that's not in the autoloader until after settings.php completes.

This can be worked around by adding $class_loader->addPsr4('Drupal\\mysql\\', 'core/modules/mysql/src/') prior to calling Database::getConnection();, but for sites with settings.php files that don't do that yet, this is a regression.

Acquia Cloud is one example where code like the above in settings.php (or rather, a .inc file included by settings.php) is done. I don't know if other Drupal hosting platforms employ similar constructs.

Steps to reproduce

Proposed resolution

Given that a workaround is possible, I don't know if we want to address this issue in core. If we do, then perhaps something like moving the current Settings::initialize() code for setting up the autoloader into Database::getConnection() might solve it? Maybe other ideas?

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet

Add test to ensure fieldset allows any non-empty-string #title

Viewing all 296634 articles
Browse latest View live


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