summaryrefslogtreecommitdiff
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
commit08201e11fe07b5f1e83b08aa2ef8f0e130fdc72c (patch)
treeffa89be6911258d7055d0d78bab45f773e6a55bc
parent1ec077e0608e2b070ef0de4f92f281ae86b710e3 (diff)
downloadphp-git-08201e11fe07b5f1e83b08aa2ef8f0e130fdc72c.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
-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 e102a7cef4..096f86d138 100644
--- a/ext/mysqli/mysqli_api.c
+++ b/ext/mysqli/mysqli_api.c
@@ -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, "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);