cvs: pear /DB package.xml /DB/DB common.php

From: Date: Mon, 28 Feb 2005 18:37:31 +0000
Subject: cvs: pear /DB package.xml /DB/DB common.php
Groups: php.pear.cvs 
Request: Send a blank email to pear-cvs+get-29928@lists.php.net to get a copy of this message
danielc Mon Feb 28 13:37:31 2005 EDT Modified files: /pear/DB package.xml /pear/DB/DB common.php Log: * __sleep() should not call disconnect(). Also store connection state in the new $was_connected property. This resolves Bug 3594 that was introduced in 1.7.0RC1. http://cvs.php.net/diff.php/pear/DB/package.xml?r1=1.173&r2=1.174&ty=u Index: pear/DB/package.xml diff -u pear/DB/package.xml:1.173 pear/DB/package.xml:1.174 --- pear/DB/package.xml:1.173 Sun Feb 27 20:43:24 2005 +++ pear/DB/package.xml Mon Feb 28 13:37:30 2005 @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="ISO-8859-1" ?> <package version="1.0"> - <!-- $Id: package.xml,v 1.173 2005/02/28 01:43:24 danielc Exp $ --> + <!-- $Id: package.xml,v 1.174 2005/02/28 18:37:30 danielc Exp $ --> <name>DB</name> <summary>Database Abstraction Layer</summary> <description> @@ -73,6 +73,12 @@ To view the majority of changes since 1.6.8, see the changelog for Release 1.7.0RC1. +all: +* __sleep() should not call disconnect(). + Also store connection state in the new + $was_connected property. This resolves + Bug 3594 that was introduced in 1.7.0RC1. + fbsql: * Handle more error codes: + 239 => DB_ERROR_TRUNCATED. http://cvs.php.net/diff.php/pear/DB/DB/common.php?r1=1.132&r2=1.133&ty=u Index: pear/DB/DB/common.php diff -u pear/DB/DB/common.php:1.132 pear/DB/DB/common.php:1.133 --- pear/DB/DB/common.php:1.132 Tue Feb 22 01:23:26 2005 +++ pear/DB/DB/common.php Mon Feb 28 13:37:31 2005 @@ -20,7 +20,7 @@ * @author Daniel Convissor <danielc@php.net> * @copyright 1997-2005 The PHP Group * @license http://www.php.net/license/3_0.txt PHP License 3.0 - * @version CVS: $Id: common.php,v 1.132 2005/02/22 06:23:26 danielc Exp $ + * @version CVS: $Id: common.php,v 1.133 2005/02/28 18:37:31 danielc Exp $ * @link http://pear.php.net/package/DB */ @@ -64,6 +64,13 @@ var $fetchmode_object_class = 'stdClass'; /** + * Was a connection present when the object was serialized()? + * @var bool + * @see DB_common::__sleep(), DB_common::__wake() + */ + var $was_connected = null; + + /** * The most recently executed query * @var string */ @@ -132,37 +139,37 @@ // {{{ __sleep() /** - * Automatically disconnects from the database and indicates which - * properties should be saved When PHP's serialize() function is called + * Automatically indicates which properties should be saved + * when PHP's serialize() function is called * * @return array the array of properties names that should be saved */ function __sleep() { if ($this->connection) { - $this->disconnect(); - $this->connection = true; + // Don't disconnect(), people use serialize() for many reasons + $this->was_connected = true; } else { - $this->connection = false; + $this->was_connected = false; } if (isset($this->autocommit)) { return array('autocommit', - 'connection', 'dbsyntax', 'dsn', 'features', 'fetchmode', 'fetchmode_object_class', 'options', + 'was_connected', ); } else { - return array('connection', - 'dbsyntax', + return array('dbsyntax', 'dsn', 'features', 'fetchmode', 'fetchmode_object_class', 'options', + 'was_connected', ); } } @@ -181,7 +188,7 @@ */ function __wakeup() { - if ($this->connection) { + if ($this->was_connected) { $this->connect($this->dsn, $this->options); } }

« previous php.pear.cvs (#29928) next »