Errata

Learning PHP, MySQL, JavaScript, and CSS

Errata for Learning PHP, MySQL, JavaScript, and CSS

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
ePub Page Example 21-8
image functions

The following code, when copied into PHPStorm IDE:

imageconvolution($tmp, array(array(−1, −1, −1),
array(−1, 16, −1), array(−1, −1, −1)), 8, 0);

produces the errors:

Expected: )
Expected: semicolon
Expecting statement
Required parameter $div missing
Invocation parameter types are not compatible with declared.

Expected: )
Expected: semicolon
Expecting statement

Typing the code in manually does not produce errors, but the images are not displaying when testing the complete social network. The difference seems to be in the '−' used, which is slightly different than the '-' character produced using the minus key on my keyboard. Could you explain what this is and why it isn't working? I have checked all of the code for chapter 21, manually entering it and copying it all, to ensure it matches exactly. This is the only file showing an error.

Zach Pierce  Nov 19, 2013 
Other Digital Version this updated Chapter 2
this updated Chapter 2

Zend Server Free Edition is no longer free. You can download a free trial that lasts for 30 days.

Anonymous  Aug 02, 2015 
1
12-3 exercise

at chapter 12, I have completed some exercise that is 12-1 and 12-2 to but in 12-3, I got one error.
For some days I have tried so much programs for that, but I can't completed it.
It gives me some error about --
undefined variable $db_hostname, $db_database, $db_username, $db_password..

swsm  Aug 17, 2021 
ePub Page 169
3rd paragraph on kindle cloud reader

shouldn't there be a command like

create user 'stephen'@'localhost' identified by 'passwd';

?

i received a syntax error when i tried to issue a grant all command without having first created the user

Server version: 5.5.32 MySQL Community Server (GPL)

thanks

Anonymous  Aug 26, 2014 
Printed Page 220-221
Using BEGIN, using COMMIT, and using ROLLBACK paragraphs

When a transaction begins, autocommit is set to 1 (true) by default. As a result, you don't need to execute COMMIT after a transaction, and ROLLBACK cannot affect the result. This is something that should be noted somewhere in these three paragraphs and the corresponding examples.

Nikos Karagiannakis  Jan 31, 2015 
Printed Page 257
Figure 11-2

Figure 11-2 shows results from formtest2.php script, but the browser screen grab indicates it is from formtest.php script. Also, "Figure 11-2. formtest.php with data handling" should be changed to "Figure 11-2. formtest2.php with data handling."

Michael Kendall  Apr 28, 2014 
Printed Page 278-285
Examples 12-1 12-2 and 12-4

It seems that HTTP authentication is not working on the Zend WAMP server set up using the default settings outlined in chapter 2.

Nathan Selvidge  Feb 22, 2014 
Printed Page 320
Example 14-12

In the "try" clause, the mixed capitalization of XMLHttpRequest of is not correct (it is correct in the comment in the "catch" clause). In both locations, it should be "XMLHttpRequest". The error persists in the example (2/27/2009) that can be downloaded from http://lpmj.net, although the comment line is different that in the printed book.

Great book!

David Seidel  Apr 02, 2014 
Printed Page 377
United Kingdom

Whilst running example 17-2 urlpost.html in Chrome the page refused to load.

Looking in DevTools showed the errors:

Refused to set unsafe header 'Content-length'
and
Refused to set unsafe header 'Connection'

When I commented out these lines the oreilly page loaded.

Comments from a search of the issue seem to suggest that the browser should be left to decide these values.

Could you please clarify?

David Winstanley  Jun 05, 2014 
Printed Page 494
Example 21-12. logout.php

When logging out from the social networking site, a warning message is shown on the page:

Warning: Cannot modify header information - headers already sent by (output started at <path>/header.php:3) in <path>/functions.php on line 28

This seems to be because header.php starts by outputting the start of the page, which happens before logout.php calls the destroySession function in functions.php, which in turn tries to use the setCookie statement.

A simple fix I found was to add the line "ob_start();" before the include line in logout.php, and the line "ob_end_flush();" as the last PHP line in the same file, i.e. just before the "?>" line. This way, all output to the page is held back, so the HTTP headers are not forced to be output until all the PHP has been executed, including the setCookie statement.

Niels Bache  Apr 18, 2014 
Other Digital Version 684
2nd and 3rd paragraphs

(5th edition on Kindle)

In both paragraphs, an empty <span> with an id of info is mentioned. I am unable to find this in the code which I downloaded from github.

*** ALSO ***

often, throughout the book when code examples are shown, certain parts of the code are supposed to be in bold type for emphasis, but they are not.

some of the code for me simply fails I believe this is because of the function

get_magic_quotes_gpc()

which finds its way into much of the code. According to

https://www.php.net/manual/en/function.get-magic-quotes-gpc.php

"This function has been DEPRECATED as of PHP 7.4.0, and REMOVED as of PHP 8.0.0. Relying on this function is highly discouraged."

This may be ok for 5th edition, but it remains in the github code for 6th edition, which (I don't own) I see from the cover is updated fro PHP 8.

Anonymous  Dec 28, 2021 
ePub Page 698
Example 17-2 and 17-3

Hi,

I'm having real problems with the first example application in Chapter 17.

I've tried typing the examples in myself and also using the examples downloaded from the website, and I'm getting the same errors both ways round.

The first error I'm getting is 'Refused to set unsafe header "Content-length"' and 'Refused to set unsafe header "Connection"' on lines 11 and 12 of urlpost.htm.

This is the error as thrown by Chrome, and I've also tried it in IE and it's not working either.

A quick Google seems to suggest that directly accessing Content-length and Connection in the header is no longer accepted practice due to security reasons, which doesn't necessarily make this an error in the book, but does cause problems.

The second error being thrown is 'XMLHttpRequest cannot load [file:/blah blah blah]urlpost.php Cross origin requests are only supported from HTTP'

Again, perhaps this is down to a change in the way this is supported, but is preventing this from running properly.

Nathan Woods  Mar 25, 2014