Fix Bug #55703(PHP crash when calling mysqli_fetch_fields)

Since the catalog values always is "def" now, see http://dev.mysql.com/doc/refman/5.0/en/c-api-data-structures.html
This commit is contained in:
Xinchen Hui 2011-09-17 03:12:23 +00:00
parent 1ec077e060
commit 08201e11fe

View file

@ -1053,7 +1053,12 @@ static void php_add_field_properties(zval *value, const MYSQL_FIELD *field TSRML
add_property_string(value, "orgtable", (char *) (field->org_table ? field->org_table : ""), 1); add_property_string(value, "orgtable", (char *) (field->org_table ? field->org_table : ""), 1);
add_property_string(value, "def", (field->def ? field->def : ""), 1); add_property_string(value, "def", (field->def ? field->def : ""), 1);
add_property_string(value, "db", (field->db ? field->db : ""), 1); add_property_string(value, "db", (field->db ? field->db : ""), 1);
add_property_string(value, "catalog", (field->catalog ? field->catalog : ""), 1);
/* FIXME: manually set the catalog to "def" due to bug in
* libmysqlclient which does not initialize field->catalog
* and in addition, the catalog is always be "def"
*/
add_property_string(value, "catalog", "def", 1);
add_property_long(value, "max_length", field->max_length); add_property_long(value, "max_length", field->max_length);
add_property_long(value, "length", field->length); add_property_long(value, "length", field->length);