[PHP-CVS] svn: /php/php-src/ branches/PHP_5_3/ext/mysqlnd/mysqlnd.c trunk/ext/mysqlnd/mysqlnd.c
andrey Mon, 06 Dec 2010 13:50:51 + Revision: http://svn.php.net/viewvc?view=revision&revision=306008 Log: don't crash if the API is used incorrectly Changed paths: U php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd.c U php/php-src/trunk/ext/mysqlnd/mysqlnd.c Modified: php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd.c === --- php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd.c 2010-12-06 13:12:16 UTC (rev 306007) +++ php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd.c 2010-12-06 13:50:51 UTC (rev 306008) @@ -1971,15 +1971,19 @@ } } if (ret == PASS) { + char * tmp = NULL; + /* if we get conn->user as parameter and then we first free it, then estrndup it, we will crash */ + tmp = mnd_pestrndup(user, user_len, conn->persistent); if (conn->user) { mnd_pefree(conn->user, conn->persistent); } - conn->user = mnd_pestrndup(user, user_len, conn->persistent); + conn->user = tmp; + tmp = mnd_pestrdup(passwd, conn->persistent); if (conn->passwd) { mnd_pefree(conn->passwd, conn->persistent); } - conn->passwd = mnd_pestrdup(passwd, conn->persistent); + conn->passwd = tmp; if (conn->last_message) { mnd_pefree(conn->last_message, conn->persistent); Modified: php/php-src/trunk/ext/mysqlnd/mysqlnd.c === --- php/php-src/trunk/ext/mysqlnd/mysqlnd.c 2010-12-06 13:12:16 UTC (rev 306007) +++ php/php-src/trunk/ext/mysqlnd/mysqlnd.c 2010-12-06 13:50:51 UTC (rev 306008) @@ -1994,15 +1994,19 @@ } } if (ret == PASS) { + char * tmp = NULL; + /* if we get conn->user as parameter and then we first free it, then estrndup it, we will crash */ + tmp = mnd_pestrndup(user, user_len, conn->persistent); if (conn->user) { mnd_pefree(conn->user, conn->persistent); } - conn->user = mnd_pestrndup(user, user_len, conn->persistent); + conn->user = tmp; + tmp = mnd_pestrdup(passwd, conn->persistent); if (conn->passwd) { mnd_pefree(conn->passwd, conn->persistent); } - conn->passwd = mnd_pestrdup(passwd, conn->persistent); + conn->passwd = tmp; if (conn->last_message) { mnd_pefree(conn->last_message, conn->persistent); -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] svn: /php/php-src/ branches/PHP_5_3/ext/mysqlnd/mysqlnd.c trunk/ext/mysqlnd/mysqlnd.c
andrey Wed, 16 Jun 2010 19:01:13 + Revision: http://svn.php.net/viewvc?view=revision&revision=300502 Log: no more needed because of the charset fix in the previous changeset Changed paths: U php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd.c U php/php-src/trunk/ext/mysqlnd/mysqlnd.c Modified: php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd.c === --- php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd.c 2010-06-16 18:56:24 UTC (rev 300501) +++ php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd.c 2010-06-16 19:01:13 UTC (rev 300502) @@ -1960,7 +1960,6 @@ mnd_pefree(conn->last_message, conn->persistent); conn->last_message = NULL; } - conn->charset = conn->greet_charset; memset(&conn->upsert_status, 0, sizeof(conn->upsert_status)); /* set charset for old servers */ if (mysqlnd_get_server_version(conn) < 50123) { Modified: php/php-src/trunk/ext/mysqlnd/mysqlnd.c === --- php/php-src/trunk/ext/mysqlnd/mysqlnd.c 2010-06-16 18:56:24 UTC (rev 300501) +++ php/php-src/trunk/ext/mysqlnd/mysqlnd.c 2010-06-16 19:01:13 UTC (rev 300502) @@ -1960,7 +1960,6 @@ mnd_pefree(conn->last_message, conn->persistent); conn->last_message = NULL; } - conn->charset = conn->greet_charset; memset(&conn->upsert_status, 0, sizeof(conn->upsert_status)); /* set charset for old servers */ if (mysqlnd_get_server_version(conn) < 50123) { -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] svn: /php/php-src/ branches/PHP_5_3/ext/mysqlnd/mysqlnd.c trunk/ext/mysqlnd/mysqlnd.c
andrey Thu, 27 May 2010 12:39:12 + Revision: http://svn.php.net/viewvc?view=revision&revision=299848 Log: Don't use NULL pointer, always check before use Changed paths: U php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd.c U php/php-src/trunk/ext/mysqlnd/mysqlnd.c Modified: php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd.c === --- php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd.c 2010-05-27 12:12:55 UTC (rev 299847) +++ php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd.c 2010-05-27 12:39:12 UTC (rev 299848) @@ -778,7 +778,9 @@ } if (conn->last_query_type == QUERY_SELECT) { MYSQLND_RES * result = conn->m->use_result(conn TSRMLS_CC); - result->m.free_result(result, TRUE TSRMLS_CC); + if (result) { + result->m.free_result(result, TRUE TSRMLS_CC); + } } } } Modified: php/php-src/trunk/ext/mysqlnd/mysqlnd.c === --- php/php-src/trunk/ext/mysqlnd/mysqlnd.c 2010-05-27 12:12:55 UTC (rev 299847) +++ php/php-src/trunk/ext/mysqlnd/mysqlnd.c 2010-05-27 12:39:12 UTC (rev 299848) @@ -778,7 +778,9 @@ } if (conn->last_query_type == QUERY_SELECT) { MYSQLND_RES * result = conn->m->use_result(conn TSRMLS_CC); - result->m.free_result(result, TRUE TSRMLS_CC); + if (result) { + result->m.free_result(result, TRUE TSRMLS_CC); + } } } } -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] svn: /php/php-src/ branches/PHP_5_3/ext/mysqlnd/mysqlnd.c trunk/ext/mysqlnd/mysqlnd.c
andrey Wed, 26 May 2010 13:47:43 + Revision: http://svn.php.net/viewvc?view=revision&revision=299785 Log: Don't use conn->net without checking if it is NULL, because it can be NULL in OOM conditions. This would cause a crash. Changed paths: U php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd.c U php/php-src/trunk/ext/mysqlnd/mysqlnd.c Modified: php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd.c === --- php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd.c 2010-05-26 13:38:05 UTC (rev 299784) +++ php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd.c 2010-05-26 13:47:43 UTC (rev 299785) @@ -125,7 +125,9 @@ conn->current_result = NULL; } - conn->net->m.free_contents(conn->net TSRMLS_CC); + if (conn->net) { + conn->net->m.free_contents(conn->net TSRMLS_CC); + } DBG_INF("Freeing memory of members"); Modified: php/php-src/trunk/ext/mysqlnd/mysqlnd.c === --- php/php-src/trunk/ext/mysqlnd/mysqlnd.c 2010-05-26 13:38:05 UTC (rev 299784) +++ php/php-src/trunk/ext/mysqlnd/mysqlnd.c 2010-05-26 13:47:43 UTC (rev 299785) @@ -125,7 +125,9 @@ conn->current_result = NULL; } - conn->net->m.free_contents(conn->net TSRMLS_CC); + if (conn->net) { + conn->net->m.free_contents(conn->net TSRMLS_CC); + } DBG_INF("Freeing memory of members"); -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] svn: /php/php-src/ branches/PHP_5_3/ext/mysqlnd/mysqlnd.c trunk/ext/mysqlnd/mysqlnd.c
andrey Mon, 03 May 2010 13:45:58 + Revision: http://svn.php.net/viewvc?view=revision&revision=298901 Log: Better handing of OOM in mysqlnd::set_client_option Changed paths: U php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd.c U php/php-src/trunk/ext/mysqlnd/mysqlnd.c Modified: php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd.c === --- php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd.c 2010-05-03 13:22:06 UTC (rev 298900) +++ php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd.c 2010-05-03 13:45:58 UTC (rev 298901) @@ -1122,6 +1122,7 @@ FALSE, TRUE TSRMLS_CC)) { DBG_RETURN(NULL); } + /* Prepare for the worst case. MyISAM goes to 2500 BIT columns, double it for safety. @@ -1981,20 +1982,26 @@ } break; case MYSQL_INIT_COMMAND: + { + char ** new_init_commands; + char * new_command; DBG_INF("MYSQL_INIT_COMMAND"); DBG_INF_FMT("command=%s", value); /* when num_commands is 0, then realloc will be effectively a malloc call, internally */ - conn->options.init_commands = mnd_perealloc(conn->options.init_commands, sizeof(char *) * (conn->options.num_commands + 1), - conn->persistent); - if (!conn->options.init_commands) { + /* Don't assign to conn->options.init_commands because in case of OOM we will lose the pointer and leak */ + new_init_commands = mnd_perealloc(conn->options.init_commands, sizeof(char *) * (conn->options.num_commands + 1), conn->persistent); + if (!new_init_commands) { goto oom; } - conn->options.init_commands[conn->options.num_commands] = mnd_pestrdup(value, conn->persistent); - if (!conn->options.init_commands[conn->options.num_commands]) { + conn->options.init_commands = new_init_commands; + new_command = mnd_pestrdup(value, conn->persistent); + if (!new_command) { goto oom; } + conn->options.init_commands[conn->options.num_commands] = new_command; ++conn->options.num_commands; break; + } case MYSQL_READ_DEFAULT_FILE: case MYSQL_READ_DEFAULT_GROUP: #ifdef WHEN_SUPPORTED_BY_MYSQLI @@ -2004,17 +2011,19 @@ /* currently not supported. Todo!! */ break; case MYSQL_SET_CHARSET_NAME: + { + char * new_charset_name = mnd_pestrdup(value, conn->persistent); DBG_INF("MYSQL_SET_CHARSET_NAME"); + if (!new_charset_name) { + goto oom; + } if (conn->options.charset_name) { mnd_pefree(conn->options.charset_name, conn->persistent); - conn->options.charset_name = NULL; } - conn->options.charset_name = mnd_pestrdup(value, conn->persistent); - if (!conn->options.charset_name) { - goto oom; - } + conn->options.charset_name = new_charset_name; DBG_INF_FMT("charset=%s", conn->options.charset_name); break; + } #ifdef WHEN_SUPPORTED_BY_MYSQLI case MYSQL_SET_CHARSET_DIR: case MYSQL_OPT_RECONNECT: Modified: php/php-src/trunk/ext/mysqlnd/mysqlnd.c === --- php/php-src/trunk/ext/mysqlnd/mysqlnd.c 2010-05-03 13:22:06 UTC (rev 298900) +++ php/php-src/trunk/ext/mysqlnd/mysqlnd.c 2010-05-03 13:45:58 UTC (rev 298901) @@ -1122,6 +1122,7 @@ FALSE, TRUE TSRMLS_CC)) { DBG_RETURN(NULL); } + /* Prepare for the worst case. MyISAM goes to 2500 BIT columns, double it for safety. @@ -1981,20 +1982,26 @@ } break; case MYSQL_INIT_COMMAND: + { + char ** new_init_commands; + char * new_command; D
[PHP-CVS] svn: /php/php-src/ branches/PHP_5_3/ext/mysqlnd/mysqlnd.c trunk/ext/mysqlnd/mysqlnd.c
andrey Thu, 29 Apr 2010 15:17:44 + Revision: http://svn.php.net/viewvc?view=revision&revision=298779 Log: Fix valgrind warning, usage of nirvana memory Changed paths: U php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd.c U php/php-src/trunk/ext/mysqlnd/mysqlnd.c Modified: php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd.c === --- php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd.c 2010-04-29 13:42:01 UTC (rev 298778) +++ php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd.c 2010-04-29 15:17:44 UTC (rev 298779) @@ -1842,7 +1842,6 @@ chg_user_resp = conn->protocol->m.get_change_user_response_packet(conn->protocol, FALSE TSRMLS_CC); ret = PACKET_READ(chg_user_resp, conn); conn->error_info = chg_user_resp->error_info; - PACKET_FREE(chg_user_resp); if (conn->error_info.error_no) { ret = FAIL; @@ -1876,6 +1875,7 @@ DBG_ERR(mysqlnd_old_passwd); SET_CLIENT_ERROR(conn->error_info, CR_UNKNOWN_ERROR, UNKNOWN_SQLSTATE, mysqlnd_old_passwd); } + PACKET_FREE(chg_user_resp); SET_ERROR_AFF_ROWS(conn); Modified: php/php-src/trunk/ext/mysqlnd/mysqlnd.c === --- php/php-src/trunk/ext/mysqlnd/mysqlnd.c 2010-04-29 13:42:01 UTC (rev 298778) +++ php/php-src/trunk/ext/mysqlnd/mysqlnd.c 2010-04-29 15:17:44 UTC (rev 298779) @@ -1842,7 +1842,6 @@ chg_user_resp = conn->protocol->m.get_change_user_response_packet(conn->protocol, FALSE TSRMLS_CC); ret = PACKET_READ(chg_user_resp, conn); conn->error_info = chg_user_resp->error_info; - PACKET_FREE(chg_user_resp); if (conn->error_info.error_no) { ret = FAIL; @@ -1876,6 +1875,7 @@ DBG_ERR(mysqlnd_old_passwd); SET_CLIENT_ERROR(conn->error_info, CR_UNKNOWN_ERROR, UNKNOWN_SQLSTATE, mysqlnd_old_passwd); } + PACKET_FREE(chg_user_resp); SET_ERROR_AFF_ROWS(conn); -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] svn: /php/php-src/ branches/PHP_5_3/ext/mysqlnd/mysqlnd.c trunk/ext/mysqlnd/mysqlnd.c
andrey Thu, 29 Apr 2010 13:13:41 + Revision: http://svn.php.net/viewvc?view=revision&revision=298771 Log: Fix possible crashes in case of OOM, as well as a leak. Changed paths: U php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd.c U php/php-src/trunk/ext/mysqlnd/mysqlnd.c Modified: php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd.c === --- php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd.c 2010-04-29 12:48:06 UTC (rev 298770) +++ php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd.c 2010-04-29 13:13:41 UTC (rev 298771) @@ -780,8 +780,10 @@ DBG_INF_FMT("host=%s user=%s db=%s port=%d flags=%d", host?host:"", user?user:"", db?db:"", port, mysql_flags); if (!conn) { - conn = mysqlnd_init(FALSE); self_alloced = TRUE; + if (!(conn = mysqlnd_init(FALSE))) { + DBG_RETURN(NULL); + } } ret = conn->m->connect(conn, host, user, passwd, passwd_len, db, db_len, port, socket, mysql_flags TSRMLS_CC); @@ -1094,8 +1096,10 @@ MyISAM goes to 2500 BIT columns, double it for safety. */ result = mysqlnd_result_init(5000, conn->persistent TSRMLS_CC); + if (!result) { + DBG_RETURN(NULL); + } - if (FAIL == result->m.read_result_metadata(result, conn TSRMLS_CC)) { DBG_ERR("Error ocurred while reading metadata"); result->m.free_result(result, TRUE TSRMLS_CC); @@ -1105,6 +1109,11 @@ result->type = MYSQLND_RES_NORMAL; result->m.fetch_row = result->m.fetch_row_normal_unbuffered; result->unbuf = mnd_ecalloc(1, sizeof(MYSQLND_RES_UNBUFFERED)); + if (!result->unbuf) { + DBG_ERR("OOM"); + result->m.free_result(result, TRUE TSRMLS_CC); + DBG_RETURN(NULL); + } result->unbuf->eof_reached = TRUE; DBG_RETURN(result); @@ -1933,7 +1942,13 @@ /* when num_commands is 0, then realloc will be effectively a malloc call, internally */ conn->options.init_commands = mnd_perealloc(conn->options.init_commands, sizeof(char *) * (conn->options.num_commands + 1), conn->persistent); + if (!conn->options.init_commands) { + DBG_RETURN(FAIL); + } conn->options.init_commands[conn->options.num_commands] = mnd_pestrdup(value, conn->persistent); + if (!conn->options.init_commands[conn->options.num_commands]) { + DBG_RETURN(FAIL); + } ++conn->options.num_commands; break; case MYSQL_READ_DEFAULT_FILE: @@ -1946,6 +1961,10 @@ break; case MYSQL_SET_CHARSET_NAME: DBG_INF("MYSQL_SET_CHARSET_NAME"); + if (conn->options.charset_name) { + mnd_pefree(conn->options.charset_name, conn->persistent); + conn->options.charset_name = NULL; + } conn->options.charset_name = mnd_pestrdup(value, conn->persistent); DBG_INF_FMT("charset=%s", conn->options.charset_name); break; Modified: php/php-src/trunk/ext/mysqlnd/mysqlnd.c === --- php/php-src/trunk/ext/mysqlnd/mysqlnd.c 2010-04-29 12:48:06 UTC (rev 298770) +++ php/php-src/trunk/ext/mysqlnd/mysqlnd.c 2010-04-29 13:13:41 UTC (rev 298771) @@ -780,8 +780,10 @@ DBG_INF_FMT("host=%s user=%s db=%s port=%d flags=%d", host?host:"", user?user:"", db?db:"", port, mysql_flags); if (!conn) { - conn = mysqlnd_init(FALSE); self_alloced = TRUE; + if (!(conn = mysqlnd_init(FALSE))) { + DBG_RETURN(NULL); + } } ret = conn->m->connect(conn, host, user, passwd, passwd_len, db, db_len, port, socket, mysql_flags TSRMLS_CC); @@ -1094,8 +1096,10 @@ MyISAM goes to 2500 BIT columns, double it for safety. */ result = mysqlnd_result_init(5000, conn->persistent TSRMLS_CC); + if (!result) { + DBG_RETURN(NULL); + } - if (FAIL == result->m.read_result_metadata(result, conn TSRMLS_CC)) { DBG_ERR("Error ocurred while reading metadata"); result->m.free_result(result, TRUE TSRMLS_CC); @@ -1105,6 +1109,11 @@ result->type = MYSQLND_RES_NORMAL; result->m.fetch_row = result->m.fetch_row_normal_unbuffered; result->unbuf = mnd_ec
[PHP-CVS] svn: /php/php-src/ branches/PHP_5_3/ext/mysqlnd/mysqlnd.c trunk/ext/mysqlnd/mysqlnd.c
andrey Wed, 24 Feb 2010 21:16:04 + Revision: http://svn.php.net/viewvc?view=revision&revision=295482 Log: Fix the text. Correct english and a bit shorter. Changed paths: U php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd.c U php/php-src/trunk/ext/mysqlnd/mysqlnd.c Modified: php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd.c === --- php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd.c 2010-02-24 21:14:39 UTC (rev 295481) +++ php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd.c 2010-02-24 21:16:04 UTC (rev 295482) @@ -57,10 +57,10 @@ -PHPAPI const char * const mysqlnd_old_passwd = "mysqlnd cannot connect to MySQL 4.1+ using the old insecure authentication. Your password has length of 16. " -"Please execute the SET PASSWORD command (`SET PASSWORD = PASSWORD('your_existing_password')`) with the " -"help of a administration tool to set your password again. This will store a new, and more secure, hash value with the length of 41, in mysql.user. If you are using PHP 5.2 or earlier to " -"connect to this database you might need to remove the old-passwords flag from your my.cnf"; +PHPAPI const char * const mysqlnd_old_passwd = "mysqlnd cannot connect to MySQL 4.1+ using the old insecure authentication. " +"Please use an administration tool to reset your password with the command SET PASSWORD = PASSWORD('your_existing_password'). This will " +"store a new, and more secure, hash value in mysql.user. If this user is used in other scripts executed by PHP 5.2 or earlier you might need to remove the old-passwords " +"flag from your my.cnf file"; PHPAPI const char * const mysqlnd_server_gone = "MySQL server has gone away"; PHPAPI const char * const mysqlnd_out_of_sync = "Commands out of sync; you can't run this command now"; Modified: php/php-src/trunk/ext/mysqlnd/mysqlnd.c === --- php/php-src/trunk/ext/mysqlnd/mysqlnd.c 2010-02-24 21:14:39 UTC (rev 295481) +++ php/php-src/trunk/ext/mysqlnd/mysqlnd.c 2010-02-24 21:16:04 UTC (rev 295482) @@ -57,10 +57,10 @@ -PHPAPI const char * const mysqlnd_old_passwd = "mysqlnd cannot connect to MySQL 4.1+ using the old insecure authentication. Your password has length of 16. " -"Please execute the SET PASSWORD command (`SET PASSWORD = PASSWORD('your_existing_password')`) with the " -"help of a administration tool to set your password again. This will store a new, and more secure, hash value with the length of 41, in mysql.user. If you are using PHP 5.2 or earlier to " -"connect to this database you might need to remove the old-passwords flag from your my.cnf"; +PHPAPI const char * const mysqlnd_old_passwd = "mysqlnd cannot connect to MySQL 4.1+ using the old insecure authentication. " +"Please use an administration tool to reset your password with the command SET PASSWORD = PASSWORD('your_existing_password'). This will " +"store a new, and more secure, hash value in mysql.user. If this user is used in other scripts executed by PHP 5.2 or earlier you might need to remove the old-passwords " +"flag from your my.cnf file"; PHPAPI const char * const mysqlnd_server_gone = "MySQL server has gone away"; PHPAPI const char * const mysqlnd_out_of_sync = "Commands out of sync; you can't run this command now"; -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] svn: /php/php-src/ branches/PHP_5_3/ext/mysqlnd/mysqlnd.c trunk/ext/mysqlnd/mysqlnd.c
andrey Wed, 24 Feb 2010 18:00:01 + Revision: http://svn.php.net/viewvc?view=revision&revision=295475 Log: add better description to the problem Changed paths: U php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd.c U php/php-src/trunk/ext/mysqlnd/mysqlnd.c Modified: php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd.c === --- php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd.c 2010-02-24 15:22:23 UTC (rev 295474) +++ php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd.c 2010-02-24 18:00:01 UTC (rev 295475) @@ -57,7 +57,11 @@ -PHPAPI const char * const mysqlnd_old_passwd = "mysqlnd cannot connect to MySQL 4.1+ using old authentication"; +PHPAPI const char * const mysqlnd_old_passwd = "mysqlnd cannot connect to MySQL 4.1+ using the old insecure authentication. Your password has length of 16. " +"Please execute the SET PASSWORD command (`SET PASSWORD = PASSWORD('your_existing_password')`) with the " +"help of a administration tool to set your password again. This will store a new, and more secure, hash value with the length of 41, in mysql.user. If you are using PHP 5.2 or earlier to " +"connect to this database you might need to remove the old-passwords flag from your my.cnf"; + PHPAPI const char * const mysqlnd_server_gone = "MySQL server has gone away"; PHPAPI const char * const mysqlnd_out_of_sync = "Commands out of sync; you can't run this command now"; Modified: php/php-src/trunk/ext/mysqlnd/mysqlnd.c === --- php/php-src/trunk/ext/mysqlnd/mysqlnd.c 2010-02-24 15:22:23 UTC (rev 295474) +++ php/php-src/trunk/ext/mysqlnd/mysqlnd.c 2010-02-24 18:00:01 UTC (rev 295475) @@ -57,7 +57,11 @@ -PHPAPI const char * const mysqlnd_old_passwd = "mysqlnd cannot connect to MySQL 4.1+ using old authentication"; +PHPAPI const char * const mysqlnd_old_passwd = "mysqlnd cannot connect to MySQL 4.1+ using the old insecure authentication. Your password has length of 16. " +"Please execute the SET PASSWORD command (`SET PASSWORD = PASSWORD('your_existing_password')`) with the " +"help of a administration tool to set your password again. This will store a new, and more secure, hash value with the length of 41, in mysql.user. If you are using PHP 5.2 or earlier to " +"connect to this database you might need to remove the old-passwords flag from your my.cnf"; + PHPAPI const char * const mysqlnd_server_gone = "MySQL server has gone away"; PHPAPI const char * const mysqlnd_out_of_sync = "Commands out of sync; you can't run this command now"; -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] svn: /php/php-src/ branches/PHP_5_3/ext/mysqlnd/mysqlnd.c trunk/ext/mysqlnd/mysqlnd.c
andrey Wed, 13 Jan 2010 18:07:02 + Revision: http://svn.php.net/viewvc?view=revision&revision=293513 Log: more PHPAPI for phpize-d builds Changed paths: U php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd.c U php/php-src/trunk/ext/mysqlnd/mysqlnd.c Modified: php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd.c === --- php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd.c 2010-01-13 18:00:41 UTC (rev 293512) +++ php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd.c 2010-01-13 18:07:02 UTC (rev 293513) @@ -57,11 +57,11 @@ -const char * const mysqlnd_old_passwd = "mysqlnd cannot connect to MySQL 4.1+ using old authentication"; -const char * const mysqlnd_server_gone = "MySQL server has gone away"; -const char * const mysqlnd_out_of_sync = "Commands out of sync; you can't run this command now"; +PHPAPI const char * const mysqlnd_old_passwd = "mysqlnd cannot connect to MySQL 4.1+ using old authentication"; +PHPAPI const char * const mysqlnd_server_gone = "MySQL server has gone away"; +PHPAPI const char * const mysqlnd_out_of_sync = "Commands out of sync; you can't run this command now"; -MYSQLND_STATS *mysqlnd_global_stats = NULL; +PHPAPI MYSQLND_STATS *mysqlnd_global_stats = NULL; static zend_bool mysqlnd_library_initted = FALSE; static enum_func_status mysqlnd_send_close(MYSQLND * conn TSRMLS_DC); @@ -69,7 +69,7 @@ static struct st_mysqlnd_conn_methods *mysqlnd_conn_methods; /* {{{ mysqlnd_library_end */ -void mysqlnd_library_end(TSRMLS_D) +PHPAPI void mysqlnd_library_end(TSRMLS_D) { if (mysqlnd_library_initted == TRUE) { mysqlnd_stats_end(mysqlnd_global_stats); @@ -2038,7 +2038,7 @@ MYSQLND_STMT * _mysqlnd_stmt_init(MYSQLND * const conn TSRMLS_DC); static void MYSQLND_METHOD(mysqlnd_conn, init)(MYSQLND * conn TSRMLS_DC); - +static MYSQLND_CLASS_METHODS_START(mysqlnd_conn) MYSQLND_METHOD(mysqlnd_conn, init), MYSQLND_METHOD(mysqlnd_conn, connect), @@ -2125,7 +2125,7 @@ /* {{{ mysqlnd_init */ -PHPAPI MYSQLND *_mysqlnd_init(zend_bool persistent TSRMLS_DC) +PHPAPI MYSQLND * _mysqlnd_init(zend_bool persistent TSRMLS_DC) { size_t alloc_size = sizeof(MYSQLND) + mysqlnd_plugin_count() * sizeof(void *); MYSQLND *ret = mnd_pecalloc(1, alloc_size, persistent); @@ -2146,7 +2146,7 @@ /* {{{ mysqlnd_library_init */ -void mysqlnd_library_init(TSRMLS_D) +PHPAPI void mysqlnd_library_init(TSRMLS_D) { if (mysqlnd_library_initted == FALSE) { mysqlnd_library_initted = TRUE; Modified: php/php-src/trunk/ext/mysqlnd/mysqlnd.c === --- php/php-src/trunk/ext/mysqlnd/mysqlnd.c 2010-01-13 18:00:41 UTC (rev 293512) +++ php/php-src/trunk/ext/mysqlnd/mysqlnd.c 2010-01-13 18:07:02 UTC (rev 293513) @@ -57,11 +57,11 @@ -const char * const mysqlnd_old_passwd = "mysqlnd cannot connect to MySQL 4.1+ using old authentication"; -const char * const mysqlnd_server_gone = "MySQL server has gone away"; -const char * const mysqlnd_out_of_sync = "Commands out of sync; you can't run this command now"; +PHPAPI const char * const mysqlnd_old_passwd = "mysqlnd cannot connect to MySQL 4.1+ using old authentication"; +PHPAPI const char * const mysqlnd_server_gone = "MySQL server has gone away"; +PHPAPI const char * const mysqlnd_out_of_sync = "Commands out of sync; you can't run this command now"; -MYSQLND_STATS *mysqlnd_global_stats = NULL; +PHPAPI MYSQLND_STATS *mysqlnd_global_stats = NULL; static zend_bool mysqlnd_library_initted = FALSE; static enum_func_status mysqlnd_send_close(MYSQLND * conn TSRMLS_DC); @@ -69,7 +69,7 @@ static struct st_mysqlnd_conn_methods *mysqlnd_conn_methods; /* {{{ mysqlnd_library_end */ -void mysqlnd_library_end(TSRMLS_D) +PHPAPI void mysqlnd_library_end(TSRMLS_D) { if (mysqlnd_library_initted == TRUE) { mysqlnd_stats_end(mysqlnd_global_stats); @@ -2038,7 +2038,7 @@ MYSQLND_STMT * _mysqlnd_stmt_init(MYSQLND * const conn TSRMLS_DC); static void MYSQLND_METHOD(mysqlnd_conn, init)(MYSQLND * conn TSRMLS_DC); - +static MYSQLND_CLASS_METHODS_START(mysqlnd_conn) MYSQLND_METHOD(mysqlnd_conn, init), MYSQLND_METHOD(mysqlnd_conn, connect), @@ -2125,7 +2125,7 @@ /* {{{ mysqlnd_init */ -PHPAPI MYSQLND *_mysqlnd_init(zend_bool persistent TSRMLS_DC) +PHPAPI MYSQLND * _mysqlnd_init(zend_bool persistent TSRMLS_DC) { size_t alloc_size = sizeof(MYSQLND) + mysqlnd_plugin_count() * sizeof(void *); MYSQLND *ret = mnd_pecalloc(1, alloc_size, persistent); @@ -2146,7 +2146,7 @@ /* {{{ mysqlnd_library_init */ -void mysqlnd_library_init(TSRMLS_D) +PHPAPI void mysqlnd_library_init(TSRMLS_D) { if (mysqlnd_library_initted == FALSE) { mysqlnd_library_initted = TRUE; -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub
[PHP-CVS] svn: /php/php-src/ branches/PHP_5_3/ext/mysqlnd/mysqlnd.c trunk/ext/mysqlnd/mysqlnd.c
andrey Tue, 22 Dec 2009 17:44:42 + Revision: http://svn.php.net/viewvc?view=revision&revision=292491 Log: Fix double calls to free_contents if the connection cannot be opened. mysqlnd have no probs, external code should not have too. In any case, double call is not needed. Changed paths: U php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd.c U php/php-src/trunk/ext/mysqlnd/mysqlnd.c Modified: php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd.c === --- php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd.c 2009-12-22 17:31:31 UTC (rev 292490) +++ php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd.c 2009-12-22 17:44:42 UTC (rev 292491) @@ -737,8 +737,6 @@ conn->scheme = NULL; } - /* This will also close conn->net->stream if it has been opened */ - conn->m->free_contents(conn TSRMLS_CC); MYSQLND_INC_CONN_STATISTIC(&conn->stats, STAT_CONNECT_FAILURE); DBG_RETURN(FAIL); @@ -776,6 +774,9 @@ object - we are free to kill it! */ conn->m->dtor(conn TSRMLS_CC); + } else { + /* This will also close conn->net->stream if it has been opened */ + conn->m->free_contents(conn TSRMLS_CC); } DBG_RETURN(NULL); } Modified: php/php-src/trunk/ext/mysqlnd/mysqlnd.c === --- php/php-src/trunk/ext/mysqlnd/mysqlnd.c 2009-12-22 17:31:31 UTC (rev 292490) +++ php/php-src/trunk/ext/mysqlnd/mysqlnd.c 2009-12-22 17:44:42 UTC (rev 292491) @@ -737,8 +737,6 @@ conn->scheme = NULL; } - /* This will also close conn->net->stream if it has been opened */ - conn->m->free_contents(conn TSRMLS_CC); MYSQLND_INC_CONN_STATISTIC(&conn->stats, STAT_CONNECT_FAILURE); DBG_RETURN(FAIL); @@ -776,6 +774,9 @@ object - we are free to kill it! */ conn->m->dtor(conn TSRMLS_CC); + } else { + /* This will also close conn->net->stream if it has been opened */ + conn->m->free_contents(conn TSRMLS_CC); } DBG_RETURN(NULL); } -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] svn: /php/php-src/ branches/PHP_5_3/ext/mysqlnd/mysqlnd.c trunk/ext/mysqlnd/mysqlnd.c
andrey Tue, 22 Dec 2009 17:31:31 + Revision: http://svn.php.net/viewvc?view=revision&revision=292490 Log: move state setting to the right place, in mysqlnd_init, no more in mysqlnd::connect Changed paths: U php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd.c U php/php-src/trunk/ext/mysqlnd/mysqlnd.c Modified: php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd.c === --- php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd.c 2009-12-22 17:02:35 UTC (rev 292489) +++ php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd.c 2009-12-22 17:31:31 UTC (rev 292490) @@ -531,8 +531,6 @@ PACKET_INIT(auth_packet, PROT_AUTH_PACKET, php_mysql_packet_auth *, FALSE); PACKET_INIT_ALLOCA(ok_packet, PROT_OK_PACKET); - CONN_SET_STATE(conn, CONN_ALLOCED); - if (conn->persistent) { conn->scheme = pestrndup(transport, transport_len, 1); mnd_efree(transport); @@ -2104,6 +2102,8 @@ ret->net = mysqlnd_net_init(persistent TSRMLS_CC); + CONN_SET_STATE(ret, CONN_ALLOCED); + DBG_RETURN(ret); } /* }}} */ Modified: php/php-src/trunk/ext/mysqlnd/mysqlnd.c === --- php/php-src/trunk/ext/mysqlnd/mysqlnd.c 2009-12-22 17:02:35 UTC (rev 292489) +++ php/php-src/trunk/ext/mysqlnd/mysqlnd.c 2009-12-22 17:31:31 UTC (rev 292490) @@ -531,8 +531,6 @@ PACKET_INIT(auth_packet, PROT_AUTH_PACKET, php_mysql_packet_auth *, FALSE); PACKET_INIT_ALLOCA(ok_packet, PROT_OK_PACKET); - CONN_SET_STATE(conn, CONN_ALLOCED); - if (conn->persistent) { conn->scheme = pestrndup(transport, transport_len, 1); mnd_efree(transport); @@ -2104,6 +2102,8 @@ ret->net = mysqlnd_net_init(persistent TSRMLS_CC); + CONN_SET_STATE(ret, CONN_ALLOCED); + DBG_RETURN(ret); } /* }}} */ -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] svn: /php/php-src/ branches/PHP_5_3/ext/mysqlnd/mysqlnd.c trunk/ext/mysqlnd/mysqlnd.c
andrey Tue, 15 Dec 2009 17:39:30 + Revision: http://svn.php.net/viewvc?view=revision&revision=292180 Log: remove duplicated code Changed paths: U php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd.c U php/php-src/trunk/ext/mysqlnd/mysqlnd.c Modified: php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd.c === --- php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd.c 2009-12-15 17:33:06 UTC (rev 292179) +++ php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd.c 2009-12-15 17:39:30 UTC (rev 292180) @@ -677,14 +677,8 @@ mysqlnd_local_infile_default(conn); { - unsigned int buf_size; - buf_size = MYSQLND_G(net_read_buffer_size); /* this is long, cast to unsigned int*/ - conn->m->set_client_option(conn, MYSQLND_OPT_NET_READ_BUFFER_SIZE, - (char *)&buf_size TSRMLS_CC); - - buf_size = MYSQLND_G(net_cmd_buffer_size); /* this is long, cast to unsigned int*/ - conn->m->set_client_option(conn, MYSQLND_OPT_NET_CMD_BUFFER_SIZE, - (char *)&buf_size TSRMLS_CC); + unsigned int buf_size = MYSQLND_G(net_cmd_buffer_size); /* this is long, cast to unsigned int*/ + conn->m->set_client_option(conn, MYSQLND_OPT_NET_CMD_BUFFER_SIZE, (char *)&buf_size TSRMLS_CC); } MYSQLND_INC_CONN_STATISTIC_W_VALUE2(&conn->stats, STAT_CONNECT_SUCCESS, 1, STAT_OPENED_CONNECTIONS, 1); Modified: php/php-src/trunk/ext/mysqlnd/mysqlnd.c === --- php/php-src/trunk/ext/mysqlnd/mysqlnd.c 2009-12-15 17:33:06 UTC (rev 292179) +++ php/php-src/trunk/ext/mysqlnd/mysqlnd.c 2009-12-15 17:39:30 UTC (rev 292180) @@ -677,14 +677,8 @@ mysqlnd_local_infile_default(conn); { - unsigned int buf_size; - buf_size = MYSQLND_G(net_read_buffer_size); /* this is long, cast to unsigned int*/ - conn->m->set_client_option(conn, MYSQLND_OPT_NET_READ_BUFFER_SIZE, - (char *)&buf_size TSRMLS_CC); - - buf_size = MYSQLND_G(net_cmd_buffer_size); /* this is long, cast to unsigned int*/ - conn->m->set_client_option(conn, MYSQLND_OPT_NET_CMD_BUFFER_SIZE, - (char *)&buf_size TSRMLS_CC); + unsigned int buf_size = MYSQLND_G(net_cmd_buffer_size); /* this is long, cast to unsigned int*/ + conn->m->set_client_option(conn, MYSQLND_OPT_NET_CMD_BUFFER_SIZE, (char *)&buf_size TSRMLS_CC); } MYSQLND_INC_CONN_STATISTIC_W_VALUE2(&conn->stats, STAT_CONNECT_SUCCESS, 1, STAT_OPENED_CONNECTIONS, 1); -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] svn: /php/php-src/ branches/PHP_5_3/ext/mysqlnd/mysqlnd.c trunk/ext/mysqlnd/mysqlnd.c
andrey Fri, 11 Dec 2009 10:21:34 + Revision: http://svn.php.net/viewvc?view=revision&revision=291978 Log: remove stale comment Changed paths: U php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd.c U php/php-src/trunk/ext/mysqlnd/mysqlnd.c Modified: php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd.c === --- php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd.c 2009-12-11 10:18:00 UTC (rev 291977) +++ php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd.c 2009-12-11 10:21:34 UTC (rev 291978) @@ -446,7 +446,6 @@ PHPAPI void _mysqlnd_end_psession(MYSQLND *conn TSRMLS_DC) { DBG_ENTER("_mysqlnd_end_psession"); - /* The thd zval cache is always freed on request shutdown, so this has happened already */ DBG_VOID_RETURN; } /* }}} */ Modified: php/php-src/trunk/ext/mysqlnd/mysqlnd.c === --- php/php-src/trunk/ext/mysqlnd/mysqlnd.c 2009-12-11 10:18:00 UTC (rev 291977) +++ php/php-src/trunk/ext/mysqlnd/mysqlnd.c 2009-12-11 10:21:34 UTC (rev 291978) @@ -446,7 +446,6 @@ PHPAPI void _mysqlnd_end_psession(MYSQLND *conn TSRMLS_DC) { DBG_ENTER("_mysqlnd_end_psession"); - /* The thd zval cache is always freed on request shutdown, so this has happened already */ DBG_VOID_RETURN; } /* }}} */ -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-CVS] svn: /php/php-src/ branches/PHP_5_3/ext/mysqlnd/mysqlnd.c trunk/ext/mysqlnd/mysqlnd.c
Pierre Joye schrieb: On Thu, Dec 3, 2009 at 2:31 PM, Ulf Wendel wrote: Pierre Joye schrieb: On Thu, Dec 3, 2009 at 12:43 PM, Andrey Hristov wrote: When you see I commit the same thing again, I might have a reason, and then just don't freak out by disabling code with ifdef which makes the other part of the source that uses it wrong. I did not care anymore and simply makes the thing build again until you have actually fixed this issue. I also do not test using MYSQLND_DBG_ENABLED, I could do it if you need it (on various windows and ubuntu) Andrey has had already pushed an attempt to fix the original build issue: http://news.php.net/php.cvs/61138 . Are you saying it is not working? No, I only asked if you need more tests using this flag. Ah, cool, so the original issue is solved and the build works. Good news! In this particular case it would have made no difference to do both debug and non-debug builds. The original issue is not in the *DBG* macros. But of course, the more testing the better. Ideally test results would show up on some public place. The more have the chance to see them, the less work for the individual. Ulf -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-CVS] svn: /php/php-src/ branches/PHP_5_3/ext/mysqlnd/mysqlnd.c trunk/ext/mysqlnd/mysqlnd.c
On Thu, Dec 3, 2009 at 2:31 PM, Ulf Wendel wrote: > Pierre Joye schrieb: >> >> On Thu, Dec 3, 2009 at 12:43 PM, Andrey Hristov wrote: >> >>> When you see I commit the same thing >>> again, I might have a reason, and then just don't freak out by disabling >>> code with ifdef which makes the other part of the source that uses it >>> wrong. >> >> I did not care anymore and simply makes the thing build again until >> you have actually fixed this issue. I also do not test using >> MYSQLND_DBG_ENABLED, I could do it if you need it (on various windows >> and ubuntu) > > Andrey has had already pushed an attempt to fix the original build issue: > http://news.php.net/php.cvs/61138 . Are you saying it is not working? No, I only asked if you need more tests using this flag. Cheers, -- Pierre http://blog.thepimp.net | http://www.libgd.org -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-CVS] svn: /php/php-src/ branches/PHP_5_3/ext/mysqlnd/mysqlnd.c trunk/ext/mysqlnd/mysqlnd.c
Pierre Joye schrieb: On Thu, Dec 3, 2009 at 12:43 PM, Andrey Hristov wrote: When you see I commit the same thing again, I might have a reason, and then just don't freak out by disabling code with ifdef which makes the other part of the source that uses it wrong. I did not care anymore and simply makes the thing build again until you have actually fixed this issue. I also do not test using MYSQLND_DBG_ENABLED, I could do it if you need it (on various windows and ubuntu) Andrey has had already pushed an attempt to fix the original build issue: http://news.php.net/php.cvs/61138 . Are you saying it is not working? It is irrelevant if MYSLQND_EBG_ENABLED is 1 or 0, your commit http://news.php.net/php.cvs/61135 has broken the code. That change has removed the return statement from the function. Ulf -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-CVS] svn: /php/php-src/ branches/PHP_5_3/ext/mysqlnd/mysqlnd.c trunk/ext/mysqlnd/mysqlnd.c
On Thu, Dec 3, 2009 at 12:43 PM, Andrey Hristov wrote: > When you see I commit the same thing > again, I might have a reason, and then just don't freak out by disabling > code with ifdef which makes the other part of the source that uses it wrong. I did not care anymore and simply makes the thing build again until you have actually fixed this issue. I also do not test using MYSQLND_DBG_ENABLED, I could do it if you need it (on various windows and ubuntu). Cheers, -- Pierre http://blog.thepimp.net | http://www.libgd.org -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-CVS] svn: /php/php-src/ branches/PHP_5_3/ext/mysqlnd/mysqlnd.c trunk/ext/mysqlnd/mysqlnd.c
Pierre, Pierre Joye wrote: On Thu, Dec 3, 2009 at 11:49 AM, Andrey Hristov wrote: Pierre, _please_, don't touch what you don't fully understand, right? As it affects badly our testing ability, I will have to touch it again if necessary. Where can the results of this testing be seen? I have been explained this exact problem in the past already, and reverting my commit is really not the right thing to do as it introduces again the error. The easiest way to avoid that is to actually fix the error instead of reintroduce it again and again. Your commit has right syntax but is semantically wrong. These lines of code are currently not covered by tests, thus you did not see that the new code was incorrect and leading to crashes. When you see I commit the same thing again, I might have a reason, and then just don't freak out by disabling code with ifdef which makes the other part of the source that uses it wrong. Thanks for your work. Cheers, Best, Andrey -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-CVS] svn: /php/php-src/ branches/PHP_5_3/ext/mysqlnd/mysqlnd.c trunk/ext/mysqlnd/mysqlnd.c
On Thu, Dec 3, 2009 at 11:49 AM, Andrey Hristov wrote: > Pierre, > _please_, don't touch what you don't fully understand, right? As it affects badly our testing ability, I will have to touch it again if necessary. I have been explained this exact problem in the past already, and reverting my commit is really not the right thing to do as it introduces again the error. The easiest way to avoid that is to actually fix the error instead of reintroduce it again and again. Thanks for your work. Cheers, -- Pierre http://blog.thepimp.net | http://www.libgd.org -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] svn: /php/php-src/ branches/PHP_5_3/ext/mysqlnd/mysqlnd.c trunk/ext/mysqlnd/mysqlnd.c
andrey Thu, 03 Dec 2009 10:50:02 + Revision: http://svn.php.net/viewvc?view=revision&revision=291638 Log: Isvn-commit.2.tmp (Modified) Row 2Col 28 11:45 Ctrl-K H for help fix compilation on windows and with other compilers who don't like void* arithmetic Changed paths: U php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd.c U php/php-src/trunk/ext/mysqlnd/mysqlnd.c Modified: php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd.c === --- php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd.c 2009-12-03 10:41:20 UTC (rev 291637) +++ php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd.c 2009-12-03 10:50:02 UTC (rev 291638) @@ -2393,9 +2393,7 @@ if (!conn || plugin_id >= mysqlnd_plugin_count()) { return NULL; } -#if 0 - DBG_RETURN((void *)conn + sizeof(MYSQLND) + plugin_id * sizeof(void *)); -#endif + DBG_RETURN((void *)((char *)conn + sizeof(MYSQLND) + plugin_id * sizeof(void *))); } /* }}} */ Modified: php/php-src/trunk/ext/mysqlnd/mysqlnd.c === --- php/php-src/trunk/ext/mysqlnd/mysqlnd.c 2009-12-03 10:41:20 UTC (rev 291637) +++ php/php-src/trunk/ext/mysqlnd/mysqlnd.c 2009-12-03 10:50:02 UTC (rev 291638) @@ -2393,9 +2393,7 @@ if (!conn || plugin_id >= mysqlnd_plugin_count()) { return NULL; } -#if 0 - DBG_RETURN((void *)conn + sizeof(MYSQLND) + plugin_id * sizeof(void *)); -#endif + DBG_RETURN((void *)((char *)conn + sizeof(MYSQLND) + plugin_id * sizeof(void *))); } /* }}} */ -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-CVS] svn: /php/php-src/ branches/PHP_5_3/ext/mysqlnd/mysqlnd.c trunk/ext/mysqlnd/mysqlnd.c
Pierre, _please_, don't touch what you don't fully understand, right? This code is no debug, DBG_RETURN is a macro that is used for tracing but in case of non-debug builds is just a return. Your ifdef actually breaks the code! Don't hesitate to ask the maintainer to fix the code and if you get no answer from him, then go and _try_ to really fix it. Andrey Pierre Joye wrote: pajoye Thu, 03 Dec 2009 10:41:20 + Revision: http://svn.php.net/viewvc?view=revision&revision=291637 Log: - disable this debug code until it is actually fixed Changed paths: U php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd.c U php/php-src/trunk/ext/mysqlnd/mysqlnd.c Modified: php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd.c === --- php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd.c 2009-12-03 10:17:58 UTC (rev 291636) +++ php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd.c 2009-12-03 10:41:20 UTC (rev 291637) @@ -2393,7 +2393,9 @@ if (!conn || plugin_id >= mysqlnd_plugin_count()) { return NULL; } +#if 0 DBG_RETURN((void *)conn + sizeof(MYSQLND) + plugin_id * sizeof(void *)); +#endif } /* }}} */ Modified: php/php-src/trunk/ext/mysqlnd/mysqlnd.c === --- php/php-src/trunk/ext/mysqlnd/mysqlnd.c 2009-12-03 10:17:58 UTC (rev 291636) +++ php/php-src/trunk/ext/mysqlnd/mysqlnd.c 2009-12-03 10:41:20 UTC (rev 291637) @@ -2393,7 +2393,9 @@ if (!conn || plugin_id >= mysqlnd_plugin_count()) { return NULL; } +#if 0 DBG_RETURN((void *)conn + sizeof(MYSQLND) + plugin_id * sizeof(void *)); +#endif } /* }}} */ -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-CVS] svn: /php/php-src/ branches/PHP_5_3/ext/mysqlnd/mysqlnd.c trunk/ext/mysqlnd/mysqlnd.c
Pierre Joye wrote: like just now. Please fix this code, you can NOT do math ops on VOID. Well, gcc allows it or do you think I write code that doesn't compile with gcc? What is wronger? Code that crashes on all platforms or that works but doesn't compile on all platforms? Andrey On Thu, Dec 3, 2009 at 11:31 AM, Pierre Joye wrote: On Thu, Dec 3, 2009 at 10:43 AM, Andrey Hristov wrote: andrey Thu, 03 Dec 2009 09:43:26 + Revision: http://svn.php.net/viewvc?view=revision&revision=291633 Log: fix segfault introduced by Pierre in a recent commit Weird, did not fail ehre. However can you try to write valid code here, as it keeps break the builds, no matter the platfroms, and that makes php testing a real pain lately. :-/ Cheers, -- Pierre http://blog.thepimp.net | http://www.libgd.org -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] svn: /php/php-src/ branches/PHP_5_3/ext/mysqlnd/mysqlnd.c trunk/ext/mysqlnd/mysqlnd.c
pajoye Thu, 03 Dec 2009 10:41:20 + Revision: http://svn.php.net/viewvc?view=revision&revision=291637 Log: - disable this debug code until it is actually fixed Changed paths: U php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd.c U php/php-src/trunk/ext/mysqlnd/mysqlnd.c Modified: php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd.c === --- php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd.c 2009-12-03 10:17:58 UTC (rev 291636) +++ php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd.c 2009-12-03 10:41:20 UTC (rev 291637) @@ -2393,7 +2393,9 @@ if (!conn || plugin_id >= mysqlnd_plugin_count()) { return NULL; } +#if 0 DBG_RETURN((void *)conn + sizeof(MYSQLND) + plugin_id * sizeof(void *)); +#endif } /* }}} */ Modified: php/php-src/trunk/ext/mysqlnd/mysqlnd.c === --- php/php-src/trunk/ext/mysqlnd/mysqlnd.c 2009-12-03 10:17:58 UTC (rev 291636) +++ php/php-src/trunk/ext/mysqlnd/mysqlnd.c 2009-12-03 10:41:20 UTC (rev 291637) @@ -2393,7 +2393,9 @@ if (!conn || plugin_id >= mysqlnd_plugin_count()) { return NULL; } +#if 0 DBG_RETURN((void *)conn + sizeof(MYSQLND) + plugin_id * sizeof(void *)); +#endif } /* }}} */ -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-CVS] svn: /php/php-src/ branches/PHP_5_3/ext/mysqlnd/mysqlnd.c trunk/ext/mysqlnd/mysqlnd.c
like just now. Please fix this code, you can NOT do math ops on VOID. On Thu, Dec 3, 2009 at 11:31 AM, Pierre Joye wrote: > On Thu, Dec 3, 2009 at 10:43 AM, Andrey Hristov wrote: >> andrey Thu, 03 Dec 2009 09:43:26 + >> >> Revision: http://svn.php.net/viewvc?view=revision&revision=291633 >> >> Log: >> fix segfault introduced by Pierre in a recent commit > > Weird, did not fail ehre. However can you try to write valid code > here, as it keeps break the builds, no matter the platfroms, and that > makes php testing a real pain lately. :-/ > > Cheers, > -- > Pierre > > http://blog.thepimp.net | http://www.libgd.org > -- Pierre http://blog.thepimp.net | http://www.libgd.org -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-CVS] svn: /php/php-src/ branches/PHP_5_3/ext/mysqlnd/mysqlnd.c trunk/ext/mysqlnd/mysqlnd.c
On Thu, Dec 3, 2009 at 10:43 AM, Andrey Hristov wrote: > andrey Thu, 03 Dec 2009 09:43:26 + > > Revision: http://svn.php.net/viewvc?view=revision&revision=291633 > > Log: > fix segfault introduced by Pierre in a recent commit Weird, did not fail ehre. However can you try to write valid code here, as it keeps break the builds, no matter the platfroms, and that makes php testing a real pain lately. :-/ Cheers, -- Pierre http://blog.thepimp.net | http://www.libgd.org -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] svn: /php/php-src/ branches/PHP_5_3/ext/mysqlnd/mysqlnd.c trunk/ext/mysqlnd/mysqlnd.c
andrey Thu, 03 Dec 2009 09:43:26 + Revision: http://svn.php.net/viewvc?view=revision&revision=291633 Log: fix segfault introduced by Pierre in a recent commit old code was doing something like conn + sizeof(MYSQLND) * MYSQLND + plugin * sizeof(void) * sizeof(MYSQLND) because `conn` is not casted to void*. `conn` has to be casted to void * and then the whole experession will be void * and the calculations will work. Changed paths: U php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd.c U php/php-src/trunk/ext/mysqlnd/mysqlnd.c Modified: php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd.c === --- php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd.c 2009-12-03 08:21:28 UTC (rev 291632) +++ php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd.c 2009-12-03 09:43:26 UTC (rev 291633) @@ -2393,7 +2393,7 @@ if (!conn || plugin_id >= mysqlnd_plugin_count()) { return NULL; } - DBG_RETURN((void *)(conn + sizeof(MYSQLND) + plugin_id * sizeof(void *))); + DBG_RETURN((void *)conn + sizeof(MYSQLND) + plugin_id * sizeof(void *)); } /* }}} */ Modified: php/php-src/trunk/ext/mysqlnd/mysqlnd.c === --- php/php-src/trunk/ext/mysqlnd/mysqlnd.c 2009-12-03 08:21:28 UTC (rev 291632) +++ php/php-src/trunk/ext/mysqlnd/mysqlnd.c 2009-12-03 09:43:26 UTC (rev 291633) @@ -2393,7 +2393,7 @@ if (!conn || plugin_id >= mysqlnd_plugin_count()) { return NULL; } - DBG_RETURN((void *)(conn + sizeof(MYSQLND) + plugin_id * sizeof(void *))); + DBG_RETURN((void *)conn + sizeof(MYSQLND) + plugin_id * sizeof(void *)); } /* }}} */ -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] svn: /php/php-src/ branches/PHP_5_3/ext/mysqlnd/mysqlnd.c trunk/ext/mysqlnd/mysqlnd.c
andrey Thu, 22 Oct 2009 17:36:12 + Revision: http://svn.php.net/viewvc?view=revision&revision=289859 Log: Don't forget to update the length too Changed paths: U php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd.c U php/php-src/trunk/ext/mysqlnd/mysqlnd.c Modified: php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd.c === --- php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd.c 2009-10-22 17:07:55 UTC (rev 289858) +++ php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd.c 2009-10-22 17:36:12 UTC (rev 289859) @@ -1299,6 +1299,7 @@ pefree(conn->connect_or_select_db, conn->persistent); } conn->connect_or_select_db = pestrndup(db, db_len, conn->persistent); + conn->connect_or_select_db_len = db_len; } DBG_RETURN(ret); } Modified: php/php-src/trunk/ext/mysqlnd/mysqlnd.c === --- php/php-src/trunk/ext/mysqlnd/mysqlnd.c 2009-10-22 17:07:55 UTC (rev 289858) +++ php/php-src/trunk/ext/mysqlnd/mysqlnd.c 2009-10-22 17:36:12 UTC (rev 289859) @@ -1299,6 +1299,7 @@ pefree(conn->connect_or_select_db, conn->persistent); } conn->connect_or_select_db = pestrndup(db, db_len, conn->persistent); + conn->connect_or_select_db_len = db_len; } DBG_RETURN(ret); } -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] svn: /php/php-src/ branches/PHP_5_3/ext/mysqlnd/mysqlnd.c trunk/ext/mysqlnd/mysqlnd.c
uw Thu, 08 Oct 2009 16:33:17 + Revision: http://svn.php.net/viewvc?view=revision&revision=289351 Log: Avoid buffer resizing and let the initial buffer allocation happen a couple of lines later with conn->m->set_client_option(conn, MYSQLND_OPT_NET_CMD_BUFFER_SIZE, ...). Andrey, I leave it to you to change the default size to 128k. Changed paths: U php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd.c U php/php-src/trunk/ext/mysqlnd/mysqlnd.c Modified: php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd.c === --- php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd.c 2009-10-08 16:30:16 UTC (rev 289350) +++ php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd.c 2009-10-08 16:33:17 UTC (rev 289351) @@ -757,8 +757,6 @@ SET_EMPTY_ERROR(conn->error_info); conn->zval_cache = mysqlnd_palloc_get_thd_cache_reference(zval_cache); - conn->net.cmd_buffer.length = 128L*1024L; - conn->net.cmd_buffer.buffer = mnd_pemalloc(conn->net.cmd_buffer.length, conn->persistent); mysqlnd_local_infile_default(conn); { Modified: php/php-src/trunk/ext/mysqlnd/mysqlnd.c === --- php/php-src/trunk/ext/mysqlnd/mysqlnd.c 2009-10-08 16:30:16 UTC (rev 289350) +++ php/php-src/trunk/ext/mysqlnd/mysqlnd.c 2009-10-08 16:33:17 UTC (rev 289351) @@ -757,8 +757,6 @@ SET_EMPTY_ERROR(conn->error_info); conn->zval_cache = mysqlnd_palloc_get_thd_cache_reference(zval_cache); - conn->net.cmd_buffer.length = 128L*1024L; - conn->net.cmd_buffer.buffer = mnd_pemalloc(conn->net.cmd_buffer.length, conn->persistent); mysqlnd_local_infile_default(conn); { -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] svn: /php/php-src/ branches/PHP_5_3/ext/mysqlnd/mysqlnd.c trunk/ext/mysqlnd/mysqlnd.c
uw Thu, 08 Oct 2009 11:40:16 + Revision: http://svn.php.net/viewvc?view=revision&revision=289339 Log: Fixing pconnect statistics. Changed paths: U php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd.c U php/php-src/trunk/ext/mysqlnd/mysqlnd.c Modified: php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd.c === --- php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd.c 2009-10-08 10:33:26 UTC (rev 289338) +++ php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd.c 2009-10-08 11:40:16 UTC (rev 289339) @@ -772,13 +772,12 @@ (char *)&buf_size TSRMLS_CC); } - MYSQLND_INC_CONN_STATISTIC(&conn->stats, STAT_CONNECT_SUCCESS); + MYSQLND_INC_CONN_STATISTIC_W_VALUE2(&conn->stats, STAT_CONNECT_SUCCESS, 1, STAT_OPENED_CONNECTIONS, 1); if (reconnect) { MYSQLND_INC_GLOBAL_STATISTIC(STAT_RECONNECT); } - MYSQLND_INC_CONN_STATISTIC(&conn->stats, STAT_OPENED_CONNECTIONS); if (conn->persistent) { - MYSQLND_INC_CONN_STATISTIC(&conn->stats, STAT_OPENED_PERSISTENT_CONNECTIONS); + MYSQLND_INC_CONN_STATISTIC_W_VALUE2(&conn->stats, STAT_PCONNECT_SUCCESS, 1, STAT_OPENED_PERSISTENT_CONNECTIONS, 1); } DBG_INF_FMT("connection_id=%llu", conn->thread_id); Modified: php/php-src/trunk/ext/mysqlnd/mysqlnd.c === --- php/php-src/trunk/ext/mysqlnd/mysqlnd.c 2009-10-08 10:33:26 UTC (rev 289338) +++ php/php-src/trunk/ext/mysqlnd/mysqlnd.c 2009-10-08 11:40:16 UTC (rev 289339) @@ -772,13 +772,12 @@ (char *)&buf_size TSRMLS_CC); } - MYSQLND_INC_CONN_STATISTIC(&conn->stats, STAT_CONNECT_SUCCESS); + MYSQLND_INC_CONN_STATISTIC_W_VALUE2(&conn->stats, STAT_CONNECT_SUCCESS, 1, STAT_OPENED_CONNECTIONS, 1); if (reconnect) { MYSQLND_INC_GLOBAL_STATISTIC(STAT_RECONNECT); } - MYSQLND_INC_CONN_STATISTIC(&conn->stats, STAT_OPENED_CONNECTIONS); if (conn->persistent) { - MYSQLND_INC_CONN_STATISTIC(&conn->stats, STAT_OPENED_PERSISTENT_CONNECTIONS); + MYSQLND_INC_CONN_STATISTIC_W_VALUE2(&conn->stats, STAT_PCONNECT_SUCCESS, 1, STAT_OPENED_PERSISTENT_CONNECTIONS, 1); } DBG_INF_FMT("connection_id=%llu", conn->thread_id); -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] svn: /php/php-src/ branches/PHP_5_3/ext/mysqlnd/mysqlnd.c trunk/ext/mysqlnd/mysqlnd.c
andrey Fri, 25 Sep 2009 10:37:44 + Revision: http://svn.php.net/viewvc?view=revision&revision=288741 Log: Fix possible crash when conn is NULL Changed paths: U php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd.c U php/php-src/trunk/ext/mysqlnd/mysqlnd.c Modified: php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd.c === --- php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd.c 2009-09-25 10:36:42 UTC (rev 288740) +++ php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd.c 2009-09-25 10:37:44 UTC (rev 288741) @@ -508,8 +508,8 @@ host?host:"", user?user:"", db?db:"", port, mysql_flags, conn? conn->persistent:0, conn? CONN_GET_STATE(conn):-1); - DBG_INF_FMT("state=%d", CONN_GET_STATE(conn)); if (conn && CONN_GET_STATE(conn) > CONN_ALLOCED && CONN_GET_STATE(conn) ) { + DBG_INF_FMT("state=%d", CONN_GET_STATE(conn)); DBG_INF("Connecting on a connected handle."); if (CONN_GET_STATE(conn) < CONN_QUIT_SENT) { Modified: php/php-src/trunk/ext/mysqlnd/mysqlnd.c === --- php/php-src/trunk/ext/mysqlnd/mysqlnd.c 2009-09-25 10:36:42 UTC (rev 288740) +++ php/php-src/trunk/ext/mysqlnd/mysqlnd.c 2009-09-25 10:37:44 UTC (rev 288741) @@ -508,8 +508,8 @@ host?host:"", user?user:"", db?db:"", port, mysql_flags, conn? conn->persistent:0, conn? CONN_GET_STATE(conn):-1); - DBG_INF_FMT("state=%d", CONN_GET_STATE(conn)); if (conn && CONN_GET_STATE(conn) > CONN_ALLOCED && CONN_GET_STATE(conn) ) { + DBG_INF_FMT("state=%d", CONN_GET_STATE(conn)); DBG_INF("Connecting on a connected handle."); if (CONN_GET_STATE(conn) < CONN_QUIT_SENT) { -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php