summaryrefslogtreecommitdiff
path: root/ext/pdo/php_pdo_driver.h
diff options
context:
space:
mode:
authorXinchen Hui <laruence@gmail.com>2015-08-30 05:02:13 -0700
committerXinchen Hui <laruence@gmail.com>2015-08-30 05:02:38 -0700
commitef1bd8f0e6f88b1d123cea1c0b5079cfde7f90df (patch)
treee78a20e0353ecb1c76bda4169a98c2099981da11 /ext/pdo/php_pdo_driver.h
parent00eebd7a477f8076a5fbb4712f380c8214952bdf (diff)
downloadphp-git-ef1bd8f0e6f88b1d123cea1c0b5079cfde7f90df.tar.gz
Fixed bug #70389 (PDO constructor changes unrelated variables)
Diffstat (limited to 'ext/pdo/php_pdo_driver.h')
-rw-r--r--ext/pdo/php_pdo_driver.h14
1 files changed, 12 insertions, 2 deletions
diff --git a/ext/pdo/php_pdo_driver.h b/ext/pdo/php_pdo_driver.h
index d651345678..44082df498 100644
--- a/ext/pdo/php_pdo_driver.h
+++ b/ext/pdo/php_pdo_driver.h
@@ -197,7 +197,12 @@ static inline long pdo_attr_lval(zval *options, enum pdo_attribute_type option_n
zval **v;
if (options && SUCCESS == zend_hash_index_find(Z_ARRVAL_P(options), option_name, (void**)&v)) {
- convert_to_long_ex(v);
+ if (Z_TYPE_PP(v) != IS_LONG) {
+ zval tmp = **v;
+ zval_copy_ctor(&tmp);
+ convert_to_long(&tmp);
+ return Z_LVAL(tmp);
+ }
return Z_LVAL_PP(v);
}
return defval;
@@ -207,7 +212,12 @@ static inline char *pdo_attr_strval(zval *options, enum pdo_attribute_type optio
zval **v;
if (options && SUCCESS == zend_hash_index_find(Z_ARRVAL_P(options), option_name, (void**)&v)) {
- convert_to_string_ex(v);
+ if (Z_TYPE_PP(v) != IS_STRING) {
+ zval tmp = **v;
+ zval_copy_ctor(&tmp);
+ convert_to_string(&tmp);
+ return Z_STRVAL(tmp);
+ }
return estrndup(Z_STRVAL_PP(v), Z_STRLEN_PP(v));
}
return defval ? estrdup(defval) : NULL;