]> granicus.if.org Git - php/commitdiff
Fix Bug #55703(PHP crash when calling mysqli_fetch_fields)
authorXinchen Hui <laruence@php.net>
Sat, 17 Sep 2011 03:12:23 +0000 (03:12 +0000)
committerXinchen Hui <laruence@php.net>
Sat, 17 Sep 2011 03:12:23 +0000 (03:12 +0000)
Since the catalog values always is "def" now, see http://dev.mysql.com/doc/refman/5.0/en/c-api-data-structures.html

ext/mysqli/mysqli_api.c

index 1649597c97c5a171f5c91869dd819c32c8fe9c04..4dec94fc74e62f5480526a3de613ff198ddd9a01 100644 (file)
@@ -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);