cvs: php4 /pear/DB mysql.php
| From: | Stig Bakken | Date: | Wed, 03 Apr 2002 11:32:34 +0000 |
| Subject: | cvs: php4 /pear/DB mysql.php | ||
| Groups: | php.pear.cvs | ||
| Request: | Send a blank email to pear-cvs+get-3000@lists.php.net to get a copy of this message | ||
ssb Wed Apr 3 06:32:34 2002 EDT
Modified files:
/php4/pear/DB mysql.php
Log:
* work around a php segfault
Index: php4/pear/DB/mysql.php
diff -u php4/pear/DB/mysql.php:1.89 php4/pear/DB/mysql.php:1.90
--- php4/pear/DB/mysql.php:1.89 Thu Feb 28 03:27:10 2002
+++ php4/pear/DB/mysql.php Wed Apr 3 06:32:34 2002
@@ -16,7 +16,7 @@
// | Author: Stig Bakken <ssb@fast.no> |
// +----------------------------------------------------------------------+
//
-// $Id: mysql.php,v 1.89 2002/02/28 08:27:10 sebastian Exp $
+// $Id: mysql.php,v 1.90 2002/04/03 11:32:34 ssb Exp $
//
// Database independent query interface definition for PHP's MySQL
// extension.
@@ -80,6 +80,7 @@
1100 => DB_ERROR_NOT_LOCKED,
1136 => DB_ERROR_VALUE_COUNT_ON_ROW,
1146 => DB_ERROR_NOSUCHTABLE,
+ 1048 => DB_ERROR_CONSTRAINT,
);
}
@@ -325,12 +326,23 @@
return mysql_free_result($result);
}
- if (!isset($this->prepare_tokens[(int)$result])) {
+ $result = (int)$result; // $result is a prepared query handle
+ if (!isset($this->prepare_tokens[$result])) {
return false;
}
- unset($this->prepare_tokens[(int)$result]);
- unset($this->prepare_types[(int)$result]);
+ // [ssb]: WTF? unset($this->prepare_types[$result]) makes PHP
+ // crash on my laptop (4.1.2 as well as 4.3.0-dev)
+
+ $copy = $this->prepare_types;
+ unset($copy[$result]);
+ $this->prepare_types = $copy;
+// unset($this->prepare_types[$result]);
+
+ $copy = $this->prepare_tokens;
+ unset($copy[$result]);
+ $this->prepare_tokens = $copy;
+// unset($this->prepare_tokens[$result]);
return true;
}
@@ -643,7 +655,8 @@
$errno = $this->errorCode(mysql_errno($this->connection));
}
return $this->raiseError($errno, null, null, null,
- @mysql_error($this->connection));
+ @mysql_errno($this->connection) . " ** " .
+ @mysql_error($this->connection));
}
// }}}