summaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
Diffstat (limited to 'ext')
-rw-r--r--ext/mysql/php_mysql.c10
-rw-r--r--ext/mysqli/mysqli.c10
-rw-r--r--ext/pgsql/pgsql.c10
3 files changed, 24 insertions, 6 deletions
diff --git a/ext/mysql/php_mysql.c b/ext/mysql/php_mysql.c
index 580296a3cf..588eaf0539 100644
--- a/ext/mysql/php_mysql.c
+++ b/ext/mysql/php_mysql.c
@@ -2171,8 +2171,14 @@ static void php_mysql_fetch_hash(INTERNAL_FUNCTION_PARAMETERS, long result_type,
ZVAL_COPY_VALUE(&dataset, return_value);
object_and_properties_init(return_value, ce, NULL);
- zend_merge_properties(return_value, Z_ARRVAL(dataset), 0 TSRMLS_CC);
- zval_dtor(&dataset);
+ if (!ce->default_properties_count && !ce->__set) {
+ ALLOC_HASHTABLE(Z_OBJ_P(return_value)->properties);
+ *Z_OBJ_P(return_value)->properties = *Z_ARRVAL(dataset);
+ efree(Z_ARR(dataset));
+ } else {
+ zend_merge_properties(return_value, Z_ARRVAL(dataset) TSRMLS_CC);
+ zval_dtor(&dataset);
+ }
if (ce->constructor) {
fci.size = sizeof(fci);
diff --git a/ext/mysqli/mysqli.c b/ext/mysqli/mysqli.c
index 7684e25765..0d4683102a 100644
--- a/ext/mysqli/mysqli.c
+++ b/ext/mysqli/mysqli.c
@@ -1287,8 +1287,14 @@ void php_mysqli_fetch_into_hash(INTERNAL_FUNCTION_PARAMETERS, int override_flags
ZVAL_COPY_VALUE(&dataset, return_value);
object_and_properties_init(return_value, ce, NULL);
- zend_merge_properties(return_value, Z_ARRVAL(dataset), 0 TSRMLS_CC);
- zval_ptr_dtor(&dataset);
+ if (!ce->default_properties_count && !ce->__set) {
+ ALLOC_HASHTABLE(Z_OBJ_P(return_value)->properties);
+ *Z_OBJ_P(return_value)->properties = *Z_ARRVAL(dataset);
+ efree(Z_ARR(dataset));
+ } else {
+ zend_merge_properties(return_value, Z_ARRVAL(dataset) TSRMLS_CC);
+ zval_ptr_dtor(&dataset);
+ }
if (ce->constructor) {
fci.size = sizeof(fci);
diff --git a/ext/pgsql/pgsql.c b/ext/pgsql/pgsql.c
index 3311196638..4381440e8d 100644
--- a/ext/pgsql/pgsql.c
+++ b/ext/pgsql/pgsql.c
@@ -2752,8 +2752,14 @@ static void php_pgsql_fetch_hash(INTERNAL_FUNCTION_PARAMETERS, long result_type,
ZVAL_COPY_VALUE(&dataset, return_value);
object_and_properties_init(return_value, ce, NULL);
- zend_merge_properties(return_value, Z_ARRVAL(dataset), 0 TSRMLS_CC);
- zval_ptr_dtor(&dataset);
+ if (!ce->default_properties_count && !ce->__set) {
+ ALLOC_HASHTABLE(Z_OBJ_P(return_value)->properties);
+ *Z_OBJ_P(return_value)->properties = *Z_ARRVAL(dataset);
+ efree(Z_ARR(dataset));
+ } else {
+ zend_merge_properties(return_value, Z_ARRVAL(dataset) TSRMLS_CC);
+ zval_ptr_dtor(&dataset);
+ }
if (ce->constructor) {
fci.size = sizeof(fci);