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

InvalidArgumentException when a view is set as homepage and the current user doesn't have access to it

$
0
0

Hi,
I'm using 8.1.0-rc1.

I've found an issue which is very rare, when a view is set as homepage and the user doesn't have access to it.
(For example the homepage is only a login box)
This case worked in 8.0, seems to be a regression.

The debug trace:

The website encountered an unexpected error. Please try again later.

InvalidArgumentException: Source path has to start with a slash. in Drupal\Core\Path\AliasManager->getAliasByPath() (line 191 of core/lib/Drupal/Core/Path/AliasManager.php).
Drupal\system\Plugin\Condition\RequestPath->evaluate() (Line: 71)
Drupal\Core\Condition\ConditionManager->execute(Object) (Line: 82)
Drupal\Core\Condition\ConditionPluginBase->execute() (Line: 31)
Drupal\block\BlockAccessControlHandler->resolveConditions(Array, 'and') (Line: 128)
Drupal\block\BlockAccessControlHandler->checkAccess(Object, 'view', Object) (Line: 98)
Drupal\Core\Entity\EntityAccessControlHandler->access(Object, 'view', NULL, 1) (Line: 339)
Drupal\Core\Entity\Entity->access('view', NULL, 1) (Line: 61)
Drupal\block\BlockRepository->getVisibleBlocksPerRegion(Array) (Line: 142)
Drupal\block\Plugin\DisplayVariant\BlockPageVariant->build() (Line: 264)
Drupal\Core\Render\MainContent\HtmlRenderer->prepare(Array, Object, Object) (Line: 122)
Drupal\Core\Render\MainContent\HtmlRenderer->renderResponse(Array, Object, Object) (Line: 95)
Drupal\Core\EventSubscriber\MainContentViewSubscriber->onViewRenderArray(Object, 'kernel.view', Object) (Line: 116)
Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher->dispatch('kernel.view', Object) (Line: 144)
Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 2) (Line: 62)
Symfony\Component\HttpKernel\HttpKernel->handle(Object, 2, 1) (Line: 62)
Drupal\Core\StackMiddleware\Session->handle(Object, 2, 1) (Line: 53)
Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object, 2, 1) (Line: 103)
Drupal\page_cache\StackMiddleware\PageCache->pass(Object, 2, 1) (Line: 82)
Drupal\page_cache\StackMiddleware\PageCache->handle(Object, 2, 1) (Line: 51)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object, 2, 1) (Line: 55)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object, 2, 1) (Line: 23)
Stack\StackedHttpKernel->handle(Object, 2) (Line: 150)
Drupal\Core\EventSubscriber\DefaultExceptionHtmlSubscriber->makeSubrequest(Object, '/system/403', 403) (Line: 104)
Drupal\Core\EventSubscriber\DefaultExceptionHtmlSubscriber->on403(Object) (Line: 103)
Drupal\Core\EventSubscriber\HttpExceptionSubscriberBase->onException(Object, 'kernel.exception', Object) (Line: 116)
Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher->dispatch('kernel.exception', Object) (Line: 216)
Symfony\Component\HttpKernel\HttpKernel->handleException(Object, Object, 1) (Line: 70)
Symfony\Component\HttpKernel\HttpKernel->handle(Object, 1, 1) (Line: 62)
Drupal\Core\StackMiddleware\Session->handle(Object, 1, 1) (Line: 53)
Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object, 1, 1) (Line: 211)
Drupal\page_cache\StackMiddleware\PageCache->fetch(Object, 1, 1) (Line: 125)
Drupal\page_cache\StackMiddleware\PageCache->lookup(Object, 1, 1) (Line: 79)
Drupal\page_cache\StackMiddleware\PageCache->handle(Object, 1, 1) (Line: 51)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object, 1, 1) (Line: 55)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object, 1, 1) (Line: 23)
Stack\StackedHttpKernel->handle(Object, 1, 1) (Line: 631)
Drupal\Core\DrupalKernel->handle(Object) (Line: 19)

How to reproduce

  • Create a view and set it up as anonymous users don't have access to it.
  • Set it as your homepage.
  • Log out of the site.
  • Ensure your site is accessed "mydomain.com" without any path info in URL.

I couldn't reproduce when the homepage is simply set to 'system/403', so seems to be views related.


Provide a method dedicated to setting the default revision

$
0
0

Problem/Motivation

Way back in 2012 we added support for declaring revisions as the current revision: #218755: Support revisions in different states. This has been implemented with a getter and setter all rolled in the same method:

  /**
   * Checks if this entity is the default revision.
   *
   * @param bool $new_value
   *   (optional) A Boolean to (re)set the isDefaultRevision flag.
   *
   * @return bool
   *   TRUE if the entity is the default revision, FALSE otherwise. If
   *   $new_value was passed, the previous value is returned.
   */
  public function isDefaultRevision($new_value = NULL);

This is contrary to how we do things nowadays, the rest of core always uses dedicated getters and setters. This is confusing, and for people unfamiliar with the interface it is difficult to discover how a default revision can be set.

The confusion is made worse because in the example implementation in NodeRevisionsTest it appears that we are supposed to set the isDefaultRevision property directly, which is a WTF since this is a protected property. The below code only works because the write call that sets the isDefaultRevision property is intercepted by the magic __set() method in ContentEntityBase.

    // Make a new revision and set it to not be default.
    // This will create a new revision that is not "front facing".
    $new_node_revision = clone $node;
    $new_body = $this->randomMachineName();
    $new_node_revision->body->value = $new_body;
    // Save this as a non-default revision.
    $new_node_revision->setNewRevision();
    $new_node_revision->isDefaultRevision = FALSE; // Setting a protected property directly??!?
    $new_node_revision->save();

Proposed resolution

  1. Solve the WTF and improve discoverability by providing a setDefaultRevision() method on RevisionableInterface.
  2. Leave the functionality of isDefaultRevision() unchanged for backwards compatibility. Add some documentation to discourage the use of this method for setting the default revision.
  3. Update all existing code that calls isDefaultRevision() with the goal of setting the property to use setDefaultRevision() instead so this can serve as examples to developers.
  4. Replace existing code that sets the isDefaultRevision property through the magic setter to use setDefaultRevision() instead.

This probably doesn't require any new test coverage, this will be adequately tested by adapting the existing tests.

Remaining tasks

Implement.

User interface changes

None.

API changes

A new method setDefaultRevision() added to RevisionableInterface.

Data model changes

None.

Ensure core compliance to Drupal.Commenting.FunctionComment.ParamCommentIndentation

$
0
0

FILE: /home/anoopjohn/projects/drupal/drupal-8/core/authorize.php
----------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
----------------------------------------------------------------------
 51 | ERROR | [x] Parameter comment indentation must be 3 spaces,
    |       |     found 2 spaces

Disable BigPipe delivery for non-safe method (e.g. POST) requests like render caching

$
0
0

Problem/Motivation

The poll project displays forms in a lazy builder. Apparently, that breaks big_pipe when submitting that form because it can't deal with the EnforcedResponseException that's then eventually thrown.

And we can't just handle it, because we already sent the response.. no way we can now suddenly send a difference one.

Proposed resolution

I think we can skip big_pipe on post requests?

The attached patch does that, but we'll need tests and needs to be properly documented, this is a just a quick fix.

Remaining tasks

User interface changes

API changes

Data model changes

"MySQL server has gone away" selecting from semaphore table

$
0
0

Hi,

I had this kind of errors every time I clear the cache, or install/uninstall modules, or make changes on views...etc. After a few seconds a white screen appears with this kind of errors:

Additional uncaught exception thrown while handling exception.
Original
PDOException: SQLSTATE[HY000]: General error: 2006 MySQL server has gone away: SELECT expire, value FROM {semaphore} WHERE name = :name; Array ( [:name] => theme_registry:runtime:seven:cache ) in lock_may_be_available() (line 167 of /var/www/clients/client2/web19/web/includes/lock.inc).
Additional
PDOException: SQLSTATE[HY000]: General error: 2006 MySQL server has gone away: SELECT expire, value FROM {semaphore} WHERE name = :name; Array ( [:name] => rules_get_cacherules_event_whitelist ) in lock_may_be_available() (line 167 of /var/www/clients/client2/web19/web/includes/lock.inc).
________________________________________
Uncaught exception thrown in shutdown function.
PDOException: SQLSTATE[HY000]: General error: 2006 MySQL server has gone away: DELETE FROM {semaphore} WHERE (value = :db_condition_placeholder_0) ; Array ( [:db_condition_placeholder_0] => 1917749777570f6780cbc894.71899901 ) in lock_release_all() (line 269 of /var/www/clients/client2/web19/web/includes/lock.inc).
...

I increased the max_allowed_packet to a very high value (2048M) but nothing changed.

Every time these errors appear, I have to restart the server or wait for a few hours to make the website working again.

Could you help to solve this issue please?

Thank you

Exposed filter form exposed as block: form_id simply views_exposed_form

$
0
0

When you create exposed filters in a view, and expose them as a block which you can place on different pages, and then want to manipulate the form using hook_form_alter(), the $form_id which is passed to hook_form_alter() is set to views_exposed_form - which is too general.

You can get the proper id via $form['#id'] (which includes the view name and display - e.g. "views-exposed-form-events-page-3"), but should $form_id not hold the correct id of the form?

Not a big deal, as you can easily compare to $form['#id'], but why then pass the variable?

Broken autocomplete functionality when access to index.php blocked

File migrations *always* copy in files, even if the files where off-line copied to destination

$
0
0

Problem/Motivation

D7 had a preserve_files option to trigger this behavior, we don’t have that in D8. This results in really slow migration when you're talking about multiple gigabytes of files.

Proposed resolution

Resurrect the 'preserve_files' configuration option'

Remaining tasks

Code a patch

User interface changes

API changes

Additional process plugin option for file migrations to configure a 'preserve_files' flag.

Data model changes


Add stream wrappers to access system files

$
0
0

Updated: Comment #179

Problem/Motivation

drupal_get_path() infiltrates almost every module and isn't very intuitive for new developers.
Stream wrappers make much more sense and simplify the API for developers trying to refer to image, JS, CSS and other assets files in code.
Stream wrappers will make it easier to reference JS and CSS files from yml files in modules, e.g. *.libraries.yml and will support the API to be introduced by #1762204: Introduce Assetic compatibility layer for core's internal handling of assetsAssigned to: sdboyer

Proposed resolution

Consensus is to go with the module:// theme:// and profile:// streamwrappers. Replace drupal_get_path() with stream wrappers in strings that are evaluated for a module, theme or profile path. Documentation will specify that this is *not* to be used to include PHP files.

Before patch examples:

_drupal_add_css(drupal_get_path('module', 'theme_test') . '/css/base-override.css');
$render_array['#attached']['css'][] = drupal_get_path('module', 'theme_test') . '/css/base-override.css';

After patch examples:

_drupal_add_css('module://theme_test/css/base-override.css');
$render_array['#attached']['css'][] = 'module://theme_test/css/base-override.css';

There are 4 possible use cases:

Asset files attached in PSR-4/PSR-0 classes:

In a \Drupal\foo_module\Form\FooEntityForm where assets are attached,
$form['#attached']['css'][] = 'module://foo_module/js/foo_bar.js'; is a far better DX than
$form['#attached']['css'][] = __DIR__ . '/../../js/foo_bar.js'; or even
$form['#attached']['css'][] = drupal_get_path('module', 'foo_module') . '/js/foo_bar.js';

Modules that provide resources consumed by other modules or themes

  • color module
  • ckeditor module

Modules that use resources provided by other modules

Mainly in contrib, these would utilize js, css and other files from modules in core.

Hooks for asset management

hook_library_info_alter(), hook_library_alter(), hook_css_alter(), etc. existing examples in system.api.php

The real benefit of this issue is the DX win of using "module://foo_module/js/foo_bar.js" which makes it easier to understand the code.

Remaining tasks

Reviews.
Commit.
Replacement of most / all uses of drupal_get_path calls (separate issue). This can be scripted.

API changes

Simplifies getting paths to modules, themes and profiles by using a stream wrapper.

#2028109: Convert hook_stream_wrappers() to tagged services.
#1308054: Add an abstract DrupalReadOnlyStreamWrapper that other stream wrappers can extend
#1762204: Introduce Assetic compatibility layer for core's internal handling of assetsAssigned to: sdboyer
#1702958: Add libraries:// stream wrappers to access system files

Original report by @Dave Reid

I wrote http://drupal.org/project/system_stream_wrapper and now let's merge it into core! It's super helpful to be able to access files via module://modulename/path/to/file.txt which nicely resolves to the actual file location.

Disable Drupal\Tests\Listeners\HtmlOutputPrinter by default because PHPStorm is broken

provide Views reverse relationships automatically for entity base fields

$
0
0

core_field_views_data() provides reverse relationships for entity reference fields, but this is only for config fields.

For base fields on entities, such as the node uid field, core entity modules have to implement this themselves.

Eg UserViewsData::UserViewsData():

    $data['users_field_data']['uid']['relationship'] = array('title' => t('Content authored'),'help' => t('Relate content to the user who created it. This relationship will create one record for each content item created by the user.'),'id' => 'standard','base' => 'node_field_data','base field' => 'uid','field' => 'uid','label' => t('nodes'),
    );

Vertical tabs summaries have stray spaces

$
0
0

The vertical tabs summary on node type forms has spaces before commas.

See picture:

node type form summary spaces.jpg

Toolbar's orientation-toggling arrow not centered when zoomed out

$
0
0

Followup issue to #2546196: Toolbar's orientation-toggling arrows broken by #2173527, which fixed a vertical positioning issue, but not when the browser is zoomed out.

One small followup is that when you zoom out (using the browser's zoom function - for me, it happened when I hit 50%) the toggle isn't centered vertically anymore. Not sure what screens/users this might affect, but it can be fixed with the following css.

.toolbar .toolbar-tray-horizontal .toolbar-toggle-orientation > .toolbar-lining {
position: relative;
top: 50%;
transform: translateY(-50%);
-ms-transform: translateY(-50%);
-webkit-transform: translateY(-50%);
}
Here are screenshots showing before and after:

Without Patch

Arrow Without Patch

With Patch

Arrow With Patch

Contextual link triggers cover too much of small contextual regions

$
0
0

Problem/Motivation

If you enable more than one language and add the language switcher block to the header in Bartik the top 2 languages are not clickable. The edit mode icon overlays the block and does not allow you to click the language links.

Proposed resolution

See if Bartik has any CSS in place for blocks in the header.
Add fixes to allow users to click on languages in the block with contextual links enabled.

Remaining tasks

Contributor tasks needed
TaskNovice task?Contributor instructionsComplete?
Discuss solution options
Create a patchInstructions
Manually test the patch Instructions
Add steps to reproduce the issueInstructions
Embed before and after screenshots in the issue summary Instructions
Review patch to ensure that it fixes the issue, stays within scope, is properly documented, and follows coding standardsInstructions

User interface changes

Yes.

API changes

None

Drupal 8 UPGRADE.txt is misleading in many ways (in its name to begin with)

$
0
0

Problem/Motivation

Drupal 8.1.0 comes with the first upgrade UI solution. It is critically important to have documentation that clearly explains what each process is for and how to use them. Drupal's UPGRADE.txt is misleading in its name and then its mixed use of update and upgrade which makes it hard to get to know the concepts clearly.

Proposed resolution

- Rename the file to UPDATE.txt, its about updates.
- Modify where it says upgrade and means update to update
- Modify where it means both upgrade and update to mention both
- Modify intro where it says Migrate Upgrade is a contributed module. It is a core module and has a different name.

Remaining tasks

Get it in :)

User interface changes

None.

API changes

None.

Data model changes

None.


Move Drupal\simpletest\RandomGeneratorTrait, Drupal\simpletest\WebAssert and Drupal\simpletest\SessionTestTrait into Drupal\Tests namespace

tabledrag subgroup. Group select option does not update with row/subgroup change.

$
0
0

In using the Table field type with Subgroup option in a custom form, the select element which holds the name of the group is not updated by the core/misc/tabledrag.js script.

While looking through /core/modules/block/src/BlockListBuilder.php to model use from; it is the responsibility of the Block Module's 'block.js' to update the region select field. I would expect that this would be more naturally handled by tabledrag.js at it is a base feature of the table field.

As secondary feature/UX request:
BlockListBuilder does also add in a 'message' row for "...'nothing' in this region" -- which is a good helper (although the table is usable without it). Perhaps this row could be automatically generated with the table (with a property for a unique message string). Also, the hide/show of this row is left to the 'block.js' script at this time.

Configuration THEMENAME.settings depends on the THEMENAME theme that will not be installed after import.

$
0
0

This came up when trying to migrate a full config export from a test site to live.
However, exporting config from test and then trying to re-import to test caused the same issue.

The site has the latest Bootstrap theme - https://www.drupal.org/project/bootstrap - using the LESS starterkit.

The following steps meant the config could be imported on the live site.

  1. exported entire site config from dev site with new feaures in it
  2. clobbered dev database with a sync from live
  3. manually deleted all staged config on dev from sites/default/files/config_xxxxxx
  4. manually deleted all staged config on live from sites/default/files/config_xxxxxx
  5. opened exported config file (.tar.gz) in item 1 and deleted the THEMENAME.settings.yml file
  6. imported site config into dev site & tested
  7. imported site config into live
  8. All good

There is a short forum discussion on this at https://www.drupal.org/node/2698777 and that's the only result on Google at the moment.

Unsure if this is a core bug, a bootstrap bug or an error somewhere in our development.

No theme after installation, all admin links go 404

$
0
0

I was giving D8 a try and installed it on my campus AFS space. Installation went completely smooth. But after I created my admin user, and am logged in and directed to front page, I get a blank, messed up site. All the links go 404.

I'm not sure where to start debugging this. Clean URLs? Permissions? Theme?

D8

How to create block for contct form

$
0
0

I see help text in contact forms as below
"If you would like additional text to appear on a site-wide contact page, beyond field labels, use a block. You can create and edit blocks on the Block layout page, if you have the Block module installed."

Ho ever i could not find how to create one for contact forms
My requirement is i want to give addresses of different locations by the side of this form
Can some one help please?

Viewing all 295545 articles
Browse latest View live


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