To reproduce:
1. Enable the Book module and the Help module.
2. Logged in as user 1 (or a user with book and node admin permission) Go to Create Content. Create a book node, then click "Add child page", and add a child. The book seems to be OK so far - you can see the book and its parent.
3. From either page, click "Outline". Help at the top of the page says "The outline feature allows you to include pages in the Book hierarchy, as well as move them within the hierarchy or to reorder an entire book.". "Book hierarchy" is a link to the route book.render, which is at path /book. "reorder an entire book" is a link to the route book.admin, which is at path /admin/structure/book.
4. Click the /book link. You get an error page:
Notice: Undefined index: href in Drupal\book\Controller\BookController->bookRender() (line 108 of core/modules/book/lib/Drupal/book/Controller/BookController.php).
Notice: Undefined index: options in Drupal\book\Controller\BookController->bookRender() (line 108 of core/modules/book/lib/Drupal/book/Controller/BookController.php).
Recoverable fatal error: Argument 3 passed to l() must be of the type array, null given, called in (.....)core/modules/book/lib/Drupal/book/Controller/BookController.php on line 108 and defined in l() (line 1025 of core/includes/common.inc).
Comment | File | Size | Author |
---|---|---|---|
#11 | d8-route-book-render-2250325-5.patch | 1.43 KB | jhodgdon |
#7 | d8-route-book-render-test-only-2250325-7.patch | 827 bytes | azinck |
#5 | d8-route-book-render-2250325-5.patch | 1.43 KB | azinck |
#2 | d8-route-book-render-2250325-2.patch | 1.39 KB | msmithcti |
Comments
Comment #1
msmithcti CreditAttribution: msmithcti commentedI'll give this a go.
Comment #2
msmithcti CreditAttribution: msmithcti commentedFixed the arguments passed to l() in BookController::bookRender(). Looking at BookManager::loadBooks() it will never return link options, so I'm just not passing them in. Provided tests for this page as coverage was lacking.
Comment #4
jhodgdonLooks like a legitimate test failure...
Comment #5
azinck CreditAttribution: azinck commentedRe-rolled to accommodate PSR-4 and made some minor tweaks to the test.
Comment #6
jhodgdonIn manual testing that led to me filing this bug, I don't think I saw the errors until I had added a child page to the book.
In any case, when adding a test for a book, please also make a "test-only" patch (without the bug fix code change) and upload it separately, so that we can verify that the test (without the code patch) fails in such a way that it is actually testing the reported bug.
Thanks!
Comment #7
azinck CreditAttribution: azinck commentedNo problem. Here's the test only.
Comment #9
azinck CreditAttribution: azinck commented5: d8-route-book-render-2250325-5.patch queued for re-testing.
Comment #10
azinck CreditAttribution: azinck commentedComment #11
jhodgdonExcellent! The test-only patch failed exactly like my issue report.
I'm re-uploading the patch in #5, which is RTBC.
Comment #12
webchickGreat work!
Committed and pushed to 8.x. Thanks!