Go To Homepage



Book Details
Pro PHP: Patterns, Frameworks, Testing and More book cover
  • By Kevin McArthur
  • ISBN13: 978-1-59059-819-1
  • ISBN10: 1-59059-819-9
  • 349 pp.
  • Published Mar 2008
  • Print Book Price: $49.99
  • eBook Price: $34.99



Errata Submission

If you think that you've found an error in Pro PHP: Patterns, Frameworks, Testing and More, please let us know about it. You will find any confirmed erratum below, so you can check if your concern has already been addressed.

Submit Errata
Pro PHP: Patterns, Frameworks, Testing and More (978-1-59059-819-1)

Errata

Issue Author's Response
Ch. 19, page 288, in listing line 14 beginning with <port name="DemoPort"... there should be ...binding="tns:DemoBinding" instead of ...binding="DemoBinding" to pass the WDSL validator. Both cases works for me if I use PHP SOAP extension, but some of my colleges reported some issues if they used non-PHP SOAP. The code in the book works as tested.... I'd need more information to determine any incompatibilities. I've tested the code against php's soap ext, apache axis, and ms .net web services -- all work without the tns: However, both the binding name and the reference to the binding should be the same. This works because xmlns:tns is defined in the definitions already, and is implied as default. Either way will work, just be consistent with the use of tns: on names.
Page 224, "Reloading the page should result in a stylish listing of the customers table".

You never mentioned appending "customers" to the URL. Reloading results in "Welcome: Kevin"
Pg 224 should read "Loading /customers should..."
private function __clone() {}; should be private function __clone() {} i.e. minus the end semi-colon

Chp. 14, pg. 212 I don't think the = is required in the URL .../index/index/name/yourname=
The semi-colon after __clone() {}; is not required.

Pg 212... = is not required in the url.
Chapter 9, page 139, listing 9-15
The function spl_autoload_call('Demo') return void. so the usage "if(spl_autoload_call('Demo')&& class_exists('Demo',false)) " is wrong;
Should be

spl_autoload_call('className');
if(class_exists('className', false)) {
Chapter 3, page 22, listing 3-1

Shouldn't be $_instance also scoped as private and allowed to be accessed only via the getInstance() method?
It could be marked private if you wanted to restrict access, however, leaving it public can allow you to check to see if the class has already been instantiated using something like if(Database::$_instance instanceof Database)
ch3 p22
Listing 3-1. Centralizing Database Connection Responsibility
...
private __clone() {}; //maybe: private function __clone() {};
...
Should be

private function __clone() {};
Chapter 9, Listing 9-7 Page 132

if ($idx = array_search($oserver, $this->observers, true)) {.....}

The problem is that the function array_search can return both an index of 0 or a value of false, index of 0 is ok, while a value of false means it did not find anything.

Should be written like this.

$idx = array_search($oserver, $this->observers, true)

if ($idx === false){ .... }

Hope it helps
The reporter is correct, this method does have a bug if the $observer exists at position 0.

The corrected method looks like:

public function detach(SplObserver $observer) {
$idx = array_search($observer,$this->observers,true);
if($idx !== false) {
unset($this->observers[$idx]);
}
}
Chapter 3, page 22
private function __clone() {};
instead of
private __clone() {};
The reporter is correct, this should be:

private function __clone() {};
Chapter 14, page 212
You shouldn't have a method with the same name as the class. Because of backwards compatibility with PHP 4, this causes that method to be the constructor of the class, which causes it to be called twice in the example framework.
The book is correct. PHP 4 is not supported here, nor is it in the Zend Framework for which this chapter leads in to. There is no PHP 4 compatible code provided throughout this book.
Chapter 15, Page 222

At the bottom of the page you say to insert text (on the following page) before the line containing "Zend_Controller_Front::run" but this line doesn't exist ! Not in the book nor in the samples
The book text is ambiguous, but correct. The form class::method is commonly used to describe a call to a classes method. In the provided index.php, as the submitter offers, the line is actually $front->run(...);
Sorry, not sure what the page number is (I'm accessing via books24x7.com).

Chapter 2: Static Variables, Members, and Methods
Static Variables
After Listing 2-1, it says:
Executing Listing 2-1 produces the following output:

1
2
3

It should say:
Executing Listing 2-1 produces the following output:

2
4
8
On page 12 of the printed book attached to listing 2-1, it does in-fact say 2 4 8... I'm not sure where this 1,2,3 sequence comes from. The book is correct here.
Ch. 3, page 27

Typo in variable name

if ($result = pg_query($query, $this->connecion)) {

should be connection
This should be connection as reported. Thanks.