From: Xinchen Hui Date: Sat, 17 Sep 2011 03:12:23 +0000 (+0000) Subject: Fix Bug #55703(PHP crash when calling mysqli_fetch_fields) X-Git-Tag: php-5.4.0beta2~110 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=26c1a62b340912a7dd9549a041c86be5d7386523;p=php 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 --- diff --git a/ext/mysqli/mysqli_api.c b/ext/mysqli/mysqli_api.c index 1649597c97..4dec94fc74 100644 --- a/ext/mysqli/mysqli_api.c +++ b/ext/mysqli/mysqli_api.c @@ -1057,7 +1057,12 @@ static void php_add_field_properties(zval *value, const MYSQL_FIELD *field TSRML add_property_string(value, "orgtable",(field->org_table ? field->org_table : ""), 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, "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, "length", field->length);