iliaa Mon Jul 16 18:00:19 2007 UTC
Modified files: (Branch: PHP_5_2)
/php-src/ext/pdo pdo_dbh.c
Log:
Fixed a possible crash inside the constructor
http://cvs.php.net/viewvc.cgi/php-src/ext/pdo/pdo_dbh.c?r1=1.82.2.31.2.14&r2=1.82.2.31.2.15&diff_format=u
Index: php-src/ext/pdo/pdo_dbh.c
diff -u php-src/ext/pdo/pdo_dbh.c:1.82.2.31.2.14
php-src/ext/pdo/pdo_dbh.c:1.82.2.31.2.15
--- php-src/ext/pdo/pdo_dbh.c:1.82.2.31.2.14 Thu Jun 28 19:22:52 2007
+++ php-src/ext/pdo/pdo_dbh.c Mon Jul 16 18:00:18 2007
@@ -18,7 +18,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: pdo_dbh.c,v 1.82.2.31.2.14 2007/06/28 19:22:52 iliaa Exp $ */
+/* $Id: pdo_dbh.c,v 1.82.2.31.2.15 2007/07/16 18:00:18 iliaa Exp $ */
/* The PDO Database Handle Class */
@@ -364,23 +364,9 @@
php_error_docref(NULL TSRMLS_CC, E_ERROR, "out of memory");
}
- if (options) {
- zval **attr_value;
- char *str_key;
- long long_key;
-
- zend_hash_internal_pointer_reset(Z_ARRVAL_P(options));
- while (SUCCESS ==
zend_hash_get_current_data(Z_ARRVAL_P(options), (void**)&attr_value)
- && HASH_KEY_IS_LONG ==
zend_hash_get_current_key(Z_ARRVAL_P(options), &str_key, &long_key, 0)) {
-
- pdo_dbh_attribute_set(dbh, long_key, *attr_value
TSRMLS_CC);
- zend_hash_move_forward(Z_ARRVAL_P(options));
- }
- }
-
if (!call_factory) {
/* we got a persistent guy from our cache */
- return;
+ goto options;
}
if (driver->db_handle_factory(dbh, options TSRMLS_CC)) {
@@ -404,8 +390,22 @@
}
dbh->driver = driver;
+options:
+ if (options) {
+ zval **attr_value;
+ char *str_key;
+ long long_key;
+
+ zend_hash_internal_pointer_reset(Z_ARRVAL_P(options));
+ while (SUCCESS ==
zend_hash_get_current_data(Z_ARRVAL_P(options), (void**)&attr_value)
+ && HASH_KEY_IS_LONG ==
zend_hash_get_current_key(Z_ARRVAL_P(options), &str_key, &long_key, 0)) {
+
+ pdo_dbh_attribute_set(dbh, long_key,
*attr_value TSRMLS_CC);
+ zend_hash_move_forward(Z_ARRVAL_P(options));
+ }
+ }
- return;
+ return;
}
/* the connection failed; things will tidy up in free_storage */
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php