svn: /php/php-src/ branches/PHP_5_3/ext/mysqli/mysqli_api.c branches/PHP_5_4/ext/mysqli/mysqli_api.c trunk/ext/mysqli/mysqli_api.c
| From: | Xinchen Hui | Date: | Sat, 17 Sep 2011 03:12:23 +0000 |
| Subject: | svn: /php/php-src/ branches/PHP_5_3/ext/mysqli/mysqli_api.c branches/PHP_5_4/ext/mysqli/mysqli_api.c trunk/ext/mysqli/mysqli_api.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-66577@lists.php.net to get a copy of this message | ||
laruence Sat, 17 Sep 2011 03:12:23 +0000
Revision: http://svn.php.net/viewvc?view=revision&revision=316895
Log:
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
Bug: https://bugs.php.net/55703 (Duplicate) PHP crash when
calling mysqli_fetch_fields
Changed paths:
U php/php-src/branches/PHP_5_3/ext/mysqli/mysqli_api.c
U php/php-src/branches/PHP_5_4/ext/mysqli/mysqli_api.c
U php/php-src/trunk/ext/mysqli/mysqli_api.c
Modified: php/php-src/branches/PHP_5_3/ext/mysqli/mysqli_api.c
===================================================================
--- php/php-src/branches/PHP_5_3/ext/mysqli/mysqli_api.c 2011-09-17 02:52:08 UTC (rev 316894)
+++ php/php-src/branches/PHP_5_3/ext/mysqli/mysqli_api.c 2011-09-17 03:12:23 UTC (rev 316895)
@@ -1053,8 +1053,13 @@
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);
add_property_long(value, "charsetnr", field->charsetnr);
Modified: php/php-src/branches/PHP_5_4/ext/mysqli/mysqli_api.c
===================================================================
--- php/php-src/branches/PHP_5_4/ext/mysqli/mysqli_api.c 2011-09-17 02:52:08 UTC (rev 316894)
+++ php/php-src/branches/PHP_5_4/ext/mysqli/mysqli_api.c 2011-09-17 03:12:23 UTC (rev 316895)
@@ -1057,8 +1057,13 @@
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);
add_property_long(value, "charsetnr", field->charsetnr);
Modified: php/php-src/trunk/ext/mysqli/mysqli_api.c
===================================================================
--- php/php-src/trunk/ext/mysqli/mysqli_api.c 2011-09-17 02:52:08 UTC (rev 316894)
+++ php/php-src/trunk/ext/mysqli/mysqli_api.c 2011-09-17 03:12:23 UTC (rev 316895)
@@ -1057,8 +1057,13 @@
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);
add_property_long(value, "charsetnr", field->charsetnr);