Errata
This page lists any code errors found since publication.
Chatper 2: Listing 2-2
Summary: The Windows Apache configuration incorrectly says AllowOverride None, meaning that directives in the .htaccess are not obeyed
Solution: Change to AllowOverride All.
Chapter 4: Listing 4-2
Summary: The return value from usernameExists() is incorrect.
Solution: Change the return value so it doesn't reference the num key. Also removed num alias from query (not required when using fetchOne()).
public function usernameExists($username)
{
$query = sprintf('select count(*) from %s where username = ?',
$this->_table);
$result = $this->_db->fetchOne($query, $username);
return $result > 0;
}
Chapter 6: Listing 6-3
Summary: When using Zend Framework 1.0.3 URLs will be generated beginning with 2 slashes.
Solution: Trim extra slashes from the beginning of the return value.
public function getUrl($action = null, $controller = null)
{
$url = rtrim($this->getRequest()->getBaseUrl(), '/') . '/';
$url .= $this->_helper->url->simple($action, $controller);
return '/' . ltrim($url, '/');
}
Chapter 6: Listing 6-4
Summary: This is the same problem as above, but in the Smarty plug-in created for URL generation.
Solution: Trim extra slashes from the beginning of the return value.
return '/' . ltrim($url, '/');
Chapter 6: Page 194
Summary: In the body style selector, the min-width attribute is set to 600px, whereas it's 300px in the final stylesheet.
Chapter 12: Listing 12-22
Summary: If a search is not performed then the $users array is not defined, causing a PHP warning when it is assigned to the view.
Solution: Define the array in the catch block.
catch (Exception $ex) {
// no search performed or an error occurred
$users = array();
}