After my hosting provider updated to PHP 5.1.2 (from PHP 5.0.X) book pages stopped displaying the "next" page link at the bottom of the page (the previous page link was still there). I traced the problem to this line in book_next:

array_push($path = book_location($node), $node); // Path to top-level node including this one.

The next links appeared again after breaking the above line like this:

$path = book_location($node);
array_push($path, $node); // could also just write $path[] = $node;
CommentFileSizeAuthor
#3 book.module_15.patch2.36 KBm3avrck

Comments

jo1ene’s picture

+1

I just ran into this problem in conjunction with the civic space theme book navigation issue. I thought it was the theme, but thankfully found this issue in a last ditch search effort.

This fix works.

jo1ene’s picture

Status: Active » Needs review

Sending it to the patch queue.

m3avrck’s picture

Version: 4.6.5 » x.y.z
StatusFileSize
new2.36 KB

Confirmed bug. Here's a patch which fixes this, along with removing some uncessary array_push() which should only be used when you are adding multiple elements to an array. As per PHP.net:

Note: If you use array_push() to add one element to the array it's better to use $array[] = because in that way there is no overhead of calling a function.

Steven’s picture

Status: Needs review » Fixed

Committed to HEAD and 4.6.

Anonymous’s picture

Status: Fixed » Closed (fixed)