PHP Cookbook, Second Edition by Adam Trachtenberg, David Sklar The unconfirmed error reports are from readers. They have not yet been approved or disproved by the author or editor and represent solely the opinion of the reader. Here's a key to the markup: [page-number]: serious technical mistake {page-number}: minor technical mistake : important language/formatting problem (page-number): language change or minor formatting problem ?page-number?: reader question or request for clarification This page was updated July 9, 2008. UNCONFIRMED errors and comments from readers: (2) 7th paragraph; "followed by semicolon a to end the statement" should read "followed by a semicolon to end the statement" [43] 3rd line of code; While the general algorithm is correct, implementing the loop with foreach will not guarantee that the $distribution array will be accessed from lowest to highest, resulting in incorrect weighting. (105) last sentence; A piece of text from the Discussion section of section 4.3 seems to have been accidentally copied to the Discussion section of 4.2. Starts with "In PHP 5.0.0 and above..." [116] example 4.1; This concerns Example 4.1 on page 116 of edition II. Since 'switch' executes the statements that follow, dare I say, on a 'case' by 'case' basis, one would really need to 'break' out of each case individually - unless that's not the desired effect, of course. {222}near top of page; In order to illustrate using instanceof against an interface, the line: if ($book instanceof Book) { should read: if ($book instanceof Nameable) { {256} Addition to the code on this page -- addition to my previous errata (below, p.257); I also had to strip the slashes before displaying as well so $text = wikiLinks($text); // Display the page echo $text; becomes $text = wikiLinks($text); $text = (get_magic_quotes_gpc())?stripslashes($text):$text; // Display the page echo $text; {257} Addition to the code on this page; This isn't a mistake as such but I believe that it is a very necessary addition. The tiny wiki program is an excellent starting point for a cms system. However, a php novice will be frustrated at the rapid proliferation of backslashes that the entries accumulate due to magic quotes. Most php implementations now have magic quotes enabled by default so this must be dealt with in the code. I found that, to eliminate the slashes, I needed to call strip_slashes in the editing module after fetching the page contents: In function edit($page, $isNew = false) just after getting the contents to edit, strip the slashes: $1',$grafs[$i]); should be: '$0',$grafs[$i]); {338} Both code listings; The line $tokenstr = (str) date('W') . $salt; is attempting to type cast the date() function's return value as a string, but the syntax is incorrect. (str) should instead be (string): $tokenstr = (string) date('W') . $salt; Furthermore, this type casting is unnecessary because 1. date() returns a string 2. Concatenating date()'s return value with the $salt variable will also return a string. This typo/error appears in both code listings on that page. [352] Paragraph Solution; in regular expression, part for not permitting spaces in email has to be [^@\ ] in stead of [^@\s]. Your favorite pattern does not allow the s character! {354} whole chapter?; The downloaded examples for chapter 12 contain the XML output instead of the PHP code. I assume that wasn't intentional? [443] bottom; Didn't close your array. {520} below second paragraph; % php -r 'print strftime("%c");' generates an error at the commandline in Windows (XP with PHP 5.0). Only works for me if I type it as php -r "print strftime('%c')"; with the semi colon outside the quotes.