php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Return to Bug #63176
Patch bug63176.patch revision 2012-09-28 02:47 UTC by laruence@php.net

Patch bug63176.patch for PDO related Bug #63176

Patch version 2012-09-28 02:47 UTC

Return to Bug #63176 | Download this patch
Patch Revisions:

Developer: laruence@php.net

diff --git a/ext/pdo/pdo_dbh.c b/ext/pdo/pdo_dbh.c
index acdc0dd..99be801 100755
--- a/ext/pdo/pdo_dbh.c
+++ b/ext/pdo/pdo_dbh.c
@@ -281,19 +281,23 @@ static PHP_METHOD(PDO, dbh_constructor)
 		pdo_dbh_t *pdbh = NULL;
 
 		if (SUCCESS == zend_hash_index_find(Z_ARRVAL_P(options), PDO_ATTR_PERSISTENT, (void**)&v)) {
-			if (Z_TYPE_PP(v) == IS_STRING && !is_numeric_string(Z_STRVAL_PP(v), Z_STRLEN_PP(v), NULL, NULL, 0) && Z_STRLEN_PP(v) > 0) {
-				/* user specified key */
-				plen = spprintf(&hashkey, 0, "PDO:DBH:DSN=%s:%s:%s:%s", data_source,
-						username ? username : "",
-						password ? password : "",
-						Z_STRVAL_PP(v));
-				is_persistent = 1;
+			if (dbh->std.ce == pdo_dbh_ce) {
+				if (Z_TYPE_PP(v) == IS_STRING && !is_numeric_string(Z_STRVAL_PP(v), Z_STRLEN_PP(v), NULL, NULL, 0) && Z_STRLEN_PP(v) > 0) {
+					/* user specified key */
+					plen = spprintf(&hashkey, 0, "PDO:DBH:DSN=%s:%s:%s:%s", data_source,
+							username ? username : "",
+							password ? password : "",
+							Z_STRVAL_PP(v));
+					is_persistent = 1;
+				} else {
+					convert_to_long_ex(v);
+					is_persistent = Z_LVAL_PP(v) ? 1 : 0;
+					plen = spprintf(&hashkey, 0, "PDO:DBH:DSN=%s:%s:%s", data_source,
+							username ? username : "",
+							password ? password : "");
+				}
 			} else {
-				convert_to_long_ex(v);
-				is_persistent = Z_LVAL_PP(v) ? 1 : 0;
-				plen = spprintf(&hashkey, 0, "PDO:DBH:DSN=%s:%s:%s", data_source,
-						username ? username : "",
-						password ? password : "");
+				php_error_docref(NULL TSRMLS_CC, E_NOTICE, "%s", "could not using persistent connection on a derived PDO class");
 			}
 		}
 
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Nov 21 11:01:29 2024 UTC