Errata

Upgrading to PHP 5

Errata for Upgrading to PHP 5

Submit your own errata for this product.

The errata list is a list of errors and their corrections that were found after the product was released.

The following errata were submitted by our customers and have not yet been approved or disproved by the author or editor. They solely represent the opinion of the customer.

Color Key: Serious technical mistake Minor technical mistake Language or formatting error Typo Question Note Update

Version Location Description Submitted by Date submitted
Printed Page 11
Last Code Block

class Person {
setName($name) {...
should be:

class Person {
function setName($name) {.

Anonymous   
Printed Page 18
in the 6th paragraph

sendEmailTo function should be using the parameter $rasmus2 rather
than the quoted $rasmus

Anonymous   
Printed Page 27
last code block (end of para 8)

The decimal separator should be a full stop, not a comma. The thousands separator
should be a comma, not a full stop.

Anonymous   
Printed Page 28
code example at bottom of page

Reusing an existing connection doesn't make sense unless it's for the same ($server,$username,$password).

Anonymous  Sep 22, 2009 
Printed Page 32
last paragraph

It is quite possible (and useful) to create an abstract class without any abstract
methods. At least it works. Can't find any other resource that supports your
statement that "Abstract classes must contain at least one method that is also marked
abstract". Please correct me if I'm wrong.

Anonymous   
Printed Page 33
First code block (3rd para)

The methods in the extension class have parameters, the methods in the abstract class
do not. The extension class produces a fatal error.

Anonymous   
Printed Page 36
examples at top and middle of page

ALL references to diameter should be to circumference.
diameter is 2 * radius
circumference is 2 * pi * radius

Anonymous   
Printed Page 36
Code starting at Top and repeated in middle of page

perimeter, not diameter, is defined by 2*pi*radius

Anonymous   
Printed Page 50
Procedural Interface section

The example code uses mysql_fetch_array, while the last paragraph of the section refers to mysql_fetch_assoc.

Anonymous  Nov 20, 2014 
Printed Page 56
last paragraph

"It's vital not to omit the three lines at the top."
This could easily be taken to mean the lines under 'User-entered data'.

It would be better to say "... the three lines after 'Escape data'."

Anonymous  Sep 27, 2009 
Printed Page 62-63
Example 3-4

This may not be a problem, but in your example 3-4 stmt_bind_result is carried out before
stmt_bind_execute.

I'm using your book to move to PHP5 and I tried your example (bind then execute then fetch) and it works
OK. On checking something in the online manual (http://uk3.php.net/manual/en/function.mysqli-stmt-bind-
result.php) I notice that it says explicitly in a note that bind should be carried out AFTER execute and
BEFORE fetch.

This works fine as well on my simple test example.

But there must be a reason for the online manual (which is usually bomb-proof) saying what it does.

Anonymous   
Printed Page 63
first and second code examples

regarding stmt->bind_result.

The php.net online documentation state that stmt->bind_result() sould be issued EFTER bind_result and
BEFORE any stmt->fetch() commands.

Anonymous   
Printed Page 83
2nd paragraph

Change
ssl_set()
to
mysqli_ssl_set()

Anonymous  Sep 27, 2009 
Printed Page 94
near bottom

Where it says:
... the preceding code would print:
Array (
[0] => rasmus
[username] => rasmus
)
that assumes that the body of the while-loop in the preceding code is:
print_r($row);
rather than just:
// do something with $row

Anonymous  Sep 27, 2009 
Printed Page 95
Paragraph beginning "This is the most efficient"

"However, you can't use [sqlite_unbuffered_query] with sqlite_num_row() or any function that needs to know the "current" location within the result set."

Except that clearly you can use it with sqlite_fetch_array, which has to know the "current" location within the result set. So it's unclear what the sentence means, or which functions it's referring to.

Anonymous  Sep 29, 2009 
Printed Page 99
last para of "Object Iterators"

"Since you rarely take advantage of the additional benefits provided by query(), ..."

But there's no description of what those additional benefits are, so I don't know when I /need/ to use query().

Anonymous  Sep 29, 2009 
Printed Page 110
Example 4-4

Example 4-4 supposedly re-implements the preceding example, but it sorts primarily by count, which the preceding example does not. Rather, it appears to be closer to the query in the middle of page 111.

Anonymous  Sep 29, 2009 
Printed Page 111
3rd para

"host_host" should be "host_sort".

Anonymous  Sep 29, 2009 
Printed Page 111
2nd-last para

"reverse(host)" should be "reverse(clean_host)"

Anonymous  Sep 29, 2009 
Printed Page 113
two examples in Binary Data

The function names "udf_function_encode" and "udf_function_decode" are misleading:

"udf_function_encode" suggests that its job is to encode its arg, whereas in fact it decodes its arg.

"udf_function_decode" suggests that its job it to decode its arg, whereas all we see it do is encode a return value.

A better name (for both) would be something generic like "my_udf".

Anonymous  Sep 29, 2009 
Printed Page 138
last paragraph

Adam states "xpath() returns SimpleXML objects, ..."

But in my experience and testing xpath() returns arrays.

Using Adam's example:
-------------------------
$s = simplexml_load_file('address-book.xml');
$people = $s->xpath('/address-book/person');

echo gettype($people)."

";

---------------------------
result is "array"

Anonymous   
Printed Page 261
code example

If the constructor is passed an array as an argument, each element of the array is copied into a separate class property with the appropriate name. But such class properties are never used again. Everywhere else, the data contents of the class are kept and used as elements of the $data array, not as their own separate properties.

Anonymous  Apr 13, 2009 
Printed Page 266
1

class addressBook implements IteratorAggregate{

}

This class implements IteratorAggregate but the author does not include the required function:

public function getIterator()
{
return new ArrayObject($this->data);
}
this results in an abstract class error failure to implement all methods. He wrote the method on page
263 and mentioned that it was required, but it wasn't in the addressBook class

Anonymous