Respect the origin behavior (fix one test: ext/pdo_mysql/tests/bug_33689.phpt)

This commit is contained in:
Xinchen Hui 2014-06-23 19:34:23 +08:00
parent 92a7089893
commit 56a966e88a
4 changed files with 9 additions and 7 deletions

View file

@ -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:""));

View file

@ -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 : ""));

View file

@ -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;

View file

@ -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);