Problem/Motivation

Bug occurs when access is denied for the current user to a node in a book hierarchy

When visiting a child page there is an undefined index for title on line 425 of book.module

The undefined index is in function template_preprocess_book_navigation()

In Drupal 7 the return value of _menu_link_translate() is FALSE if access is denied

In Drupal 8 \Drupal\book\BookManagerInterface::loadBookLink always returns an array, so it's never empty unless the node doesn't exist.

In Drupal 8 we need to check the value of the access key in the array.

Proposed resolution

Fix logic of line 418 in book.module.

Add a test (?)

Remaining tasks

patch & review

User interface changes

n/a

API changes

n/a

Data model changes

n/a

Issue fork book-2670150

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

pwolanin created an issue. See original summary.

pwolanin’s picture

Status: Active » Needs review
Issue tags: +Needs tests
StatusFileSize
new769 bytes

Here's the fix (but no test yet)

davidhernandez’s picture

The situation results in a big ugly error. The patch presumably fixes it. But, what would be tested? In the current situation, the child node renders successfully.

pwolanin’s picture

I think the test could simply be a regression test and reproduce the current error and fail as test-only and pass with the patch

harika gujjula’s picture

Assigned: Unassigned » harika gujjula
Status: Needs review » Needs work
Issue tags: +drupalconasia2016

Version: 8.0.x-dev » 8.1.x-dev

Drupal 8.0.6 was released on April 6 and is the final bugfix release for the Drupal 8.0.x series. Drupal 8.0.x will not receive any further development aside from security fixes. Drupal 8.1.0-rc1 is now available and sites should prepare to update to 8.1.0.

Bug reports should be targeted against the 8.1.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.2.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

wheatpenny’s picture

Assigned: harika gujjula » wheatpenny
Issue tags: -drupalconasia2016
pwolanin’s picture

Issue summary: View changes
wheatpenny’s picture

Status: Needs work » Needs review
StatusFileSize
new1.47 KB

Uploading a draft of the test only patch. Needs to be reviewed and modified.

wheatpenny’s picture

Assigned: wheatpenny » Unassigned

In order to help the next person working on this, the tests above result in the following error messages:

"( ! ) Fatal error: Call to a member function id() on a non-object in /var/www/nola/core/modules/book/src/Tests/BookTest.php on line 773"

Status: Needs review » Needs work

The last submitted patch, 10: undefined_index_in-2670150-10.patch, failed testing.

catch’s picture

mohit_aghera’s picture

Status: Needs work » Needs review
StatusFileSize
new1.49 KB
new1.56 KB

Status: Needs review » Needs work

The last submitted patch, 14: undefined_index_in-2670150-14.patch, failed testing.

mohit_aghera’s picture

Status: Needs work » Needs review
StatusFileSize
new1.51 KB
new1.33 KB

Fixing issues in test case.

Status: Needs review » Needs work

The last submitted patch, 16: undefined_index_in-2670150-16.patch, failed testing.

mohit_aghera’s picture

Status: Needs work » Needs review
StatusFileSize
new1.48 KB
new830 bytes
kgoel’s picture

Issue tags: +govcon2016

Going to review the patch

kgoel’s picture

Status: Needs review » Needs work

Test patch in https://www.drupal.org/node/2670150#comment-11399301has test overage without fix in https://www.drupal.org/node/2670150#comment-10863592. Test patch should have failed but instead it passes. Issue needs work.

Version: 8.1.x-dev » 8.2.x-dev

Drupal 8.1.9 was released on September 7 and is the final bugfix release for the Drupal 8.1.x series. Drupal 8.1.x will not receive any further development aside from security fixes. Drupal 8.2.0-rc1 is now available and sites should prepare to upgrade to 8.2.0.

Bug reports should be targeted against the 8.2.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.3.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

mohit_aghera’s picture

Status: Needs work » Needs review
StatusFileSize
new31.78 KB
new769 bytes

Adding fix for test coverage.

mohit_aghera’s picture

StatusFileSize
new2.31 KB
new769 bytes

Fixing diff issue.

mohit_aghera’s picture

Issue tags: +#dcdelhi

Version: 8.2.x-dev » 8.3.x-dev

Drupal 8.2.6 was released on February 1, 2017 and is the final full bugfix release for the Drupal 8.2.x series. Drupal 8.2.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.3.0 on April 5, 2017. (Drupal 8.3.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.3.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.4.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.3.x-dev » 8.4.x-dev

Drupal 8.3.6 was released on August 2, 2017 and is the final full bugfix release for the Drupal 8.3.x series. Drupal 8.3.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.4.0 on October 4, 2017. (Drupal 8.4.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.4.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.5.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.4.x-dev » 8.5.x-dev

Drupal 8.4.4 was released on January 3, 2018 and is the final full bugfix release for the Drupal 8.4.x series. Drupal 8.4.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.5.0 on March 7, 2018. (Drupal 8.5.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.5.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.6.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.5.x-dev » 8.6.x-dev

Drupal 8.5.6 was released on August 1, 2018 and is the final bugfix release for the Drupal 8.5.x series. Drupal 8.5.x will not receive any further development aside from security fixes. Sites should prepare to update to 8.6.0 on September 5, 2018. (Drupal 8.6.0-rc1 is available for testing.)

Bug reports should be targeted against the 8.6.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.7.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.6.x-dev » 8.8.x-dev

Drupal 8.6.x will not receive any further development aside from security fixes. Bug reports should be targeted against the 8.8.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.9.x-dev branch. For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

ptmkenny’s picture

Version: 8.8.x-dev » 9.1.x-dev
Issue tags: -Needs tests

Removing "Needs tests" tag because the latest patch has a test.

Version: 9.1.x-dev » 9.2.x-dev

Drupal 9.1.0-alpha1 will be released the week of October 19, 2020, which means new developments and disruptive changes should now be targeted for the 9.2.x-dev branch. For more information see the Drupal 9 minor version schedule and the Allowed changes during the Drupal 9 release cycle.

kasey_mk’s picture

StatusFileSize
new2.3 KB

Re-roll. Sorry for the lack of an interdiff; ran into tool trouble and out of time.

Status: Needs review » Needs work

The last submitted patch, 32: undefined_index_in-2670150-32.patch, failed testing. View results
- codesniffer_fixes.patch Interdiff of automated coding standards fixes only.

anmolgoyal74’s picture

Status: Needs work » Needs review
StatusFileSize
new2.31 KB
new829 bytes

Fixed non-existent service entity.manager.

Status: Needs review » Needs work

The last submitted patch, 34: undefined_index_in-2670150-34.patch, failed testing. View results

Version: 9.2.x-dev » 9.3.x-dev

Drupal 9.2.0-alpha1 will be released the week of May 3, 2021, which means new developments and disruptive changes should now be targeted for the 9.3.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.3.x-dev » 9.4.x-dev

Drupal 9.3.0-rc1 was released on November 26, 2021, which means new developments and disruptive changes should now be targeted for the 9.4.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.4.x-dev » 9.5.x-dev

Drupal 9.4.0-alpha1 was released on May 6, 2022, which means new developments and disruptive changes should now be targeted for the 9.5.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.5.x-dev » 10.1.x-dev

Drupal 9.5.0-beta2 and Drupal 10.0.0-beta2 were released on September 29, 2022, which means new developments and disruptive changes should now be targeted for the 10.1.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 10.1.x-dev » 11.x-dev

Drupal core is moving towards using a “main” branch. As an interim step, a new 11.x branch has been opened, as Drupal.org infrastructure cannot currently fully support a branch named main. New developments and disruptive changes should now be targeted for the 11.x branch, which currently accepts only minor-version allowed changes. For more information, see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

quietone’s picture

Status: Needs work » Postponed

This extension is being deprecated, see #3376070: [Meta] Tasks to deprecate Book module. It will be removed from core and moved to a contrib project, #3376101: [11.x] [Meta] Tasks to remove Book.

This is now Postponed. The status is set according to two policies. The Remove a core extension and move it to a contributed project and the Extensions approved for removal policies.

This issue may be re-opened if it can be considered critical, If unsure, re-open the issue and ask in a comment.

smustgrave’s picture

Project: Drupal core » Book
Version: 11.x-dev » 1.0.x-dev
Component: book.module » Code
Status: Postponed » Needs work

Moving to contrib.

smustgrave’s picture

Version: 1.0.x-dev » 2.0.x-dev

smustgrave’s picture

Status: Needs work » Postponed (maintainer needs more info)

Actually wonder if this is still needed for 2.0.x?

smustgrave’s picture

Status: Postponed (maintainer needs more info) » Closed (cannot reproduce)