summaryrefslogtreecommitdiff
path: root/ext/mysqli/mysqli_api.c
diff options
context:
space:
mode:
authorXinchen Hui <laruence@php.net>2011-09-17 03:12:23 +0000
committerXinchen Hui <laruence@php.net>2011-09-17 03:12:23 +0000
commit26c1a62b340912a7dd9549a041c86be5d7386523 (patch)
treeaa2c4fab17e569c15caf11a4858708bb039f5e61 /ext/mysqli/mysqli_api.c
parent5441cd1f0d6fc4e6fafded617e38230466d786ec (diff)
downloadphp-git-26c1a62b340912a7dd9549a041c86be5d7386523.tar.gz
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
Diffstat (limited to 'ext/mysqli/mysqli_api.c')
-rw-r--r--ext/mysqli/mysqli_api.c7
1 files changed, 6 insertions, 1 deletions
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);