Wrox Programmer Forums
| Search | Today's Posts | Mark Forums Read
BOOK: Professional PHP 5 ISBN: 978-0-7645-7282-1
This is the forum to discuss the Wrox book Professional PHP5 by Ed Lecky-Thompson, Heow Eide-Goodman, Steven D. Nowicki, Alec Cove; ISBN: 9780764572821
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Professional PHP 5 ISBN: 978-0-7645-7282-1 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
  #1 (permalink)  
Old March 1st, 2005, 03:00 PM
Registered User
 
Join Date: Feb 2005
Location: , , .
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Default Errata

I'm going to keep an updated list of errors I run into, so I (and other people) have an easy place to reference to. Unlike the actual errata page, this will contain something. I haven't read the book straight through, nor have I tested everything, so anyone else feel free to add anything.



[u]06.25.2005 </u>
Chapter 11 - class.LoggerBackend.php & class.fileLoggerBackend.php

It will complain because class.fileLoggerBackend.php's implementation of the logMessage() is not done in the same way as in class.LoggerBackend.php (the class it extends). You can simply change one method to match the other.

original:

class.fileLoggerBackend.php:
Code:
public function logMessage($msg, $logLevel = LOGGER_INFO, $module = null)
class.LoggerBackend.php:
Code:
abstract function logMessage($message, $logLevel = LOGGER_INFO, $module)
corrected:

class.fileLoggerBackend.php:
Code:
public function logMessage($msg, $logLevel = LOGGER_INFO, $module = null)
class.LoggerBackend.php:
Code:
abstract function logMessage($message, $logLevel = LOGGER_INFO, $module = null)
Chapter 11 - newclass.Logger.php

Code:
private static function manageBackends($name, LoggerBackend $objBack = null)
can be changed to the following:
Code:
private static function manageBackends($name, $objBack = null)
It will complain about the argument not being of the right type.


Chapter 5 - class.Collection.php

Fatal error: Call to private method NightClub::_loadSingers() from context 'Collection' in d:\web\book\ch05\class.Collection.php on line 91

To fix this, change the _loadSingers function from private to public in the NightClub class (ie public function _loadSingers(Collection $col))

Correction from eggspencer


[u]03.01.2005 </u>
Chapter 13 - constraint.phpm
original:
Code:
function GetConstraintType() {
    return($this->_intContraintType);
}
corrected:
Code:
function GetConstraintType() {
    return($this->_intConstraintType);
}
Chapter 13 - request.phpm
original:
Code:
function GetPostVariables() {
    return($this->_arPostVariables);
}
function GetGetVariables() {
    return($this->_arGetVariables);
}
corrected:
Code:
function GetPostVariables() {
    return($this->_arPostVars);
}
function GetGetVariables() {
    return($this->_arGetVars);
}
  #2 (permalink)  
Old April 18th, 2005, 06:32 AM
Registered User
 
Join Date: Apr 2005
Location: , , .
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default

The book is interested but.......

I'm looking at chapter 15 Sessions and Authentification

Changes made so far to make my code work
In usersession.phpm
Change 1
# $strUserAgent = $GLOBALS["HTTP_USER_AGENT"];
# changed to _SERVER
$strUserAgent = $_SERVER["HTTP_USER_AGENT"];

this also needs changing further down in the script

Change 2
usersession.phpm
$maxlifetime is called but not defined in __construct so
$maxlifetime = $this->session_lifespan;

Change 3
usersession.phpm
also in __construct
this sql is wrong
DELETE FROM \"user_session\" WHERE (ascii_session_id = '". $this->php_session_id . "') OR (now() - created) > '".$maxlifetime."')
its missing a (
CORRECT it should be
DELETE FROM \"user_session\" WHERE (ascii_session_id = '". $this->php_session_id . "') OR ( (now() - created) > '".$maxlifetime."')

Extra in the tables sql they don't insert the user
INSERT INTO "user"(username,md5_pw,first_name,last_name) VALUES ('ed', '827ccb0eea8a706c4c34a16891f84e7b', 'Ed', 'Lecky-Thompson');

After these changes it now works at least but I still get at the bottem of my script the following ???
Fatal error: Call to private method UserSession::_session_write_method() from context '' in Unknown on line 0

Warning: Unknown: A session is active. You cannot change the session module's ini settings at this time. in Unknown on line 0

PS this was the case running on a local testing maching with WindowsXP pro

  #3 (permalink)  
Old April 26th, 2005, 11:44 AM
Registered User
 
Join Date: Apr 2005
Location: , , .
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I caught/fixed the same errors in the script and had the same entries in error_log:

Fatal error: Call to private method UserSession::_session_write_method() from context '' in Unknown on line 0

Warning: Unknown: A session is active. You cannot change the session module's ini settings at this time. in Unknown on line 0

Running on a remote testing maching with PHP5

  #4 (permalink)  
Old April 27th, 2005, 04:32 AM
Registered User
 
Join Date: Apr 2005
Location: , , .
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Chapter 3 - entities.sql - 27APRIL2005
Original
CREATE TABLE "entities" (
Corrected
CREATE TABLE "entity" (
Reason
Foreign key in other tables need to refer to it.

Chapter 5 - class.StudentFactory.php - 27APRIL2005
Original
\"course\".\"id\"
Corrected
\"course\".\"courseid\"
Reason
mismatched field name

Chapter 5 - class.Student.php - 28APRIL2005
Original
$arCourses = StudentFactory::get...
Corrected
$courses = StudentFactory::get...
Reason
mismatched variable name
  #5 (permalink)  
Old April 27th, 2005, 10:16 AM
Registered User
 
Join Date: Apr 2005
Location: Berlin, , Germany.
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Quote:
quote:Originally posted by smorse@rtpi.org
 I caught/fixed the same errors in the script and had the same entries in error_log:

Fatal error: Call to private method UserSession::_session_write_method() from context '' in Unknown on line 0

Warning: Unknown: A session is active. You cannot change the session module's ini settings at this time. in Unknown on line 0

Running on a remote testing maching with PHP5

If somebody solves this problem, please let me know. Bye the way, do the writers of this book read this forum? Or do we have to wait and wait and wait ....

  #6 (permalink)  
Old April 30th, 2005, 03:34 PM
Registered User
 
Join Date: Apr 2005
Location: , , .
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Change the functions "_session_write_method" and "_session_close_method" to public and it works. Not ideal but it will keep you moving...

  #7 (permalink)  
Old September 6th, 2005, 06:55 AM
Registered User
 
Join Date: Sep 2005
Location: , , .
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Re CH15 Sessions, it's a nice idea, but the code is just crap, even after the fixes suggested here. The table "session_variable" is never populated, and each time I refresh the page a new user session is created (ie the first line of usersessiontest.php always comes up with "Logged in?... No" even though I comment out the logout call).

You would think someone publishing and releasing code in a book titled "Professional" anything, would at least provide working and tested code that would be close to production ready as possible. If the authors read this maybe they can spare some time from counting their money from the sales of the book and provide a professional working version of the usersession class that would be a truer reflection of the book's intentions.
  #8 (permalink)  
Old October 6th, 2005, 09:21 AM
Registered User
 
Join Date: Oct 2005
Location: , , .
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default

As for the Ch15, I modified the code and it works fine. However, I didn't like that I had to change methods "_session_write_method" and "_session_close_method" from 'private' to 'public', as all the other methods of session handler can be 'private'. I didn't also like that I couldn't find the reason of this problem. Has anyone fixed it?



Similar Threads
Thread Thread Starter Forum Replies Last Post
Errata vidyar_rajan Beginning PHP 0 August 31st, 2006 05:37 AM
Errata DaveSussman BOOK: Beginning ASP.NET 2.0 BOOK VB ISBN: 978-0-7645-8850-1; C# ISBN: 978-0-470-04258-8 0 November 6th, 2005 07:35 PM
Errata edsmithed BOOK: Professional Java Development with the Spring Framework 4 August 9th, 2005 04:32 PM
Errata ursjenzer BOOK: Professional Assembly Language 0 July 5th, 2005 09:05 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.