Problem/Motivation
Spinoff of #3274474: Fix 'Access to an undefined property' PHPStan L0 errors, for test code only.
Spinoff of #3274474: Fix 'Access to an undefined property' PHPStan L0 errors, for test code only.
If you scaffold an empty file, (one which exists in the source directory, but has length=0), the scaffold plugin throws an error.
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.
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!
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:
exposed
: Reset only exposed filters (default)contextual
: Reset only contextual filtersall
: Reset all filtersPlease review the attached patch and let me know of any change requests.
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.
- 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
Some words on the dictionary and the core's code doesn't exists or are misspelled.
Fix or ignore the following list of words on the code and remove them from the dictionary:
Do a reroll; update the IS. Review
We have currenlty baselined PHPStan #method.*should return .* but return statement is missing#
errors.
In this issue, fix the error in test classes and test modules, and cleanup the baseline.
no
no
no
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.
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.
Update composer/Metapackage/README.txt
. Change "--with-updates" to "--with-dependencies".
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
Probably this should be checked explicitly that this is not a string.
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.
MR 2372 is about GENERATING the baseline
MR 1660 is about USING the baseline
It would be nice to include a 'Lazy Load' animation in Olivero.
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.
Make changes to comment.html.twig so that comment title is the first element of a comment.
Make suggested changes to comment.html.twig.
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.
None
None
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.
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.
Just a quick fix for one of the baseline errors found by phpstan.
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.
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).
Use getSourceModule in DrupalSqlBase
Modify tests that need the source module enabled in the database so that requirements are met.
Identify and address BC issues.
Nothing.
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.
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?
Create a fieldset with a title of zero. It will should appear. This was broken is Drupal 7 and was fixed in #2192419: Use a WCAG-compliant fieldset (fieldgroup) for #type radios/checkboxes.
This issue will add test coverage that was not added when this fixed in 2192419.