On a clean Drupal 7 beta1 install, I created three books with some child pages. When I enable the Book Navigation block, the following error message appears multiple times:

Notice: Undefined index: access in menu_tree_output() (line 963 of /[...]/includes/menu.inc).

- This doesn't seem to be theme related.
- Disabling the Book Navigation block makes the error message disappear.

PHP: 5.2.14

Comments

olafveerman’s picture

Title: "Undefined index" » Enabling Book Navigation block results in "Undefined index"
damien tournoud’s picture

Status: Active » Postponed (maintainer needs more info)

I cannot reproduce.

Could you give us specific steps to reproduce this issue?

damien tournoud’s picture

Status: Postponed (maintainer needs more info) » Active

Actually, I can reproduce.

This happens on the frontpage (or any page that is not related to a book) as soon as there is at least a book defined in the installation.

damien tournoud’s picture

Version: 7.0-beta1 » 7.x-dev
olafveerman’s picture

StatusFileSize
new46.89 KB

In my case it also occurs on book related pages. In Alpha 6 this problem doesn't occur.

VladGh’s picture

Doing a ddebug_backtrace I see that the Boolean "access" element is inserted correctly by the menu.inc function at line 937 but somehow it gets stripped by the book.module somewhere between line 253 and 274. That is the 'all pages' section. I guess is the $pseudo_tree at line $268. If the block is configured to be shown only on the book pages it works flawlessly. It also works if the current page is from a book.

ygerasimov’s picture

Status: Active » Needs review
StatusFileSize
new869 bytes

I think this happens because we do not check whether current user can access the node of the book. Please review the patch that does this check.

VladGh’s picture

It works in my case, thank you. Now the ['link'] array has the 32nd element "access (Boolean) TRUE".

ygerasimov’s picture

Can someone test as well so we can move this isuue to RTBC?

VladGh’s picture

#7: book_navigation_block.patch queued for re-testing.

VladGh’s picture

I'm sorry I didn't mean to re-test it.

olafveerman’s picture

Status: Needs review » Reviewed & tested by the community

Great, the patch also works for me!

Status: Reviewed & tested by the community » Needs work

The last submitted patch, book_navigation_block.patch, failed testing.

webchick’s picture

Issue tags: -undefined index +Needs tests

Can we add a test here that demonstrates the bug so we ensure we don't get it again in the future?

drunken monkey’s picture

Status: Needs work » Needs review
Issue tags: -Needs tests
StatusFileSize
new6.51 KB
new5.67 KB

There already was a test, but before it only tested, whether you could edit the block title. Interesting …
Also, the file had a lot of trailing whitespace in it. (This patch removes it – I hope this is the correct way in such a case.)
However, this works for me. I'd also say this is major, since it makes book navigation unusable for many use cases. But leaving it at normal for the time being.

ygerasimov’s picture

Status: Needs review » Reviewed & tested by the community

Thomas, thank you for the reorganizing tests and removing trailing spaces. The test included in http://drupal.org/files/issues/book_navigation_2.patch catches the bug.

webchick’s picture

Status: Reviewed & tested by the community » Fixed

Awesome. Committed to HEAD, thanks! :D

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.