com php-src: Respect the origin behavior (fix one test: ext/pdo_mysql/tests/bug_33689.phpt): ext/ mysql/php_mysql.c ext/mysqli/mysqli_api.c ext/mysql
nd/mysqlnd_result_meta.c ext/mysqlnd/mysqlnd_wireprot ocol.c
| From: | Xinchen Hui | Date: | Mon, 23 Jun 2014 11:34:55 +0000 |
| Subject: | com php-src: Respect the origin behavior (fix one test: ext/pdo_mysql/tests/bug_33689.phpt): ext/ mysql/php_mysql.c ext/mysqli/mysqli_api.c ext/mysql nd/mysqlnd_result_meta.c ext/mysqlnd/mysqlnd_wireprot ocol.c |
||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-79022@lists.php.net to get a copy of this message | ||
Commit: 56a966e88a98bf04b2cd253b9b18136c0cc4028b
Author: Xinchen Hui <laruence@php.net> Mon, 23 Jun 2014 19:34:23 +0800
Parents: 92a708989380bfb5d5da00665895025398bdbc91
Branches: phpng
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=56a966e88a98bf04b2cd253b9b18136c0cc4028b
Log:
Respect the origin behavior (fix one test: ext/pdo_mysql/tests/bug_33689.phpt)
Changed paths:
M ext/mysql/php_mysql.c
M ext/mysqli/mysqli_api.c
M ext/mysqlnd/mysqlnd_result_meta.c
M ext/mysqlnd/mysqlnd_wireprotocol.c
Diff:
diff --git a/ext/mysql/php_mysql.c b/ext/mysql/php_mysql.c
index db02c24..cbef4e6 100644
--- a/ext/mysql/php_mysql.c
+++ b/ext/mysql/php_mysql.c
@@ -2426,7 +2426,7 @@ PHP_FUNCTION(mysql_fetch_field)
#if MYSQL_USE_MYSQLND
add_property_str(return_value, "name", STR_COPY(mysql_field->name));
add_property_str(return_value, "table", STR_COPY(mysql_field->table));
- add_property_str(return_value, "def", STR_COPY(mysql_field->def));
+ add_property_str(return_value, "def", mysql_field->def? STR_COPY(mysql_field->def)
: STR_EMPTY_ALLOC());
#else
add_property_string(return_value, "name",
(mysql_field->name?mysql_field->name:""));
add_property_string(return_value, "table",
(mysql_field->table?mysql_field->table:""));
diff --git a/ext/mysqli/mysqli_api.c b/ext/mysqli/mysqli_api.c
index c70971c..dab3cd7 100644
--- a/ext/mysqli/mysqli_api.c
+++ b/ext/mysqli/mysqli_api.c
@@ -1153,7 +1153,7 @@ static void php_add_field_properties(zval *value, const MYSQL_FIELD *field
TSRML
add_property_str(value, "orgname", STR_COPY(field->org_name));
add_property_str(value, "table", STR_COPY(field->table));
add_property_str(value, "orgtable", STR_COPY(field->org_table));
- add_property_str(value, "def", STR_COPY(field->def));
+ add_property_str(value, "def", field->def? STR_COPY(field->def) :
STR_EMPTY_ALLOC());
add_property_str(value, "db", STR_COPY(field->db));
#else
add_property_string(value, "name",(field->name ? field->name : ""));
diff --git a/ext/mysqlnd/mysqlnd_result_meta.c b/ext/mysqlnd/mysqlnd_result_meta.c
index 088f52c..c3906ed 100644
--- a/ext/mysqlnd/mysqlnd_result_meta.c
+++ b/ext/mysqlnd/mysqlnd_result_meta.c
@@ -33,7 +33,9 @@ static void
php_mysqlnd_free_field_metadata(MYSQLND_FIELD *meta, zend_bool persistent TSRMLS_DC)
{
if (meta) {
- STR_RELEASE(meta->def);
+ if (meta->def) {
+ STR_RELEASE(meta->def);
+ }
STR_RELEASE(meta->name);
STR_RELEASE(meta->org_name);
STR_RELEASE(meta->table);
@@ -262,7 +264,9 @@ MYSQLND_METHOD(mysqlnd_res_meta, clone_metadata)(const MYSQLND_RES_METADATA * co
new_fields[i].org_table = STR_DUP(orig_fields[i].org_table, persistent);
new_fields[i].db = STR_DUP(orig_fields[i].db, persistent);
new_fields[i].catalog = STR_DUP(orig_fields[i].catalog, persistent);
- new_fields[i].def = STR_DUP(orig_fields[i].def, persistent);
+ if (orig_fields[i].def) {
+ new_fields[i].def = STR_DUP(orig_fields[i].def, persistent);
+ }
}
new_meta->current_field = 0;
new_meta->field_count = meta->field_count;
diff --git a/ext/mysqlnd/mysqlnd_wireprotocol.c b/ext/mysqlnd/mysqlnd_wireprotocol.c
index 7931d6d..8cdd712 100644
--- a/ext/mysqlnd/mysqlnd_wireprotocol.c
+++ b/ext/mysqlnd/mysqlnd_wireprotocol.c
@@ -1328,9 +1328,7 @@ php_mysqlnd_rset_field_read(void * _packet, MYSQLND_CONN_DATA * conn
TSRMLS_DC)
DBG_INF_FMT("Def found, length %lu, persistent=%u", len, packet->persistent_alloc);
meta->def = STR_INIT((char *)p, len, packet->persistent_alloc);
p += len;
- } else {
- meta->def = STR_EMPTY_ALLOC();
- }
+ }
DBG_INF_FMT("allocing root. persistent=%u", packet->persistent_alloc);