[PHP-CVS] svn: /php/php-src/branches/PHP_5_3/ext/mysqlnd/

2009-10-16 Thread Nuno Lopes
nlopess  Fri, 16 Oct 2009 10:51:29 +

Revision: http://svn.php.net/viewvc?view=revision&revision=289695

Log:
ignore php_mysqlnd_config.h file

Changed paths:
_U  php/php-src/branches/PHP_5_3/ext/mysqlnd/


Property changes on: php/php-src/branches/PHP_5_3/ext/mysqlnd
___
Modified: svn:ignore
   - #*#
*.dsw
*.la
*.lo
*.ncb
*.opt
*.plg
*.tgz
*~
#*
deps
libs
Debug
Debug_TS
Makefile
Makefile.fragments
Makefile.global
Makefile.objects
Release
Release_TS
Release_TSDbg
Release_TS_inline
Release_inline
acinclude.m4
aclocal.m4
autom4te.cache
build
config.cache
config.guess
config.h
config.h.in
config.log
config.nice
config.status
config.sub
configure
configure.in
conftest
conftest.c
include
install-sh
libtool
ltmain.sh
missing
mkinstalldirs
modules
scan_makefile_in.awk
*.gcda
*.gcno

   + #*#
*.dsw
*.la
*.lo
*.ncb
*.opt
*.plg
*.tgz
*~
#*
deps
libs
Debug
Debug_TS
Makefile
Makefile.fragments
Makefile.global
Makefile.objects
Release
Release_TS
Release_TSDbg
Release_TS_inline
Release_inline
acinclude.m4
aclocal.m4
autom4te.cache
build
config.cache
config.guess
config.h
config.h.in
config.log
config.nice
config.status
config.sub
configure
configure.in
conftest
conftest.c
include
install-sh
libtool
ltmain.sh
missing
mkinstalldirs
modules
scan_makefile_in.awk
*.gcda
*.gcno
php_mysqlnd_config.h


-- 
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.h

2009-08-03 Thread Andrey Hristov
andrey   Mon, 03 Aug 2009 14:46:11 +

Revision: http://svn.php.net/viewvc?view=revision&revision=286738

Log:
test

Changed paths:
U   php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd.h

Modified: php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd.h
===
--- php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd.h  2009-08-03 14:34:17 UTC 
(rev 286737)
+++ php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd.h  2009-08-03 14:46:11 UTC 
(rev 286738)
@@ -17,7 +17,6 @@
   |  Ulf Wendel   |
   +--+
 */
-
 /* $Id$ */

 #ifndef MYSQLND_H

-- 
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.h

2009-08-03 Thread Andrey Hristov
andrey   Mon, 03 Aug 2009 14:50:10 +

Revision: http://svn.php.net/viewvc?view=revision&revision=286739

Log:
test 2

Changed paths:
U   php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd.h

Modified: php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd.h
===
--- php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd.h  2009-08-03 14:46:11 UTC 
(rev 286738)
+++ php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd.h  2009-08-03 14:50:10 UTC 
(rev 286739)
@@ -28,7 +28,6 @@
 /* This forces inlining of some accessor functions */
 #define MYSQLND_USE_OPTIMISATIONS 1

-
 #define MYSQLND_STRING_TO_INT_CONVERSION
 /*
   This force mysqlnd to do a single (or more depending on ammount of data)

-- 
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_portability.h

2009-08-25 Thread Andrey Hristov
andrey   Tue, 25 Aug 2009 14:32:10 +

Revision: http://svn.php.net/viewvc?view=revision&revision=287698

Log:
MFH: fix of the fix

Changed paths:
U   php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_portability.h

Modified: php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_portability.h
===
--- php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_portability.h  
2009-08-25 14:31:29 UTC (rev 287697)
+++ php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_portability.h  
2009-08-25 14:32:10 UTC (rev 287698)
@@ -205,16 +205,20 @@
 #endif

 #ifndef MYSQLND_LL_SPEC
-#if SIZEOF_LONG == 8
-#define MYSQLND_LL_SPEC"%li"
+  #if SIZEOF_LONG == 8
+#define MYSQLND_LL_SPEC "%li"
+  #elif SIZEOF_LONG == 4
+#define MYSQLND_LL_SPEC "%lli"
+  #endif
 #endif
-#endif

 #ifndef MYSQLND_LLU_SPEC
-#if SIZEOF_LONG == 8
-#define MYSQLND_LLU_SPEC   "%li"
-#endif
-#endif
+  #if SIZEOF_LONG == 8
+#define MYSQLND_LLU_SPEC "%lu"
+  #elif SIZEOF_LONG == 4
+#define MYSQLND_LLU_SPEC "%llu"
+   #endif
+#endif /* MYSQLND_LLU_SPEC*/


 #define MYSQLND_SZ_T_SPEC "%zd"

-- 
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_statistics.c

2011-01-19 Thread Andrey Hristov
andrey   Wed, 19 Jan 2011 18:09:17 +

Revision: http://svn.php.net/viewvc?view=revision&revision=307593

Log:
fix zts build

Changed paths:
U   php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_statistics.c

Modified: php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_statistics.c
===
--- php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_statistics.c   
2011-01-19 17:51:02 UTC (rev 307592)
+++ php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_statistics.c   
2011-01-19 18:09:17 UTC (rev 307593)
@@ -248,7 +248,6 @@
 {
*stats = calloc(1, sizeof(MYSQLND_STATS));
if (*stats == NULL) {
-   DBG_ENTER("mysqlnd_stats_init failed to calloc stats context");
return;
}
(*stats)->values = calloc(statistic_count, sizeof(uint64_t));

-- 
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.h

2011-02-25 Thread Andrey Hristov
andrey   Fri, 25 Feb 2011 12:52:46 +

Revision: http://svn.php.net/viewvc?view=revision&revision=308672

Log:
revert also the version_id

Changed paths:
U   php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd.h

Modified: php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd.h
===
--- php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd.h  2011-02-25 12:52:21 UTC 
(rev 308671)
+++ php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd.h  2011-02-25 12:52:46 UTC 
(rev 308672)
@@ -22,8 +22,8 @@
 #ifndef MYSQLND_H
 #define MYSQLND_H

-#define MYSQLND_VERSION "mysqlnd 5.0.9-dev - 20102224 - $Revision$"
-#define MYSQLND_VERSION_ID 50009
+#define MYSQLND_VERSION "mysqlnd 5.0.8-dev - 20102224 - $Revision$"
+#define MYSQLND_VERSION_ID 50008

 /* This forces inlining of some accessor functions */
 #define MYSQLND_USE_OPTIMISATIONS 0

-- 
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.h

2011-05-03 Thread Andrey Hristov
andrey   Tue, 03 May 2011 09:37:53 +

Revision: http://svn.php.net/viewvc?view=revision&revision=310735

Log:
extend the API in the backward compatible way

Changed paths:
U   php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd.h

Modified: php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd.h
===
--- php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd.h  2011-05-03 09:11:07 UTC 
(rev 310734)
+++ php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd.h  2011-05-03 09:37:53 UTC 
(rev 310735)
@@ -27,6 +27,7 @@

 /* This forces inlining of some accessor functions */
 #define MYSQLND_USE_OPTIMISATIONS 0
+#define AUTOCOMMIT_TX_COMMIT_ROLLBACK

 #define MYSQLND_STRING_TO_INT_CONVERSION
 /*

-- 
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_result.c

2011-09-05 Thread Andrey Hristov
andrey   Mon, 05 Sep 2011 15:37:58 +

Revision: http://svn.php.net/viewvc?view=revision&revision=316189

Log:
missing from previous commit for #55582

Bug: https://bugs.php.net/55582 (Closed) mysqli_num_rows() returns always 0 for 
unbuffered, when mysqlnd is used
  
Changed paths:
U   php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_result.c

Modified: php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_result.c
===
--- php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_result.c   2011-09-05 
15:29:45 UTC (rev 316188)
+++ php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_result.c   2011-09-05 
15:37:58 UTC (rev 316189)
@@ -616,19 +616,18 @@
 static unsigned long *
 mysqlnd_fetch_lengths_unbuffered(MYSQLND_RES * const result TSRMLS_DC)
 {
-   return result->lengths;
+   /* simulate output of libmysql */
+   return (!result->unbuf || result->unbuf->last_row_data || 
result->unbuf->eof_reached)? result->lengths:NULL;
 }
 /* }}} */


-#if !defined(MYSQLND_USE_OPTIMISATIONS) || MYSQLND_USE_OPTIMISATIONS == 0
 /* {{{ mysqlnd_res::fetch_lengths */
 PHPAPI unsigned long * _mysqlnd_fetch_lengths(MYSQLND_RES * const result 
TSRMLS_DC)
 {
return result->m.fetch_lengths? result->m.fetch_lengths(result 
TSRMLS_CC) : NULL;
 }
 /* }}} */
-#endif


 /* {{{ mysqlnd_fetch_row_unbuffered_c */

-- 
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.h

2011-10-14 Thread Andrey Hristov
andrey   Fri, 14 Oct 2011 14:12:16 +

Revision: http://svn.php.net/viewvc?view=revision&revision=318113

Log:
this should be decided by configure

Changed paths:
U   php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd.h

Modified: php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd.h
===
--- php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd.h  2011-10-14 14:03:06 UTC 
(rev 318112)
+++ php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd.h  2011-10-14 14:12:16 UTC 
(rev 318113)
@@ -28,7 +28,6 @@
 /* This forces inlining of some accessor functions */
 #define MYSQLND_USE_OPTIMISATIONS 0
 #define AUTOCOMMIT_TX_COMMIT_ROLLBACK
-#define MYSQLND_SSL_SUPPORTED

 #define MYSQLND_STRING_TO_INT_CONVERSION
 /*

-- 
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

2011-10-18 Thread Andrey Hristov
andrey   Tue, 18 Oct 2011 14:10:44 +

Revision: http://svn.php.net/viewvc?view=revision&revision=318185

Log:
move change_user closer to connect

Changed paths:
U   php/php-src/branches/PHP_5_3/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	2011-10-18 14:04:13 UTC (rev 318184)
+++ php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd.c	2011-10-18 14:10:44 UTC (rev 318185)
@@ -886,6 +886,144 @@
 /* }}} */


+/* {{{ mysqlnd_conn::change_user */
+static enum_func_status
+MYSQLND_METHOD(mysqlnd_conn, change_user)(MYSQLND * const conn,
+		  const char *user,
+		  const char *passwd,
+		  const char *db,
+		  zend_bool silent TSRMLS_DC)
+{
+	size_t user_len;
+	enum_func_status ret = FAIL;
+	MYSQLND_PACKET_CHG_USER_RESPONSE * chg_user_resp;
+	char buffer[MYSQLND_MAX_ALLOWED_USER_LEN + 1 + 1 + SCRAMBLE_LENGTH + MYSQLND_MAX_ALLOWED_DB_LEN + 1 + 2 /* charset*/ + 2];
+	char *p = buffer;
+	const MYSQLND_CHARSET * old_cs = conn->charset;
+
+	DBG_ENTER("mysqlnd_conn::change_user");
+	DBG_INF_FMT("conn=%llu user=%s passwd=%s db=%s silent=%u",
+conn->thread_id, user?user:"", passwd?"***":"null", db?db:"", (silent == TRUE)?1:0 );
+
+	SET_ERROR_AFF_ROWS(conn);
+
+	if (!user) {
+		user = "";
+	}
+	if (!passwd) {
+		passwd = "";
+	}
+	if (!db) {
+		db = "";
+	}
+
+	/* 1. user ASCIIZ */
+	user_len = MIN(strlen(user), MYSQLND_MAX_ALLOWED_USER_LEN);
+	memcpy(p, user, user_len);
+	p += user_len;
+	*p++ = '\0';
+
+	/* 2. password SCRAMBLE_LENGTH followed by the scramble or \0 */
+	if (passwd[0]) {
+		*p++ = SCRAMBLE_LENGTH;
+		php_mysqlnd_scramble((unsigned char *)p, conn->scramble, (unsigned char *)passwd);
+		p += SCRAMBLE_LENGTH;
+	} else {
+		*p++ = '\0';
+	}
+
+	/* 3. db ASCIIZ */
+	if (db[0]) {
+		size_t db_len = MIN(strlen(db), MYSQLND_MAX_ALLOWED_DB_LEN);
+		memcpy(p, db, db_len);
+		p += db_len;
+	}
+	*p++ = '\0';
+
+	/*
+	  4. request the current charset, or it will be reset to the system one.
+	  5.0 doesn't support it. Support added in 5.1.23 by fixing the following bug :
+	  Bug #30472 libmysql doesn't reset charset, insert_id after succ. mysql_change_user() call
+	*/
+	if (mysqlnd_get_server_version(conn) >= 50123) {
+		int2store(p, conn->charset->nr);
+		p+=2;
+	}
+
+	if (PASS != conn->m->simple_command(conn, COM_CHANGE_USER, buffer, p - buffer,
+	   PROT_LAST /* we will handle the OK packet*/,
+	   silent, TRUE TSRMLS_CC)) {
+		DBG_RETURN(FAIL);
+	}
+
+	chg_user_resp = conn->protocol->m.get_change_user_response_packet(conn->protocol, FALSE TSRMLS_CC);
+	if (!chg_user_resp) {
+		SET_OOM_ERROR(conn->error_info);
+		goto end;
+	}
+	ret = PACKET_READ(chg_user_resp, conn);
+	conn->error_info = chg_user_resp->error_info;
+
+	if (conn->error_info.error_no) {
+		ret = FAIL;
+		/*
+		  COM_CHANGE_USER is broken in 5.1. At least in 5.1.15 and 5.1.14, 5.1.11 is immune.
+		  bug#25371 mysql_change_user() triggers "packets out of sync"
+		  When it gets fixed, there should be one more check here
+		*/
+		if (mysqlnd_get_server_version(conn) > 50113L && mysqlnd_get_server_version(conn) < 50118L) {
+			MYSQLND_PACKET_OK * redundant_error_packet = conn->protocol->m.get_ok_packet(conn->protocol, FALSE TSRMLS_CC);
+			if (redundant_error_packet) {
+PACKET_READ(redundant_error_packet, conn);
+PACKET_FREE(redundant_error_packet);
+DBG_INF_FMT("Server is %u, buggy, sends two ERR messages", mysqlnd_get_server_version(conn));
+			} else {
+SET_OOM_ERROR(conn->error_info);
+			}
+		}
+	}
+	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 = tmp;
+
+		tmp = mnd_pestrdup(passwd, conn->persistent);
+		if (conn->passwd) {
+			mnd_pefree(conn->passwd, conn->persistent);
+		}
+		conn->passwd = tmp;
+
+		if (conn->last_message) {
+			mnd_pefree(conn->last_message, conn->persistent);
+			conn->last_message = NULL;
+		}
+		memset(&conn->upsert_status, 0, sizeof(conn->upsert_status));
+		/* set charset for old servers */
+		if (mysqlnd_get_server_version(conn) < 50123) {
+			ret = conn->m->set_charset(conn, old_cs->name TSRMLS_CC);
+		}
+	} else if (ret == FAIL && chg_user_resp->server_asked_323_auth == TRUE) {
+		/* old authentication with new server  !*/
+		DBG_ERR(mysqlnd_old_passwd);
+		SET_CLIENT_ERROR(conn->error_info, CR_UNKNOWN_ERROR, UNKNOWN_SQLSTATE, mysqlnd_old_passwd);
+	}
+end:
+	PACKET_FREE(chg_user_resp);
+
+	/*
+	  Here we should close all statements. Unbuffered queries should not be a
+	  problem as we won't allow sending COM_CHANGE_USER.
+	*/
+	DBG_INF(ret == PASS? "PASS":"FAIL");
+	DBG_RETURN(ret);
+}
+/* }}} */
+
+
 /* {{{ mysqlnd_conn::q

[PHP-CVS] svn: /php/php-src/branches/PHP_5_3/ext/mysqlnd/ mysqlnd_wireprotocol.c

2009-09-17 Thread Andrey Hristov
andrey   Thu, 17 Sep 2009 15:13:14 +

Revision: http://svn.php.net/viewvc?view=revision&revision=288411

Log:
MFH, a fix not included by the fix committed by Ulf.
pemalloc and then efree - too bad!
Sorry for committing in two passes, my big tree is already patched
with compressed.

Changed paths:
U   php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_wireprotocol.c

Modified: php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_wireprotocol.c
===
--- php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_wireprotocol.c 
2009-09-17 14:53:03 UTC (rev 288410)
+++ php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_wireprotocol.c 
2009-09-17 15:13:14 UTC (rev 288411)
@@ -1047,7 +1047,7 @@
p+=2;
/* Check for additional textual data */
if (packet->header.size  > (p - buf) && (len = 
php_mysqlnd_net_field_length(&p))) {
-   packet->info_or_local_file = mnd_pemalloc(len + 
1, conn->persistent);
+   packet->info_or_local_file = mnd_emalloc(len + 
1);
memcpy(packet->info_or_local_file, p, len);
packet->info_or_local_file[len] = '\0';
packet->info_or_local_file_len = len;

-- 
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_wireprotocol.c

2009-12-16 Thread Andrey Hristov
andrey   Wed, 16 Dec 2009 14:06:09 +

Revision: http://svn.php.net/viewvc?view=revision&revision=292211

Log:
Remove unneeded dereferences
(oops, committed the trunk changes from a wrong directory, which splitted
this commit).

Changed paths:
U   php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_wireprotocol.c

Modified: php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_wireprotocol.c
===
--- php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_wireprotocol.c 
2009-12-16 14:05:35 UTC (rev 292210)
+++ php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_wireprotocol.c 
2009-12-16 14:06:09 UTC (rev 292211)
@@ -599,11 +599,11 @@
 {
size_t to_read = count;
zend_uchar * p = buffer;
+   MYSQLND_NET * net = conn->net;

DBG_ENTER("mysqlnd_real_read");
 #ifdef MYSQLND_COMPRESSION_ENABLED
-   if (conn->net->compressed) {
-   MYSQLND_NET * net = conn->net;
+   if (net->compressed) {
if (net->uncompressed_data) {
size_t to_read_from_buffer = 
MIN(net->uncompressed_data->bytes_left(net->uncompressed_data), to_read);
DBG_INF_FMT("reading %u from uncompressed_data buffer", 
to_read_from_buffer);
@@ -623,7 +623,7 @@
size_t net_payload_size;
zend_uchar packet_no;

-   if (FAIL == conn->net->m.stream_read(conn, net_header, 
MYSQLND_HEADER_SIZE TSRMLS_CC)) {
+   if (FAIL == net->m.stream_read(conn, net_header, 
MYSQLND_HEADER_SIZE TSRMLS_CC)) {
DBG_RETURN(FAIL);
}
net_payload_size = uint3korr(net_header);
@@ -634,9 +634,6 @@

php_error(E_WARNING, "Packets out of order. 
Expected %d received %d. Packet size="MYSQLND_SZ_T_SPEC,
  
net->compressed_envelope_packet_no, packet_no, net_payload_size);
-#if 0
-   *(int *) NULL = 0;
-#endif
DBG_RETURN(FAIL);
}
net->compressed_envelope_packet_no++;
@@ -657,7 +654,7 @@
DBG_RETURN(PASS);
}
 #endif /* MYSQLND_COMPRESSION_ENABLED */
-   DBG_RETURN(conn->net->m.stream_read(conn, p, to_read TSRMLS_CC));
+   DBG_RETURN(net->m.stream_read(conn, p, to_read TSRMLS_CC));
 }
 /* }}} */

@@ -666,7 +663,7 @@
 static enum_func_status
 mysqlnd_read_header(MYSQLND * conn, mysqlnd_packet_header * header TSRMLS_DC)
 {
-   MYSQLND_NET *net = conn->net;
+   MYSQLND_NET * net = conn->net;
zend_uchar buffer[MYSQLND_HEADER_SIZE];

DBG_ENTER("mysqlnd_read_header_name");
@@ -681,8 +678,7 @@
 #ifdef MYSQLND_DUMP_HEADER_N_BODY
DBG_INF_FMT("HEADER: prot_packet_no=%d size=%3d", header->packet_no, 
header->size);
 #endif
-   MYSQLND_INC_CONN_STATISTIC_W_VALUE3(&conn->stats,
-   STAT_BYTES_RECEIVED, 
MYSQLND_HEADER_SIZE,
+   MYSQLND_INC_CONN_STATISTIC_W_VALUE2(&conn->stats,

STAT_PROTOCOL_OVERHEAD_IN, MYSQLND_HEADER_SIZE,
STAT_PACKETS_RECEIVED, 
1);

@@ -710,11 +706,7 @@
 static enum_func_status
 mysqlnd_read_body(MYSQLND *conn, mysqlnd_packet_header * header, zend_uchar * 
store_buf TSRMLS_DC)
 {
-   MYSQLND_NET *net = conn->net;
-
DBG_ENTER(mysqlnd_read_body_name);
-   DBG_INF_FMT("chunk_size=%d compression=%d", net->stream->chunk_size, 
net->compressed);
-
DBG_RETURN(mysqlnd_real_read(conn, store_buf, header->size 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_ps.c

2010-03-17 Thread Andrey Hristov
andrey   Wed, 17 Mar 2010 11:40:37 +

Revision: http://svn.php.net/viewvc?view=revision&revision=296315

Log:
fix valgrind warning introduced with the latest patch. The memory
should be calloc-ed, not malloced, because the code that uses the
stmt storage needs that.

Changed paths:
U   php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_ps.c

Modified: php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_ps.c
===
--- php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_ps.c   2010-03-17 
11:39:59 UTC (rev 296314)
+++ php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_ps.c   2010-03-17 
11:40:37 UTC (rev 296315)
@@ -2143,7 +2143,7 @@
 MYSQLND_STMT * _mysqlnd_stmt_init(MYSQLND * const conn TSRMLS_DC)
 {
size_t alloc_size = sizeof(MYSQLND_STMT) + mysqlnd_plugin_count() * 
sizeof(void *);
-   MYSQLND_STMT * ret = mnd_pemalloc(alloc_size, conn->persistent);
+   MYSQLND_STMT * ret = mnd_pecalloc(1, alloc_size, conn->persistent);
MYSQLND_STMT_DATA * stmt = ret->data = mnd_pecalloc(1, 
sizeof(MYSQLND_STMT_DATA), conn->persistent);

DBG_ENTER("_mysqlnd_stmt_init");

-- 
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_ps.c

2010-03-17 Thread Andrey Hristov
andrey   Wed, 17 Mar 2010 18:00:47 +

Revision: http://svn.php.net/viewvc?view=revision&revision=296331

Log:
Fix a bug that a statement that is reset doesn't clean
the wire properly (as it is done when the statement is closed).
If there is more that one result sets returned from the PS
(like a call to SP that returns at least one RSet next to the
status rset) then the line was blocked. PS Multi-Res is not supported
in any libmysql from a GA-ed MySQL.

Changed paths:
U   php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_ps.c

Modified: php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_ps.c
===
--- php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_ps.c   2010-03-17 
17:33:15 UTC (rev 296330)
+++ php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_ps.c   2010-03-17 
18:00:47 UTC (rev 296331)
@@ -1120,16 +1120,18 @@
  We have to call the appropriate use_result() or 
store_result() and
  clean.
*/
-   if (stmt->state == MYSQLND_STMT_WAITING_USE_OR_STORE) {
-   DBG_INF("fetching result set header");
-   stmt->default_rset_handler(s TSRMLS_CC);
-   stmt->state = MYSQLND_STMT_USER_FETCHING;
-   }
+   do {
+   if (stmt->state == MYSQLND_STMT_WAITING_USE_OR_STORE) {
+   DBG_INF("fetching result set header");
+   stmt->default_rset_handler(s TSRMLS_CC);
+   stmt->state = MYSQLND_STMT_USER_FETCHING;
+   }

-   if (stmt->result) {
-   DBG_INF("skipping result");
-   stmt->result->m.skip_result(stmt->result TSRMLS_CC);
-   }
+   if (stmt->result) {
+   DBG_INF("skipping result");
+   stmt->result->m.skip_result(stmt->result 
TSRMLS_CC);
+   }
+   } while (mysqlnd_stmt_more_results(s) && 
mysqlnd_stmt_next_result(s) == PASS);

/*
  Don't free now, let the result be usable. When the stmt will 
again be

-- 
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_debug.c

2010-03-17 Thread Andrey Hristov
andrey   Wed, 17 Mar 2010 18:08:25 +

Revision: http://svn.php.net/viewvc?view=revision&revision=296332

Log:
Fix for complaint from the Zend MM, efree of a NULL pointer.

Changed paths:
U   php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_debug.c

Modified: php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_debug.c
===
--- php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_debug.c2010-03-17 
18:00:47 UTC (rev 296331)
+++ php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_debug.c2010-03-17 
18:08:25 UTC (rev 296332)
@@ -828,7 +828,9 @@
DBG_INF_FMT("before: %lu", zend_memory_usage(persistent 
TSRMLS_CC));
}

-   pefree(ptr, persistent);
+   if (ptr) {
+   pefree(ptr, persistent);
+   }

if (persistent == FALSE) {
DBG_INF_FMT("after : %lu", zend_memory_usage(persistent 
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_wireprotocol.h

2010-03-23 Thread Kalle Sommer Nielsen
kalleTue, 23 Mar 2010 13:21:22 +

Revision: http://svn.php.net/viewvc?view=revision&revision=296669

Log:
Fix declaring

Changed paths:
U   php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_wireprotocol.h

Modified: php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_wireprotocol.h
===
--- php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_wireprotocol.h 
2010-03-23 12:17:10 UTC (rev 296668)
+++ php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_wireprotocol.h 
2010-03-23 13:21:22 UTC (rev 296669)
@@ -268,7 +268,7 @@


 PHPAPI MYSQLND_PROTOCOL * mysqlnd_protocol_init(zend_bool persistent 
TSRMLS_DC);
-PHPAPI void mysqlnd_protocol_free(MYSQLND_PROTOCOL * net TSRMLS_DC);
+PHPAPI void mysqlnd_protocol_free(MYSQLND_PROTOCOL * const protocol TSRMLS_DC)


 #endif /* MYSQLND_WIREPROTOCOL_H */

-- 
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_wireprotocol.h

2010-03-24 Thread Andrey Hristov
andrey   Wed, 24 Mar 2010 10:06:42 +

Revision: http://svn.php.net/viewvc?view=revision&revision=296697

Log:
fix build failure after recent commit by Kalle

Changed paths:
U   php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_wireprotocol.h

Modified: php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_wireprotocol.h
===
--- php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_wireprotocol.h 
2010-03-24 10:01:00 UTC (rev 296696)
+++ php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_wireprotocol.h 
2010-03-24 10:06:42 UTC (rev 296697)
@@ -268,7 +268,7 @@


 PHPAPI MYSQLND_PROTOCOL * mysqlnd_protocol_init(zend_bool persistent 
TSRMLS_DC);
-PHPAPI void mysqlnd_protocol_free(MYSQLND_PROTOCOL * const protocol TSRMLS_DC)
+PHPAPI void mysqlnd_protocol_free(MYSQLND_PROTOCOL * const protocol TSRMLS_DC);


 #endif /* MYSQLND_WIREPROTOCOL_H */

-- 
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.h

2010-06-17 Thread Pierre Joye
pajoye   Thu, 17 Jun 2010 16:56:48 +

Revision: http://svn.php.net/viewvc?view=revision&revision=300533

Log:
- fix build

Changed paths:
U   php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd.h

Modified: php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd.h
===
--- php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd.h  2010-06-17 16:22:09 UTC 
(rev 300532)
+++ php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd.h  2010-06-17 16:56:48 UTC 
(rev 300533)
@@ -286,7 +286,7 @@
longdebug_realloc_fail_threshold;
 ZEND_END_MODULE_GLOBALS(mysqlnd)

-ZEND_EXTERN_MODULE_GLOBALS(mysqlnd);
+PHPAPI ZEND_DECLARE_MODULE_GLOBALS(mysqlnd);

 #ifdef ZTS
 #define MYSQLND_G(v) TSRMG(mysqlnd_globals_id, zend_mysqlnd_globals *, v)

-- 
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_result.c

2010-08-25 Thread Andrey Hristov
andrey   Wed, 25 Aug 2010 15:06:47 +

Revision: http://svn.php.net/viewvc?view=revision&revision=302776

Log:
Fix for bug #52221 Misbehaviour of magic_quotes_runtime (get/set))

Bug: http://bugs.php.net/52221 (Assigned) Misbehaviour of magic_quotes_runtime 
(get/set))
  
Changed paths:
U   php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_result.c

Modified: php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_result.c
===
--- php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_result.c   2010-08-25 
15:02:02 UTC (rev 302775)
+++ php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_result.c   2010-08-25 
15:06:47 UTC (rev 302776)
@@ -1540,6 +1540,8 @@
break;
default:exit(0);
}
+   } else if (extension == MYSQLND_MYSQLI && PG(magic_quotes_runtime)) {
+   php_error_docref(NULL TSRMLS_CC, E_ERROR, "magic_quotes_runtime 
are not supported by mysqlnd. They were deprecated in PHP 5.3 ");
}
/*
  return_value is IS_NULL for no more data and an array for data. Thus 
it's ok

-- 
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_debug.c

2010-11-15 Thread Pierre Joye
pajoye   Mon, 15 Nov 2010 23:46:21 +

Revision: http://svn.php.net/viewvc?view=revision&revision=305389

Log:
- fix build

Changed paths:
U   php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_debug.c

Modified: php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_debug.c
===
--- php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_debug.c2010-11-15 
23:26:25 UTC (rev 305388)
+++ php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_debug.c2010-11-15 
23:46:21 UTC (rev 305389)
@@ -497,20 +497,20 @@
"   min_in_calls=%5llu  
max_in_calls=%7llu  avg_in_calls=%7llu"
"   min_total=%5llu  
max_total=%7llu  avg_total=%7llu"
,string_key
-   ,(unsigned long long) 
f_profile->calls
-   ,(unsigned long long) 
f_profile->own_underporm_calls
-   ,(unsigned long long) 
f_profile->in_calls_underporm_calls
-   ,(unsigned long long) 
f_profile->total_underporm_calls
+   ,(uint64_t) f_profile->calls
+   ,(uint64_t) 
f_profile->own_underporm_calls
+   ,(uint64_t) 
f_profile->in_calls_underporm_calls
+   ,(uint64_t) 
f_profile->total_underporm_calls

-   ,(unsigned long long) 
f_profile->min_own
-   ,(unsigned long long) 
f_profile->max_own
-   ,(unsigned long long) 
f_profile->avg_own
-   ,(unsigned long long) 
f_profile->min_in_calls
-   ,(unsigned long long) 
f_profile->max_in_calls
-   ,(unsigned long long) 
f_profile->avg_in_calls
-   ,(unsigned long long) 
f_profile->min_total
-   ,(unsigned long long) 
f_profile->max_total
-   ,(unsigned long long) 
f_profile->avg_total
+   ,(uint64_t) f_profile->min_own
+   ,(uint64_t) f_profile->max_own
+   ,(uint64_t) f_profile->avg_own
+   ,(uint64_t) 
f_profile->min_in_calls
+   ,(uint64_t) 
f_profile->max_in_calls
+   ,(uint64_t) 
f_profile->avg_in_calls
+   ,(uint64_t) f_profile->min_total
+   ,(uint64_t) f_profile->max_total
+   ,(uint64_t) f_profile->avg_total
);

zend_hash_move_forward_ex(&self->function_profiles, &pos_values);
}

-- 
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_debug.h

2010-12-01 Thread Andrey Hristov
andrey   Wed, 01 Dec 2010 10:16:51 +

Revision: http://svn.php.net/viewvc?view=revision&revision=305878

Log:
add a comment

Changed paths:
U   php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_debug.h

Modified: php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_debug.h
===
--- php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_debug.h2010-12-01 
09:52:26 UTC (rev 305877)
+++ php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_debug.h2010-12-01 
10:16:51 UTC (rev 305878)
@@ -135,7 +135,7 @@
 #define DBG_RETURN_EX(dbg_obj, value) return (value)
 #define DBG_VOID_RETURN_EX(dbg_obj) return

-#endif
+#endif /* defined(__GNUC__) || (defined(_MSC_VER) && (_MSC_VER >= 1400)) */

 #if MYSQLND_DBG_ENABLED == 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_ps.c

2010-12-07 Thread Andrey Hristov
andrey   Tue, 07 Dec 2010 11:13:55 +

Revision: http://svn.php.net/viewvc?view=revision&revision=306051

Log:
switch this off for the release

Changed paths:
U   php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_ps.c

Modified: php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_ps.c
===
--- php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_ps.c   2010-12-07 
11:10:49 UTC (rev 306050)
+++ php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_ps.c   2010-12-07 
11:13:55 UTC (rev 306051)
@@ -561,7 +561,8 @@
}
}
}
-#ifndef MYSQLND_DONT_SKIP_OUT_PARAMS_RESULTSET
+/* #ifndef MYSQLND_DONT_SKIP_OUT_PARAMS_RESULTSET */
+#if A0
if (stmt->upsert_status.server_status & SERVER_PS_OUT_PARAMS) {
s->m->free_stmt_content(s TSRMLS_CC);
DBG_INF("PS OUT Variable RSet, skipping");

-- 
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_ps.c

2010-12-08 Thread Andrey Hristov
andrey   Wed, 08 Dec 2010 21:55:29 +

Revision: http://svn.php.net/viewvc?view=revision&revision=306095

Log:
enable again after 5.3.4 has already been tagged

Changed paths:
U   php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_ps.c

Modified: php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_ps.c
===
--- php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_ps.c   2010-12-08 
21:47:12 UTC (rev 306094)
+++ php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_ps.c   2010-12-08 
21:55:29 UTC (rev 306095)
@@ -561,8 +561,7 @@
}
}
}
-/* #ifndef MYSQLND_DONT_SKIP_OUT_PARAMS_RESULTSET */
-#if A0
+#ifndef MYSQLND_DONT_SKIP_OUT_PARAMS_RESULTSET
if (stmt->upsert_status.server_status & SERVER_PS_OUT_PARAMS) {
s->m->free_stmt_content(s TSRMLS_CC);
DBG_INF("PS OUT Variable RSet, skipping");

-- 
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.h mysqlnd_structs.h

2011-02-25 Thread Andrey Hristov
andrey   Fri, 25 Feb 2011 13:11:49 +

Revision: http://svn.php.net/viewvc?view=revision&revision=308673

Log:
use ifdef all-around in the revert

Changed paths:
U   php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd.h
U   php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_structs.h

Modified: php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd.h
===
--- php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd.h  2011-02-25 12:52:46 UTC 
(rev 308672)
+++ php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd.h  2011-02-25 13:11:49 UTC 
(rev 308673)
@@ -198,7 +198,7 @@
 PHPAPI void mysqlnd_set_local_infile_handler(MYSQLND * const conn, const char 
* const funcname);

 /* Simple commands */
-#if AUTOCOMMIT_TX_COMMIT_ROLLBACK
+#ifdef AUTOCOMMIT_TX_COMMIT_ROLLBACK
 #define mysqlnd_autocommit(conn, mode) 
(conn)->m->set_autocommit((conn), (mode) TSRMLS_CC)
 #define mysqlnd_commit(conn)   
(conn)->m->tx_commit((conn) TSRMLS_CC)
 #define mysqlnd_rollback(conn) 
(conn)->m->tx_rollback((conn) TSRMLS_CC)

Modified: php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_structs.h
===
--- php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_structs.h  2011-02-25 
12:52:46 UTC (rev 308672)
+++ php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_structs.h  2011-02-25 
13:11:49 UTC (rev 308673)
@@ -482,7 +482,7 @@
func_mysqlnd_conn__ssl_set ssl_set;

func_mysqlnd_conn__result_init result_init;
-#if AUTOCOMMIT_TX_COMMIT_ROLLBACK
+#ifdef AUTOCOMMIT_TX_COMMIT_ROLLBACK
func_mysqlnd_conn__set_autocommit set_autocommit;
func_mysqlnd_conn__tx_commit tx_commit;
func_mysqlnd_conn__tx_rollback tx_rollback;

-- 
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_wireprotocol.c

2009-09-17 Thread Pierre Joye
hi Andrey,

You can commit in many passes as long as you keep refer to the bug #,
so the revision link will show up in the tracker :)

Cheers,

On Thu, Sep 17, 2009 at 5:13 PM, Andrey Hristov  wrote:
> andrey                                   Thu, 17 Sep 2009 15:13:14 +
>
> Revision: http://svn.php.net/viewvc?view=revision&revision=288411
>
> Log:
> MFH, a fix not included by the fix committed by Ulf.
> pemalloc and then efree - too bad!
> Sorry for committing in two passes, my big tree is already patched
> with compressed.
>
> Changed paths:
>    U   php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_wireprotocol.c
>
> Modified: php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_wireprotocol.c
> ===
> --- php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_wireprotocol.c     
> 2009-09-17 14:53:03 UTC (rev 288410)
> +++ php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_wireprotocol.c     
> 2009-09-17 15:13:14 UTC (rev 288411)
> @@ -1047,7 +1047,7 @@
>                        p+=2;
>                        /* Check for additional textual data */
>                        if (packet->header.size  > (p - buf) && (len = 
> php_mysqlnd_net_field_length(&p))) {
> -                               packet->info_or_local_file = mnd_pemalloc(len 
> + 1, conn->persistent);
> +                               packet->info_or_local_file = mnd_emalloc(len 
> + 1);
>                                memcpy(packet->info_or_local_file, p, len);
>                                packet->info_or_local_file[len] = '\0';
>                                packet->info_or_local_file_len = len;
>
>
> --
> PHP CVS Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>



-- 
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/ config9.m4

2009-09-22 Thread Andrey Hristov
andrey   Tue, 22 Sep 2009 14:44:11 +

Revision: http://svn.php.net/viewvc?view=revision&revision=288575

Log:
MFH:Check for the different types and create the
corresponding configuration file, so it can be used
by mysqli, even if mysqlnd is not enabled at all.

Changed paths:
U   php/php-src/branches/PHP_5_3/ext/mysqlnd/config9.m4

Modified: php/php-src/branches/PHP_5_3/ext/mysqlnd/config9.m4
===
--- php/php-src/branches/PHP_5_3/ext/mysqlnd/config9.m4 2009-09-22 14:43:37 UTC 
(rev 288574)
+++ php/php-src/branches/PHP_5_3/ext/mysqlnd/config9.m4 2009-09-22 14:44:11 UTC 
(rev 288575)
@@ -18,8 +18,6 @@

   PHP_NEW_EXTENSION(mysqlnd, $mysqlnd_sources, no)
   PHP_ADD_BUILD_DIR([ext/mysqlnd], 1)
-  PHP_INSTALL_HEADERS([ext/mysqlnd])
-  PHP_INSTALL_HEADERS([$ext_builddir/php_mysqlnd_config.h])

   dnl Windows uses config.w32 thus this code is safe for now
   if test "$PHP_MYSQLND_THREADING" = "yes"; then
@@ -27,6 +25,10 @@
 AC_DEFINE([MYSQLND_THREADED], 1, [Use mysqlnd internal threading])
   fi

+fi
+  PHP_INSTALL_HEADERS([ext/mysqlnd])
+  PHP_INSTALL_HEADERS([$ext_builddir/php_mysqlnd_config.h])
+
   dnl This creates a file so it has to be after above macros
   PHP_CHECK_TYPES([int8 uint8 int16 uint16 int32 uint32 uchar ulong int8_t 
uint8_t int16_t uint16_t int32_t uint32_t int64_t uint64_t], [
 $ext_builddir/php_mysqlnd_config.h
@@ -38,4 +40,3 @@
 #include 
 #endif
   ])
-fi

-- 
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.h mysqlnd_portability.h

2010-08-16 Thread Andrey Hristov
andrey   Mon, 16 Aug 2010 09:44:13 +

Revision: http://svn.php.net/viewvc?view=revision&revision=302331

Log:
Sync with trunk, fixes build failure on MacOSX.
Fix for Bug #52417 MySQLi build failure with mysqlnd

Bug: http://bugs.php.net/52417 (Assigned) MySQLi build failure with mysqlnd
  
Changed paths:
U   php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd.h
U   php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_portability.h

Modified: php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd.h
===
--- php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd.h  2010-08-16 09:34:11 UTC 
(rev 302330)
+++ php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd.h  2010-08-16 09:44:13 UTC 
(rev 302331)
@@ -286,7 +286,7 @@
longdebug_realloc_fail_threshold;
 ZEND_END_MODULE_GLOBALS(mysqlnd)

-PHPAPI ZEND_DECLARE_MODULE_GLOBALS(mysqlnd);
+PHPAPI ZEND_EXTERN_MODULE_GLOBALS(mysqlnd);

 #ifdef ZTS
 #define MYSQLND_G(v) TSRMG(mysqlnd_globals_id, zend_mysqlnd_globals *, v)

Modified: php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_portability.h
===
--- php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_portability.h  
2010-08-16 09:34:11 UTC (rev 302330)
+++ php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_portability.h  
2010-08-16 09:44:13 UTC (rev 302331)
@@ -12,6 +12,8 @@
 #ifndef MYSQLND_PORTABILITY_H
 #define MYSQLND_PORTABILITY_H

+
+
 /* Comes from global.h as OFFSET, renamed to STRUCT_OFFSET */
 #define STRUCT_OFFSET(t, f)   ((size_t)(char *)&((t *)0)->f)


-- 
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_result.c

2010-08-25 Thread Adam Harvey
On 25 August 2010 23:06, Andrey Hristov  wrote:
> +               php_error_docref(NULL TSRMLS_CC, E_ERROR, 
> "magic_quotes_runtime are not supported by mysqlnd. They were deprecated in 
> PHP 5.3 ");

Is E_ERROR the appropriate level here? This could break code between
5.3 point releases. OK, you could argue that code is broken already,
but I think I'd be more comfortable with a warning.

Adam

--
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_result.c

2010-08-25 Thread Andrey Hristov

Adam Harvey wrote:

On 25 August 2010 23:06, Andrey Hristov  wrote:

+ Â  Â  Â  Â  Â  Â  Â  php_error_docref(NULL TSRMLS_CC, E_ERROR, 
"magic_quotes_runtime are not supported by mysqlnd. They were deprecated in PHP 5.3 
");


Is E_ERROR the appropriate level here? This could break code between
5.3 point releases. OK, you could argue that code is broken already,
but I think I'd be more comfortable with a warning.

Adam

Users might run with warnings disabled, but if the application doesn't 
run at all - due to E_ERROR, then they will definitely be notified and 
will take measures. According to Johannes this deficiency of current 
mysqlnd can lead to security problems.


Andrey

--
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 mysqlnd.h mysqlnd_structs.h

2011-02-25 Thread Andrey Hristov
andrey   Fri, 25 Feb 2011 12:52:21 +

Revision: http://svn.php.net/viewvc?view=revision&revision=308671

Log:
revert to previous behavior

Changed paths:
U   php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd.c
U   php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd.h
U   php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_structs.h

Modified: php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd.c
===
--- php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd.c  2011-02-25 12:34:00 UTC 
(rev 308670)
+++ php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd.c  2011-02-25 12:52:21 UTC 
(rev 308671)
@@ -2335,10 +2335,12 @@
MYSQLND_METHOD(mysqlnd_conn, send_close),

MYSQLND_METHOD(mysqlnd_conn, ssl_set),
-   mysqlnd_result_init,
-   MYSQLND_METHOD(mysqlnd_conn, set_autocommit),
+   mysqlnd_result_init
+#ifdef AUTOCOMMIT_TX_COMMIT_ROLLBACK
+   ,MYSQLND_METHOD(mysqlnd_conn, set_autocommit),
MYSQLND_METHOD(mysqlnd_conn, tx_commit),
MYSQLND_METHOD(mysqlnd_conn, tx_rollback)
+#endif
 MYSQLND_CLASS_METHODS_END;



Modified: php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd.h
===
--- php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd.h  2011-02-25 12:34:00 UTC 
(rev 308670)
+++ php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd.h  2011-02-25 12:52:21 UTC 
(rev 308671)
@@ -198,9 +198,15 @@
 PHPAPI void mysqlnd_set_local_infile_handler(MYSQLND * const conn, const char 
* const funcname);

 /* Simple commands */
+#if AUTOCOMMIT_TX_COMMIT_ROLLBACK
 #define mysqlnd_autocommit(conn, mode) 
(conn)->m->set_autocommit((conn), (mode) TSRMLS_CC)
 #define mysqlnd_commit(conn)   
(conn)->m->tx_commit((conn) TSRMLS_CC)
 #define mysqlnd_rollback(conn) 
(conn)->m->tx_rollback((conn) TSRMLS_CC)
+#else
+#define mysqlnd_autocommit(conn, mode) (conn)->m->query((conn),(mode) 
? "SET AUTOCOMMIT=1":"SET AUTOCOMMIT=0", 16 TSRMLS_CC)
+#define mysqlnd_commit(conn)   
(conn)->m->query((conn), "COMMIT", sizeof("COMMIT")-1 TSRMLS_CC)
+#define mysqlnd_rollback(conn) 
(conn)->m->query((conn), "ROLLBACK", sizeof("ROLLBACK")-1 TSRMLS_CC)
+#endif
 #define mysqlnd_list_dbs(conn, wild)   (conn)->m->list_method((conn), 
wild? "SHOW DATABASES LIKE %s":"SHOW DATABASES", (wild), NULL TSRMLS_CC)
 #define mysqlnd_list_fields(conn, tab,wild)(conn)->m->list_fields((conn), 
(tab), (wild) TSRMLS_CC)
 #define mysqlnd_list_processes(conn)   (conn)->m->list_method((conn), 
"SHOW PROCESSLIST", NULL, NULL TSRMLS_CC)

Modified: php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_structs.h
===
--- php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_structs.h  2011-02-25 
12:34:00 UTC (rev 308670)
+++ php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_structs.h  2011-02-25 
12:52:21 UTC (rev 308671)
@@ -482,9 +482,11 @@
func_mysqlnd_conn__ssl_set ssl_set;

func_mysqlnd_conn__result_init result_init;
+#if AUTOCOMMIT_TX_COMMIT_ROLLBACK
func_mysqlnd_conn__set_autocommit set_autocommit;
func_mysqlnd_conn__tx_commit tx_commit;
func_mysqlnd_conn__tx_rollback tx_rollback;
+#endif
 };



-- 
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_statistics.c mysqlnd_statistics.h mysqlnd_structs.h

2010-01-11 Thread Andrey Hristov
andrey   Mon, 11 Jan 2010 12:37:42 +

Revision: http://svn.php.net/viewvc?view=revision&revision=293402

Log:
missed to commit to the branch

Changed paths:
U   php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_statistics.c
U   php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_statistics.h
U   php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_structs.h

Modified: php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_statistics.c
===
--- php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_statistics.c   
2010-01-11 12:34:10 UTC (rev 293401)
+++ php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_statistics.c   
2010-01-11 12:37:42 UTC (rev 293402)
@@ -240,7 +240,8 @@
 mysqlnd_stats_init(MYSQLND_STATS ** stats)
 {
*stats = calloc(1, sizeof(MYSQLND_STATS));
-   (*stats)->handlers = calloc(STAT_LAST, sizeof(mysqlnd_stat_handler));
+   (*stats)->triggers = calloc(STAT_LAST, sizeof(mysqlnd_stat_trigger));
+   (*stats)->in_trigger = FALSE;
 #ifdef ZTS
(*stats)->LOCK_access = tsrm_mutex_alloc();
 #endif
@@ -256,13 +257,46 @@
 #ifdef ZTS
tsrm_mutex_free(stats->LOCK_access);
 #endif
-   free(stats->handlers);
+   free(stats->triggers);
/* mnd_free will reference LOCK_access and crash...*/
free(stats);
 }
 /* }}} */


+/* {{{ mysqlnd_stats_set_trigger */
+PHPAPI mysqlnd_stat_trigger
+mysqlnd_stats_set_trigger(MYSQLND_STATS * const stats, 
enum_mysqlnd_collected_stats stat, mysqlnd_stat_trigger trigger TSRMLS_DC)
+{
+   mysqlnd_stat_trigger ret = NULL;
+   DBG_ENTER("mysqlnd_stats_set_trigger");
+   if (stats) {
+   MYSQLND_STATS_LOCK(stats);
+   ret = stats->triggers[stat];
+   stats->triggers[stat] = trigger;
+   MYSQLND_STATS_UNLOCK(stats);
+   }
+   DBG_RETURN(ret);
+}
+/* }}} */
+
+
+/* {{{ mysqlnd_stats_set_handler */
+PHPAPI mysqlnd_stat_trigger
+mysqlnd_stats_reset_triggers(MYSQLND_STATS * const stats TSRMLS_DC)
+{
+   mysqlnd_stat_trigger ret = NULL;
+   DBG_ENTER("mysqlnd_stats_reset_trigger");
+   if (stats) {
+   MYSQLND_STATS_LOCK(stats);
+   memset(stats->triggers, 0, STAT_LAST * 
sizeof(mysqlnd_stat_trigger));
+   MYSQLND_STATS_UNLOCK(stats);
+   }
+   DBG_RETURN(ret);
+}
+/* }}} */
+
+
 /*
  * Local variables:
  * tab-width: 4

Modified: php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_statistics.h
===
--- php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_statistics.h   
2010-01-11 12:34:10 UTC (rev 293401)
+++ php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_statistics.h   
2010-01-11 12:37:42 UTC (rev 293402)
@@ -43,10 +43,10 @@
 #endif

 #define MYSQLND_CHECK_AND_CALL_HANDLER(stats, statistic, value) \
-   if ((stats)->handlers[(statistic)] && 
(stats)->in_handler == FALSE) { \
-   (stats)->in_handler = TRUE; \
-   (stats)->handlers[(statistic)]((stats), 
(statistic), (value) TSRMLS_CC); \
-   (stats)->in_handler = FALSE; \
+   if ((stats)->triggers[(statistic)] && 
(stats)->in_trigger == FALSE) { \
+   (stats)->in_trigger = TRUE; \
+   (stats)->triggers[(statistic)]((stats), 
(statistic), (value) TSRMLS_CC); \
+   (stats)->in_trigger = FALSE; \
} \


@@ -223,6 +223,10 @@
 PHPAPI void mysqlnd_stats_init(MYSQLND_STATS ** stats);
 PHPAPI void mysqlnd_stats_end(MYSQLND_STATS * stats);

+PHPAPI mysqlnd_stat_trigger mysqlnd_stats_set_trigger(MYSQLND_STATS * const 
stats, enum_mysqlnd_collected_stats stat, mysqlnd_stat_trigger trigger 
TSRMLS_DC);
+PHPAPI mysqlnd_stat_trigger mysqlnd_stats_reset_triggers(MYSQLND_STATS * const 
stats TSRMLS_DC);
+
+
 #endif /* MYSQLND_STATISTICS_H */



Modified: php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_structs.h
===
--- php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_structs.h  2010-01-11 
12:34:10 UTC (rev 293401)
+++ php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_structs.h  2010-01-11 
12:37:42 UTC (rev 293402)
@@ -210,13 +210,13 @@

 typedef struct st_mysqlnd_stats MYSQLND_STATS;

-typedef void (*mysqlnd_stat_handler)(MYSQLND_STATS * stats, 
enum_mysqlnd_collected_stats stat, int64_t change TSRMLS_DC);
+typedef void (*mysqlnd_stat_trigger)(MYSQLND_STATS * stats, 
enum_mysqlnd_collected_stats stat, int64_t change TSRMLS_DC);

 struct st_mysqlnd_stats
 {
uint64_tvalues[STAT_LAST];
-   mysqlnd_stat_handler*handlers;
-   zend_bool   in_handler;
+   mysqlnd_stat_trigger*triggers;
+   zend_bool   in_tr

[PHP-CVS] svn: /php/php-src/ branches/PHP_5_3/ext/mysqlnd/mysqlnd_enum_n_def.h trunk/ext/mysqlnd/mysqlnd_enum_n_def.h

2011-01-10 Thread Andrey Hristov
andrey   Mon, 10 Jan 2011 15:14:56 +

Revision: http://svn.php.net/viewvc?view=revision&revision=307340

Log:
new flag

Changed paths:
U   php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_enum_n_def.h
U   php/php-src/trunk/ext/mysqlnd/mysqlnd_enum_n_def.h

Modified: php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_enum_n_def.h
===
--- php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_enum_n_def.h   
2011-01-10 13:07:21 UTC (rev 307339)
+++ php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_enum_n_def.h   
2011-01-10 15:14:56 UTC (rev 307340)
@@ -92,6 +92,7 @@
 #define CLIENT_MULTI_STATEMENTS(1UL << 16) /* Enable/disable 
multi-stmt support */
 #define CLIENT_MULTI_RESULTS   (1UL << 17) /* Enable/disable 
multi-results */
 #define CLIENT_PS_MULTI_RESULTS(1UL << 18) /* Multi-results in 
PS-protocol */
+#define CLIENT_PLUGIN_AUTH (1UL << 19) /* Client supports 
plugin authentication */

 #define CLIENT_SSL_VERIFY_SERVER_CERT (1UL << 30)


Modified: php/php-src/trunk/ext/mysqlnd/mysqlnd_enum_n_def.h
===
--- php/php-src/trunk/ext/mysqlnd/mysqlnd_enum_n_def.h  2011-01-10 13:07:21 UTC 
(rev 307339)
+++ php/php-src/trunk/ext/mysqlnd/mysqlnd_enum_n_def.h  2011-01-10 15:14:56 UTC 
(rev 307340)
@@ -92,6 +92,7 @@
 #define CLIENT_MULTI_STATEMENTS(1UL << 16) /* Enable/disable 
multi-stmt support */
 #define CLIENT_MULTI_RESULTS   (1UL << 17) /* Enable/disable 
multi-results */
 #define CLIENT_PS_MULTI_RESULTS(1UL << 18) /* Multi-results in 
PS-protocol */
+#define CLIENT_PLUGIN_AUTH (1UL << 19) /* Client supports 
plugin authentication */

 #define CLIENT_SSL_VERIFY_SERVER_CERT (1UL << 30)


-- 
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_statistics.c trunk/ext/mysqlnd/mysqlnd_statistics.c

2011-01-17 Thread Pierre Joye
pajoye   Mon, 17 Jan 2011 14:07:40 +

Revision: http://svn.php.net/viewvc?view=revision&revision=307538

Log:
- don't try to access if calloc fails (quick review of its usage: seems that 
the stats member is validated in other places, to be confirmed)

Changed paths:
U   php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_statistics.c
U   php/php-src/trunk/ext/mysqlnd/mysqlnd_statistics.c

Modified: php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_statistics.c
===
--- php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_statistics.c   
2011-01-17 14:01:01 UTC (rev 307537)
+++ php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_statistics.c   
2011-01-17 14:07:40 UTC (rev 307538)
@@ -247,6 +247,10 @@
 mysqlnd_stats_init(MYSQLND_STATS ** stats, size_t statistic_count)
 {
*stats = calloc(1, sizeof(MYSQLND_STATS));
+   if (*stats == NULL) {
+   DBG_ENTER("mysqlnd_stats_init failed to calloc stats context");
+   return;
+   }
(*stats)->values = calloc(statistic_count, sizeof(uint64_t));
(*stats)->triggers = calloc(statistic_count, 
sizeof(mysqlnd_stat_trigger));
(*stats)->in_trigger = FALSE;

Modified: php/php-src/trunk/ext/mysqlnd/mysqlnd_statistics.c
===
--- php/php-src/trunk/ext/mysqlnd/mysqlnd_statistics.c  2011-01-17 14:01:01 UTC 
(rev 307537)
+++ php/php-src/trunk/ext/mysqlnd/mysqlnd_statistics.c  2011-01-17 14:07:40 UTC 
(rev 307538)
@@ -245,6 +245,10 @@
 mysqlnd_stats_init(MYSQLND_STATS ** stats, size_t statistic_count)
 {
*stats = calloc(1, sizeof(MYSQLND_STATS));
+   if (*stats == NULL) {
+   DBG_ENTER("mysqlnd_stats_init failed to calloc stats context");
+   return;
+   }
(*stats)->values = calloc(statistic_count, sizeof(uint64_t));
(*stats)->triggers = calloc(statistic_count, 
sizeof(mysqlnd_stat_trigger));
(*stats)->in_trigger = FALSE;

-- 
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_ps.c trunk/ext/mysqlnd/mysqlnd_ps.c

2011-01-17 Thread Pierre Joye
pajoye   Mon, 17 Jan 2011 14:01:01 +

Revision: http://svn.php.net/viewvc?view=revision&revision=307537

Log:
- fix NULL derefencing

Changed paths:
U   php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_ps.c
U   php/php-src/trunk/ext/mysqlnd/mysqlnd_ps.c

Modified: php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_ps.c
===
--- php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_ps.c   2011-01-17 
13:44:54 UTC (rev 307536)
+++ php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_ps.c   2011-01-17 
14:01:01 UTC (rev 307537)
@@ -735,7 +735,7 @@

DBG_ENTER("mysqlnd_fetch_stmt_row_buffered");
*fetched_anything = FALSE;
-   DBG_INF_FMT("stmt=%lu", stmt->stmt_id);
+   DBG_INF_FMT("stmt=%lu", stmt != NULL ? stmt->stmt_id : 0L);

/* If we haven't read everything */
if (set->data_cursor &&
@@ -2223,9 +2223,9 @@
 static enum_func_status
 MYSQLND_METHOD(mysqlnd_stmt, dtor)(MYSQLND_STMT * const s, zend_bool implicit 
TSRMLS_DC)
 {
-   MYSQLND_STMT_DATA * stmt = s? s->data:NULL;
+   MYSQLND_STMT_DATA * stmt = (s == NULL) ? s->data:NULL;
enum_func_status ret = FAIL;
-   zend_bool persistent = s->persistent;
+   zend_bool persistent = (s == NULL) ? s->persistent : 0;

DBG_ENTER("mysqlnd_stmt::dtor");
if (stmt) {

Modified: php/php-src/trunk/ext/mysqlnd/mysqlnd_ps.c
===
--- php/php-src/trunk/ext/mysqlnd/mysqlnd_ps.c  2011-01-17 13:44:54 UTC (rev 
307536)
+++ php/php-src/trunk/ext/mysqlnd/mysqlnd_ps.c  2011-01-17 14:01:01 UTC (rev 
307537)
@@ -735,7 +735,7 @@

DBG_ENTER("mysqlnd_fetch_stmt_row_buffered");
*fetched_anything = FALSE;
-   DBG_INF_FMT("stmt=%lu", stmt->stmt_id);
+   DBG_INF_FMT("stmt=%lu", stmt != NULL ? stmt->stmt_id : 0L);

/* If we haven't read everything */
if (set->data_cursor &&
@@ -2223,9 +2223,9 @@
 static enum_func_status
 MYSQLND_METHOD(mysqlnd_stmt, dtor)(MYSQLND_STMT * const s, zend_bool implicit 
TSRMLS_DC)
 {
-   MYSQLND_STMT_DATA * stmt = s? s->data:NULL;
+   MYSQLND_STMT_DATA * stmt = (s == NULL) ? s->data:NULL;
enum_func_status ret = FAIL;
-   zend_bool persistent = s->persistent;
+   zend_bool persistent = (s == NULL) ? s->persistent : 0;

DBG_ENTER("mysqlnd_stmt::dtor");
if (stmt) {

-- 
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_ps.c trunk/ext/mysqlnd/mysqlnd_ps.c

2011-01-18 Thread Pierre Joye
pajoye   Tue, 18 Jan 2011 10:29:26 +

Revision: http://svn.php.net/viewvc?view=revision&revision=307558

Log:
- fix the fix (wrong test)

Changed paths:
U   php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_ps.c
U   php/php-src/trunk/ext/mysqlnd/mysqlnd_ps.c

Modified: php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_ps.c
===
--- php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_ps.c   2011-01-18 
07:28:30 UTC (rev 307557)
+++ php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_ps.c   2011-01-18 
10:29:26 UTC (rev 307558)
@@ -2223,9 +2223,9 @@
 static enum_func_status
 MYSQLND_METHOD(mysqlnd_stmt, dtor)(MYSQLND_STMT * const s, zend_bool implicit 
TSRMLS_DC)
 {
-   MYSQLND_STMT_DATA * stmt = (s == NULL) ? s->data:NULL;
+   MYSQLND_STMT_DATA * stmt = (s != NULL) ? s->data:NULL;
enum_func_status ret = FAIL;
-   zend_bool persistent = (s == NULL) ? s->persistent : 0;
+   zend_bool persistent = (s != NULL) ? s->persistent : 0;

DBG_ENTER("mysqlnd_stmt::dtor");
if (stmt) {

Modified: php/php-src/trunk/ext/mysqlnd/mysqlnd_ps.c
===
--- php/php-src/trunk/ext/mysqlnd/mysqlnd_ps.c  2011-01-18 07:28:30 UTC (rev 
307557)
+++ php/php-src/trunk/ext/mysqlnd/mysqlnd_ps.c  2011-01-18 10:29:26 UTC (rev 
307558)
@@ -2223,9 +2223,9 @@
 static enum_func_status
 MYSQLND_METHOD(mysqlnd_stmt, dtor)(MYSQLND_STMT * const s, zend_bool implicit 
TSRMLS_DC)
 {
-   MYSQLND_STMT_DATA * stmt = (s == NULL) ? s->data:NULL;
+   MYSQLND_STMT_DATA * stmt = (s != NULL) ? s->data:NULL;
enum_func_status ret = FAIL;
-   zend_bool persistent = (s == NULL) ? s->persistent : 0;
+   zend_bool persistent = (s != NULL) ? s->persistent : 0;

DBG_ENTER("mysqlnd_stmt::dtor");
if (stmt) {

-- 
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_enum_n_def.h trunk/ext/mysqlnd/mysqlnd_enum_n_def.h

2011-01-31 Thread Andrey Hristov
andrey   Mon, 31 Jan 2011 13:52:21 +

Revision: http://svn.php.net/viewvc?view=revision&revision=307883

Log:
Add two new enums constants from the server

Changed paths:
U   php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_enum_n_def.h
U   php/php-src/trunk/ext/mysqlnd/mysqlnd_enum_n_def.h

Modified: php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_enum_n_def.h
===
--- php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_enum_n_def.h   
2011-01-31 13:29:18 UTC (rev 307882)
+++ php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_enum_n_def.h   
2011-01-31 13:52:21 UTC (rev 307883)
@@ -157,6 +157,8 @@
MYSQL_REPORT_DATA_TRUNCATION,
MYSQL_OPT_RECONNECT,
MYSQL_OPT_SSL_VERIFY_SERVER_CERT,
+   MYSQL_PLUGIN_DIR,
+   MYSQL_DEFAULT_AUTH,
 #if MYSQLND_UNICODE
MYSQLND_OPT_NUMERIC_AND_DATETIME_AS_UNICODE = 200,
 #endif

Modified: php/php-src/trunk/ext/mysqlnd/mysqlnd_enum_n_def.h
===
--- php/php-src/trunk/ext/mysqlnd/mysqlnd_enum_n_def.h  2011-01-31 13:29:18 UTC 
(rev 307882)
+++ php/php-src/trunk/ext/mysqlnd/mysqlnd_enum_n_def.h  2011-01-31 13:52:21 UTC 
(rev 307883)
@@ -162,6 +162,8 @@
MYSQL_REPORT_DATA_TRUNCATION,
MYSQL_OPT_RECONNECT,
MYSQL_OPT_SSL_VERIFY_SERVER_CERT,
+   MYSQL_PLUGIN_DIR,
+   MYSQL_DEFAULT_AUTH,
 #if MYSQLND_UNICODE
MYSQLND_OPT_NUMERIC_AND_DATETIME_AS_UNICODE = 200,
 #endif

-- 
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_ps.c trunk/ext/mysqlnd/mysqlnd_ps.c

2011-02-01 Thread Andrey Hristov
andrey   Tue, 01 Feb 2011 16:55:20 +

Revision: http://svn.php.net/viewvc?view=revision&revision=307921

Log:
fix warnings. These checks are not needed because
param_no is unsigned, it wasn't in the beginning.

Changed paths:
U   php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_ps.c
U   php/php-src/trunk/ext/mysqlnd/mysqlnd_ps.c

Modified: php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_ps.c
===
--- php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_ps.c   2011-02-01 
16:35:26 UTC (rev 307920)
+++ php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_ps.c   2011-02-01 
16:55:20 UTC (rev 307921)
@@ -1477,7 +1477,7 @@
DBG_RETURN(FAIL);
}

-   if (param_no < 0 || param_no >= stmt->param_count) {
+   if (param_no >= stmt->param_count) {
SET_STMT_ERROR(stmt, CR_INVALID_PARAMETER_NO, UNKNOWN_SQLSTATE, 
"Invalid parameter number");
DBG_ERR("invalid param_no");
DBG_RETURN(FAIL);
@@ -1617,7 +1617,7 @@
DBG_RETURN(FAIL);
}

-   if (param_no < 0 || param_no >= stmt->field_count) {
+   if (param_no >= stmt->field_count) {
SET_STMT_ERROR(stmt, CR_INVALID_PARAMETER_NO, UNKNOWN_SQLSTATE, 
"Invalid parameter number");
DBG_ERR("invalid param_no");
DBG_RETURN(FAIL);

Modified: php/php-src/trunk/ext/mysqlnd/mysqlnd_ps.c
===
--- php/php-src/trunk/ext/mysqlnd/mysqlnd_ps.c  2011-02-01 16:35:26 UTC (rev 
307920)
+++ php/php-src/trunk/ext/mysqlnd/mysqlnd_ps.c  2011-02-01 16:55:20 UTC (rev 
307921)
@@ -1477,7 +1477,7 @@
DBG_RETURN(FAIL);
}

-   if (param_no < 0 || param_no >= stmt->param_count) {
+   if (param_no >= stmt->param_count) {
SET_STMT_ERROR(stmt, CR_INVALID_PARAMETER_NO, UNKNOWN_SQLSTATE, 
"Invalid parameter number");
DBG_ERR("invalid param_no");
DBG_RETURN(FAIL);
@@ -1617,7 +1617,7 @@
DBG_RETURN(FAIL);
}

-   if (param_no < 0 || param_no >= stmt->field_count) {
+   if (param_no >= stmt->field_count) {
SET_STMT_ERROR(stmt, CR_INVALID_PARAMETER_NO, UNKNOWN_SQLSTATE, 
"Invalid parameter number");
DBG_ERR("invalid param_no");
DBG_RETURN(FAIL);

-- 
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_loaddata.c trunk/ext/mysqlnd/mysqlnd_loaddata.c

2011-02-01 Thread Andrey Hristov
andrey   Tue, 01 Feb 2011 19:30:22 +

Revision: http://svn.php.net/viewvc?view=revision&revision=307931

Log:
Fix more warnings about size_t

Changed paths:
U   php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_loaddata.c
U   php/php-src/trunk/ext/mysqlnd/mysqlnd_loaddata.c

Modified: php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_loaddata.c
===
--- php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_loaddata.c 2011-02-01 
19:03:05 UTC (rev 307930)
+++ php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_loaddata.c 2011-02-01 
19:30:22 UTC (rev 307931)
@@ -212,7 +212,7 @@

/* read data */
while ((bufsize = infile.local_infile_read (info, buf + 
MYSQLND_HEADER_SIZE, buflen - MYSQLND_HEADER_SIZE TSRMLS_CC)) > 0) {
-   if ((ret = conn->net->m.send(conn, buf, bufsize TSRMLS_CC)) < 
0) {
+   if ((ret = conn->net->m.send(conn, buf, bufsize TSRMLS_CC)) == 
0) {
DBG_ERR_FMT("Error during read : %d %s %s", 
CR_SERVER_LOST, UNKNOWN_SQLSTATE, lost_conn);
SET_CLIENT_ERROR(conn->error_info, CR_SERVER_LOST, 
UNKNOWN_SQLSTATE, lost_conn);
goto infile_error;
@@ -220,7 +220,7 @@
}

/* send empty packet for eof */
-   if ((ret = conn->net->m.send(conn, empty_packet, 0 TSRMLS_CC)) < 0) {
+   if ((ret = conn->net->m.send(conn, empty_packet, 0 TSRMLS_CC)) == 0) {
SET_CLIENT_ERROR(conn->error_info, CR_SERVER_LOST, 
UNKNOWN_SQLSTATE, lost_conn);
goto infile_error;
}

Modified: php/php-src/trunk/ext/mysqlnd/mysqlnd_loaddata.c
===
--- php/php-src/trunk/ext/mysqlnd/mysqlnd_loaddata.c2011-02-01 19:03:05 UTC 
(rev 307930)
+++ php/php-src/trunk/ext/mysqlnd/mysqlnd_loaddata.c2011-02-01 19:30:22 UTC 
(rev 307931)
@@ -212,7 +212,7 @@

/* read data */
while ((bufsize = infile.local_infile_read (info, buf + 
MYSQLND_HEADER_SIZE, buflen - MYSQLND_HEADER_SIZE TSRMLS_CC)) > 0) {
-   if ((ret = conn->net->m.send(conn, buf, bufsize TSRMLS_CC)) < 
0) {
+   if ((ret = conn->net->m.send(conn, buf, bufsize TSRMLS_CC)) == 
0) {
DBG_ERR_FMT("Error during read : %d %s %s", 
CR_SERVER_LOST, UNKNOWN_SQLSTATE, lost_conn);
SET_CLIENT_ERROR(conn->error_info, CR_SERVER_LOST, 
UNKNOWN_SQLSTATE, lost_conn);
goto infile_error;
@@ -220,7 +220,7 @@
}

/* send empty packet for eof */
-   if ((ret = conn->net->m.send(conn, empty_packet, 0 TSRMLS_CC)) < 0) {
+   if ((ret = conn->net->m.send(conn, empty_packet, 0 TSRMLS_CC)) == 0) {
SET_CLIENT_ERROR(conn->error_info, CR_SERVER_LOST, 
UNKNOWN_SQLSTATE, lost_conn);
goto infile_error;
}

-- 
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_result.c trunk/ext/mysqlnd/mysqlnd_result.c

2011-02-21 Thread Andrey Hristov
andrey   Mon, 21 Feb 2011 16:24:37 +

Revision: http://svn.php.net/viewvc?view=revision&revision=308540

Log:
fix invalid memory read. Thank you, valgrind

Changed paths:
U   php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_result.c
U   php/php-src/trunk/ext/mysqlnd/mysqlnd_result.c

Modified: php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_result.c
===
--- php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_result.c   2011-02-21 
15:56:25 UTC (rev 308539)
+++ php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_result.c   2011-02-21 
16:24:37 UTC (rev 308540)
@@ -1271,7 +1271,7 @@
/* libmysql's documentation says it should be so for SELECT 
statements */
conn->upsert_status.affected_rows = set->row_count;
}
-   DBG_INF_FMT("ret=%s row_count="MYSQLND_LLU_SPEC" warnings=%u 
server_status=%u",
+   DBG_INF_FMT("ret=%s row_count=%u warnings=%u server_status=%u",
ret == PASS? "PASS":"FAIL", (uint) 
set->row_count, conn->upsert_status.warning_count, 
conn->upsert_status.server_status);
 end:
PACKET_FREE(row_packet);

Modified: php/php-src/trunk/ext/mysqlnd/mysqlnd_result.c
===
--- php/php-src/trunk/ext/mysqlnd/mysqlnd_result.c  2011-02-21 15:56:25 UTC 
(rev 308539)
+++ php/php-src/trunk/ext/mysqlnd/mysqlnd_result.c  2011-02-21 16:24:37 UTC 
(rev 308540)
@@ -1271,7 +1271,7 @@
/* libmysql's documentation says it should be so for SELECT 
statements */
conn->upsert_status.affected_rows = set->row_count;
}
-   DBG_INF_FMT("ret=%s row_count="MYSQLND_LLU_SPEC" warnings=%u 
server_status=%u",
+   DBG_INF_FMT("ret=%s row_count=%u warnings=%u server_status=%u",
ret == PASS? "PASS":"FAIL", (uint) 
set->row_count, conn->upsert_status.warning_count, 
conn->upsert_status.server_status);
 end:
PACKET_FREE(row_packet);

-- 
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_result.c trunk/ext/mysqlnd/mysqlnd_result.c

2011-03-22 Thread Andrey Hristov
andrey   Tue, 22 Mar 2011 12:54:02 +

Revision: http://svn.php.net/viewvc?view=revision&revision=309557

Log:
remove more unneeded includes

Changed paths:
U   php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_result.c
U   php/php-src/trunk/ext/mysqlnd/mysqlnd_result.c

Modified: php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_result.c
===
--- php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_result.c   2011-03-22 
12:53:59 UTC (rev 309556)
+++ php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_result.c   2011-03-22 
12:54:02 UTC (rev 309557)
@@ -27,9 +27,7 @@
 #include "mysqlnd_result.h"
 #include "mysqlnd_result_meta.h"
 #include "mysqlnd_statistics.h"
-#include "mysqlnd_charset.h"
 #include "mysqlnd_debug.h"
-#include "ext/standard/basic_functions.h"

 #define MYSQLND_SILENT


Modified: php/php-src/trunk/ext/mysqlnd/mysqlnd_result.c
===
--- php/php-src/trunk/ext/mysqlnd/mysqlnd_result.c  2011-03-22 12:53:59 UTC 
(rev 309556)
+++ php/php-src/trunk/ext/mysqlnd/mysqlnd_result.c  2011-03-22 12:54:02 UTC 
(rev 309557)
@@ -27,9 +27,7 @@
 #include "mysqlnd_result.h"
 #include "mysqlnd_result_meta.h"
 #include "mysqlnd_statistics.h"
-#include "mysqlnd_charset.h"
 #include "mysqlnd_debug.h"
-#include "ext/standard/basic_functions.h"

 #define MYSQLND_SILENT


-- 
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_result.c trunk/ext/mysqlnd/mysqlnd_result.c

2011-03-22 Thread Andrey Hristov
andrey   Tue, 22 Mar 2011 14:39:58 +

Revision: http://svn.php.net/viewvc?view=revision&revision=309562

Log:
palloc is long dead, use more appropriate name

Changed paths:
U   php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_result.c
U   php/php-src/trunk/ext/mysqlnd/mysqlnd_result.c

Modified: php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_result.c
===
--- php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_result.c   2011-03-22 
14:39:36 UTC (rev 309561)
+++ php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_result.c   2011-03-22 
14:39:58 UTC (rev 309562)
@@ -84,11 +84,11 @@
 /* }}} */


-/* {{{ mysqlnd_palloc_zval_ptr_dtor */
-static
-void mysqlnd_palloc_zval_ptr_dtor(zval **zv, enum_mysqlnd_res_type type, 
zend_bool * copy_ctor_called TSRMLS_DC)
+/* {{{ mysqlnd_rset_zval_ptr_dtor */
+static void
+mysqlnd_rset_zval_ptr_dtor(zval **zv, enum_mysqlnd_res_type type, zend_bool * 
copy_ctor_called TSRMLS_DC)
 {
-   DBG_ENTER("mysqlnd_palloc_zval_ptr_dtor");
+   DBG_ENTER("mysqlnd_rset_zval_ptr_dtor");
if (!zv || !*zv) {
*copy_ctor_called = FALSE;
DBG_ERR_FMT("zv was NULL");
@@ -158,7 +158,7 @@

DBG_INF_FMT("%u columns to free", result->field_count);
for (i = 0; i < result->field_count; i++) {
-   
mysqlnd_palloc_zval_ptr_dtor(&(unbuf->last_row_data[i]), result->type, 
©_ctor_called TSRMLS_CC);
+   mysqlnd_rset_zval_ptr_dtor(&(unbuf->last_row_data[i]), 
result->type, ©_ctor_called TSRMLS_CC);
if (copy_ctor_called) {
++ctor_called_count;
}
@@ -212,7 +212,7 @@
for (col = field_count - 1; col >= 0; --col) {
if (current_row[col]) {
zend_bool copy_ctor_called;
-   
mysqlnd_palloc_zval_ptr_dtor(&(current_row[col]), result->type, 
©_ctor_called TSRMLS_CC);
+   
mysqlnd_rset_zval_ptr_dtor(&(current_row[col]), result->type, ©_ctor_called 
TSRMLS_CC);
 #if MYSQLND_DEBUG_MEMORY

DBG_INF_FMT("Copy_ctor_called=%u", copy_ctor_called);
 #endif

Modified: php/php-src/trunk/ext/mysqlnd/mysqlnd_result.c
===
--- php/php-src/trunk/ext/mysqlnd/mysqlnd_result.c  2011-03-22 14:39:36 UTC 
(rev 309561)
+++ php/php-src/trunk/ext/mysqlnd/mysqlnd_result.c  2011-03-22 14:39:58 UTC 
(rev 309562)
@@ -83,11 +83,11 @@
 /* }}} */


-/* {{{ mysqlnd_palloc_zval_ptr_dtor */
-static
-void mysqlnd_palloc_zval_ptr_dtor(zval **zv, enum_mysqlnd_res_type type, 
zend_bool * copy_ctor_called TSRMLS_DC)
+/* {{{ mysqlnd_rset_zval_ptr_dtor */
+static void
+mysqlnd_rset_zval_ptr_dtor(zval **zv, enum_mysqlnd_res_type type, zend_bool * 
copy_ctor_called TSRMLS_DC)
 {
-   DBG_ENTER("mysqlnd_palloc_zval_ptr_dtor");
+   DBG_ENTER("mysqlnd_rset_zval_ptr_dtor");
if (!zv || !*zv) {
*copy_ctor_called = FALSE;
DBG_ERR_FMT("zv was NULL");
@@ -155,7 +155,7 @@
MYSQLND_STATS *global_stats = result->conn? 
result->conn->stats:NULL;

for (i = 0; i < result->field_count; i++) {
-   
mysqlnd_palloc_zval_ptr_dtor(&(unbuf->last_row_data[i]), result->type, 
©_ctor_called TSRMLS_CC);
+   mysqlnd_rset_zval_ptr_dtor(&(unbuf->last_row_data[i]), 
result->type, ©_ctor_called TSRMLS_CC);
if (copy_ctor_called) {
++ctor_called_count;
}
@@ -207,7 +207,7 @@
for (col = field_count - 1; col >= 0; --col) {
if (current_row[col]) {
zend_bool copy_ctor_called;
-   
mysqlnd_palloc_zval_ptr_dtor(&(current_row[col]), result->type, 
©_ctor_called TSRMLS_CC);
+   
mysqlnd_rset_zval_ptr_dtor(&(current_row[col]), result->type, ©_ctor_called 
TSRMLS_CC);
if (copy_ctor_called) {

++copy_on_write_performed;
} else {

-- 
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_debug.h trunk/ext/mysqlnd/mysqlnd_debug.h

2011-05-04 Thread Andrey Hristov
andrey   Wed, 04 May 2011 19:09:12 +

Revision: http://svn.php.net/viewvc?view=revision&revision=310768

Log:
add the BLOCK_LEAVE macro for non-gcc and non-win

Changed paths:
U   php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_debug.h
U   php/php-src/trunk/ext/mysqlnd/mysqlnd_debug.h

Modified: php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_debug.h
===
--- php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_debug.h2011-05-04 
19:05:19 UTC (rev 310767)
+++ php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_debug.h2011-05-04 
19:09:12 UTC (rev 310768)
@@ -136,9 +136,10 @@
 static inline void DBG_INF_FMT_EX(MYSQLND_DEBUG * dbg_obj, ...) {}
 static inline void DBG_ERR_FMT_EX(MYSQLND_DEBUG * dbg_obj, ...) {}
 static inline void DBG_ENTER_EX(MYSQLND_DEBUG * dbg_obj, const char * const 
func_name) {}
-#define DBG_RETURN_EX(dbg_obj, value) return (value)
-#define DBG_VOID_RETURN_EX(dbg_obj) return
-#define DBG_BLOCK_LEAVE_EX(dbg_obj) ;
+#define DBG_BLOCK_ENTER(bname) {
+#define DBG_RETURN_EX(dbg_obj, value)  return (value)
+#define DBG_VOID_RETURN_EX(dbg_obj)return
+#define DBG_BLOCK_LEAVE_EX(dbg_obj)}

 #endif /* defined(__GNUC__) || (defined(_MSC_VER) && (_MSC_VER >= 1400)) */


Modified: php/php-src/trunk/ext/mysqlnd/mysqlnd_debug.h
===
--- php/php-src/trunk/ext/mysqlnd/mysqlnd_debug.h   2011-05-04 19:05:19 UTC 
(rev 310767)
+++ php/php-src/trunk/ext/mysqlnd/mysqlnd_debug.h   2011-05-04 19:09:12 UTC 
(rev 310768)
@@ -147,9 +147,10 @@
 static inline void DBG_INF_FMT_EX(MYSQLND_DEBUG * dbg_obj, ...) {}
 static inline void DBG_ERR_FMT_EX(MYSQLND_DEBUG * dbg_obj, ...) {}
 static inline void DBG_ENTER_EX(MYSQLND_DEBUG * dbg_obj, const char * const 
func_name) {}
-#define DBG_RETURN_EX(dbg_obj, value) return (value)
-#define DBG_VOID_RETURN_EX(dbg_obj) return
-#define DBG_BLOCK_LEAVE_EX(dbg_obj) ;
+#define DBG_BLOCK_ENTER(bname) {
+#define DBG_RETURN_EX(dbg_obj, value)  return (value)
+#define DBG_VOID_RETURN_EX(dbg_obj)return
+#define DBG_BLOCK_LEAVE_EX(dbg_obj)}

 #endif


-- 
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_debug.h trunk/ext/mysqlnd/mysqlnd_debug.h

2011-05-04 Thread Andrey Hristov
andrey   Wed, 04 May 2011 19:05:19 +

Revision: http://svn.php.net/viewvc?view=revision&revision=310767

Log:
reorganize the DBG_ macros, add DBG_BLOCK_XXX

Changed paths:
U   php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_debug.h
U   php/php-src/trunk/ext/mysqlnd/mysqlnd_debug.h

Modified: php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_debug.h
===
--- php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_debug.h2011-05-04 
18:14:25 UTC (rev 310766)
+++ php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_debug.h2011-05-04 
19:05:19 UTC (rev 310767)
@@ -90,6 +90,15 @@
 #define DBG_INF_FMT_EX(dbg_obj, ...)   do { if (dbg_skip_trace == FALSE) 
(dbg_obj)->m->log_va((dbg_obj), __LINE__, __FILE__, -1, "info : ", 
__VA_ARGS__); } while (0)
 #define DBG_ERR_FMT_EX(dbg_obj, ...)   do { if (dbg_skip_trace == FALSE) 
(dbg_obj)->m->log_va((dbg_obj), __LINE__, __FILE__, -1, "error: ", 
__VA_ARGS__); } while (0)

+#define DBG_BLOCK_ENTER_EX(dbg_obj, block_name) \
+   { \
+   DBG_ENTER_EX(dbg_obj, (block_name));
+
+#define DBG_BLOCK_LEAVE_EX(dbg_obj) \
+   DBG_LEAVE_EX((dbg_obj), ;) \
+   } \
+
+
 #define DBG_ENTER_EX(dbg_obj, func_name) \
struct timeval __dbg_prof_tp = {0}; \
uint64_t __dbg_prof_start = 0; /* 
initialization is needed */ \
@@ -103,7 +112,7 @@
} \
} while (0);

-#define DBG_RETURN_EX(dbg_obj, value)  \
+#define DBG_LEAVE_EX(dbg_obj, leave)   \
do {\
if ((dbg_obj)) { \
uint64_t this_call_duration = 0; \
@@ -112,20 +121,15 @@
} \
(dbg_obj)->m->func_leave((dbg_obj), 
__LINE__, __FILE__, this_call_duration); \
} \
-   return (value);\
-   } while (0)
-#define DBG_VOID_RETURN_EX(dbg_obj)\
-   do {\
-   if ((dbg_obj)) { \
-   uint64_t this_call_duration = 0; \
-   if ((dbg_obj)->flags & 
MYSQLND_DEBUG_PROFILE_CALLS) { \
-   
DBG_PROFILE_END_TIME(this_call_duration); \
-   } \
-   (dbg_obj)->m->func_leave((dbg_obj), 
__LINE__, __FILE__, this_call_duration); \
-   } \
-   return;\
-   } while (0)
+   leave \
+   } while (0);

+#define DBG_RETURN_EX(dbg_obj, value) DBG_LEAVE_EX(dbg_obj, return (value);)
+
+#define DBG_VOID_RETURN_EX(dbg_obj) DBG_LEAVE_EX(dbg_obj, return;)
+
+
+
 #else
 static inline void DBG_INF_EX(MYSQLND_DEBUG * dbg_obj, const char * const msg) 
{}
 static inline void DBG_ERR_EX(MYSQLND_DEBUG * dbg_obj, const char * const msg) 
{}
@@ -134,6 +138,7 @@
 static inline void DBG_ENTER_EX(MYSQLND_DEBUG * dbg_obj, const char * const 
func_name) {}
 #define DBG_RETURN_EX(dbg_obj, value) return (value)
 #define DBG_VOID_RETURN_EX(dbg_obj) return
+#define DBG_BLOCK_LEAVE_EX(dbg_obj) ;

 #endif /* defined(__GNUC__) || (defined(_MSC_VER) && (_MSC_VER >= 1400)) */

@@ -145,8 +150,10 @@
 #define DBG_ERR_FMT(...)   DBG_ERR_FMT_EX(MYSQLND_G(dbg), __VA_ARGS__)

 #define DBG_ENTER(func_name)   DBG_ENTER_EX(MYSQLND_G(dbg), (func_name))
+#define DBG_BLOCK_ENTER(bname) DBG_BLOCK_ENTER_EX(MYSQLND_G(dbg), (bname))
 #define DBG_RETURN(value)  DBG_RETURN_EX(MYSQLND_G(dbg), (value))
 #define DBG_VOID_RETURN
DBG_VOID_RETURN_EX(MYSQLND_G(dbg))
+#define DBG_BLOCK_LEAVE
DBG_BLOCK_LEAVE_EX(MYSQLND_G(dbg))

 #elif MYSQLND_DBG_ENABLED == 0

@@ -157,8 +164,10 @@
 static inline void DBG_INF_FMT(const char * const format, ...) {}
 static inline void DBG_ERR_FMT(const char * const format, ...) {}
 static inline void DBG_ENTER(const char * const func_name) {}
-#define DBG_RETURN(value)  return (value)
-#define DBG_VOID_RETURNreturn
+#define DBG_BLOCK_ENTER(bname) {
+#define DBG_RETURN(value)  return (value)
+#define DBG_VOID_RETURNreturn
+#define DBG_BLOCK_LEAVE}

 #endif


Modified: php/php-src/trunk/ext/mysqlnd/mysqlnd_debug.h
===
--- php/php-src/trunk/ext/mysqlnd/mysqlnd_debug.h   2011-05-04 18:14:25 UTC 
(rev 310766)
+++ php/php-src/trunk/ext/mysqlnd/mysqlnd_debug.h   2011-05-04 19:05:19 UTC 
(rev 310767)
@@ -101,6 +101,15 @@
 #define DBG_INF_FMT_EX(dbg_obj, ...)   do { 

[PHP-CVS] svn: /php/php-src/ branches/PHP_5_3/ext/mysqlnd/mysqlnd_charset.c trunk/ext/mysqlnd/mysqlnd_charset.c

2011-05-10 Thread Andrey Hristov
andrey   Tue, 10 May 2011 07:15:22 +

Revision: http://svn.php.net/viewvc?view=revision&revision=310876

Log:
Fix range
(thanks again nihen)

Changed paths:
U   php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_charset.c
U   php/php-src/trunk/ext/mysqlnd/mysqlnd_charset.c

Modified: php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_charset.c
===
--- php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_charset.c  2011-05-10 
07:06:29 UTC (rev 310875)
+++ php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_charset.c  2011-05-10 
07:15:22 UTC (rev 310876)
@@ -327,7 +327,7 @@

 /* {{{  functions */
 #define valid_sjis_head(c) ((0x81 <= (c) && (c) <= 0x9F) || (0xE0 <= (c) 
&& (c) <= 0xFC))
-#define valid_sjis_tail(c) ((0x40 <= (c) && (c) <= 0x7E) || (0x80 <= (c) 
&& (c) <= 0x7C))
+#define valid_sjis_tail(c) ((0x40 <= (c) && (c) <= 0x7E) || (0x80 <= (c) 
&& (c) <= 0xFC))


 static unsigned int check_mb_sjis(const char *start, const char *end)

Modified: php/php-src/trunk/ext/mysqlnd/mysqlnd_charset.c
===
--- php/php-src/trunk/ext/mysqlnd/mysqlnd_charset.c 2011-05-10 07:06:29 UTC 
(rev 310875)
+++ php/php-src/trunk/ext/mysqlnd/mysqlnd_charset.c 2011-05-10 07:15:22 UTC 
(rev 310876)
@@ -328,7 +328,7 @@

 /* {{{ sjis functions */
 #define valid_sjis_head(c) ((0x81 <= (c) && (c) <= 0x9F) || (0xE0 <= (c) 
&& (c) <= 0xFC))
-#define valid_sjis_tail(c) ((0x40 <= (c) && (c) <= 0x7E) || (0x80 <= (c) 
&& (c) <= 0x7C))
+#define valid_sjis_tail(c) ((0x40 <= (c) && (c) <= 0x7E) || (0x80 <= (c) 
&& (c) <= 0xFC))


 static unsigned int check_mb_sjis(const char *start, const char *end)

-- 
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_portability.h trunk/ext/mysqlnd/mysqlnd_portability.h

2009-09-23 Thread Dmitry Stogov
dmitry   Wed, 23 Sep 2009 08:33:23 +

Revision: http://svn.php.net/viewvc?view=revision&revision=288603

Log:
Fixed compilation error

Changed paths:
U   php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_portability.h
U   php/php-src/trunk/ext/mysqlnd/mysqlnd_portability.h

Modified: php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_portability.h
===
--- php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_portability.h  
2009-09-23 03:55:46 UTC (rev 288602)
+++ php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_portability.h  
2009-09-23 08:33:23 UTC (rev 288603)
@@ -9,6 +9,9 @@
   were added to improve the header file, to get it more consistent.
 */

+#ifndef MYSQLND_PORTABILITY_H
+#define MYSQLND_PORTABILITY_H
+
 /* Comes from global.h as OFFSET, renamed to STRUCT_OFFSET */
 #define STRUCT_OFFSET(t, f)   ((size_t)(char *)&((t *)0)->f)

@@ -497,6 +500,7 @@

 #endif /* WORDS_BIGENDIAN */

+#endif /* MYSQLND_PORTABILITY_H */


 /*

Modified: php/php-src/trunk/ext/mysqlnd/mysqlnd_portability.h
===
--- php/php-src/trunk/ext/mysqlnd/mysqlnd_portability.h 2009-09-23 03:55:46 UTC 
(rev 288602)
+++ php/php-src/trunk/ext/mysqlnd/mysqlnd_portability.h 2009-09-23 08:33:23 UTC 
(rev 288603)
@@ -9,6 +9,9 @@
   were added to improve the header file, to get it more consistent.
 */

+#ifndef MYSQLND_PORTABILITY_H
+#define MYSQLND_PORTABILITY_H
+
 /* Comes from global.h as OFFSET, renamed to STRUCT_OFFSET */
 #define STRUCT_OFFSET(t, f)   ((size_t)(char *)&((t *)0)->f)

@@ -497,6 +500,7 @@

 #endif /* WORDS_BIGENDIAN */

+#endif /* MYSQLND_PORTABILITY_H */


 /*

-- 
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

2009-09-25 Thread Andrey Hristov
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

[PHP-CVS] svn: /php/php-src/ branches/PHP_5_3/ext/mysqlnd/mysqlnd_result.c trunk/ext/mysqlnd/mysqlnd_result.c

2009-09-30 Thread Andrey Hristov
andrey   Wed, 30 Sep 2009 22:26:19 +

Revision: http://svn.php.net/viewvc?view=revision&revision=289027

Log:
Fix trace output. DBG_RETURN should be used in traced
functions.

Changed paths:
U   php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_result.c
U   php/php-src/trunk/ext/mysqlnd/mysqlnd_result.c

Modified: php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_result.c
===
--- php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_result.c   2009-09-30 
21:58:19 UTC (rev 289026)
+++ php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_result.c   2009-09-30 
22:26:19 UTC (rev 289027)
@@ -1882,9 +1882,9 @@

if (result->m.fetch_row) {
if (result->m.fetch_row == result->m.fetch_row_normal_buffered) 
{
-   return mysqlnd_fetch_row_buffered_c(result TSRMLS_CC);
+   DBG_RETURN(mysqlnd_fetch_row_buffered_c(result 
TSRMLS_CC));
} else if (result->m.fetch_row == 
result->m.fetch_row_normal_unbuffered) {
-   return mysqlnd_fetch_row_unbuffered_c(result TSRMLS_CC);
+   DBG_RETURN(mysqlnd_fetch_row_unbuffered_c(result 
TSRMLS_CC));
} else {
*((int*)NULL) = 1;
}

Modified: php/php-src/trunk/ext/mysqlnd/mysqlnd_result.c
===
--- php/php-src/trunk/ext/mysqlnd/mysqlnd_result.c  2009-09-30 21:58:19 UTC 
(rev 289026)
+++ php/php-src/trunk/ext/mysqlnd/mysqlnd_result.c  2009-09-30 22:26:19 UTC 
(rev 289027)
@@ -1882,9 +1882,9 @@

if (result->m.fetch_row) {
if (result->m.fetch_row == result->m.fetch_row_normal_buffered) 
{
-   return mysqlnd_fetch_row_buffered_c(result TSRMLS_CC);
+   DBG_RETURN(mysqlnd_fetch_row_buffered_c(result 
TSRMLS_CC));
} else if (result->m.fetch_row == 
result->m.fetch_row_normal_unbuffered) {
-   return mysqlnd_fetch_row_unbuffered_c(result TSRMLS_CC);
+   DBG_RETURN(mysqlnd_fetch_row_unbuffered_c(result 
TSRMLS_CC));
} else {
*((int*)NULL) = 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

2009-10-08 Thread Ulf Wendel
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

2009-10-08 Thread Ulf Wendel
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.h trunk/ext/mysqlnd/mysqlnd.h

2009-10-22 Thread Ulf Wendel
uw   Thu, 22 Oct 2009 16:10:02 +

Revision: http://svn.php.net/viewvc?view=revision&revision=289856

Log:
Updating mysqlnd version number.

Changed paths:
U   php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd.h
U   php/php-src/trunk/ext/mysqlnd/mysqlnd.h

Modified: php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd.h
===
--- php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd.h  2009-10-22 16:05:33 UTC 
(rev 289855)
+++ php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd.h  2009-10-22 16:10:02 UTC 
(rev 289856)
@@ -22,8 +22,8 @@
 #ifndef MYSQLND_H
 #define MYSQLND_H

-#define MYSQLND_VERSION "mysqlnd 5.0.5-dev - 081106 - $Revision$"
-#define MYSQLND_VERSION_ID 50005
+#define MYSQLND_VERSION "mysqlnd 5.0.6-dev - 091022 - $Revision$"
+#define MYSQLND_VERSION_ID 50006

 /* This forces inlining of some accessor functions */
 #define MYSQLND_USE_OPTIMISATIONS 0

Modified: php/php-src/trunk/ext/mysqlnd/mysqlnd.h
===
--- php/php-src/trunk/ext/mysqlnd/mysqlnd.h 2009-10-22 16:05:33 UTC (rev 
289855)
+++ php/php-src/trunk/ext/mysqlnd/mysqlnd.h 2009-10-22 16:10:02 UTC (rev 
289856)
@@ -22,8 +22,8 @@
 #ifndef MYSQLND_H
 #define MYSQLND_H

-#define MYSQLND_VERSION "mysqlnd 5.0.5-dev - 081106 - $Revision$"
-#define MYSQLND_VERSION_ID 50005
+#define MYSQLND_VERSION "mysqlnd 5.0.6-dev - 091022 - $Revision$"
+#define MYSQLND_VERSION_ID 50006

 /* This forces inlining of some accessor functions */
 #define MYSQLND_USE_OPTIMISATIONS 0

-- 
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

2009-10-22 Thread Andrey Hristov
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_result.c trunk/ext/mysqlnd/mysqlnd_result.c

2009-10-23 Thread Ulf Wendel
uw   Fri, 23 Oct 2009 12:44:05 +

Revision: http://svn.php.net/viewvc?view=revision&revision=289885

Log:
Fix: log slow queries in stats regardless of mysqlnd.log_mask setting.

Changed paths:
U   php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_result.c
U   php/php-src/trunk/ext/mysqlnd/mysqlnd_result.c

Modified: php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_result.c
===
--- php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_result.c   2009-10-23 
10:24:48 UTC (rev 289884)
+++ php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_result.c   2009-10-23 
12:44:05 UTC (rev 289885)
@@ -621,8 +621,8 @@
php_log_err(backtrace 
TSRMLS_CC);
efree(backtrace);
 #endif
-   
MYSQLND_INC_CONN_STATISTIC(&conn->stats, stat);
}
+   
MYSQLND_INC_CONN_STATISTIC(&conn->stats, stat);
}

PACKET_FREE_ALLOCA(fields_eof);

Modified: php/php-src/trunk/ext/mysqlnd/mysqlnd_result.c
===
--- php/php-src/trunk/ext/mysqlnd/mysqlnd_result.c  2009-10-23 10:24:48 UTC 
(rev 289884)
+++ php/php-src/trunk/ext/mysqlnd/mysqlnd_result.c  2009-10-23 12:44:05 UTC 
(rev 289885)
@@ -621,8 +621,8 @@
php_log_err(backtrace 
TSRMLS_CC);
efree(backtrace);
 #endif
-   
MYSQLND_INC_CONN_STATISTIC(&conn->stats, stat);
}
+   
MYSQLND_INC_CONN_STATISTIC(&conn->stats, stat);
}

PACKET_FREE_ALLOCA(fields_eof);

-- 
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_charset.c trunk/ext/mysqlnd/mysqlnd_charset.c

2009-11-24 Thread Andrey Hristov
andrey   Tue, 24 Nov 2009 13:59:56 +

Revision: http://svn.php.net/viewvc?view=revision&revision=291265

Log:
Update charset table

Changed paths:
U   php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_charset.c
U   php/php-src/trunk/ext/mysqlnd/mysqlnd_charset.c

Modified: php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_charset.c
===
--- php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_charset.c	2009-11-24 13:57:39 UTC (rev 291264)
+++ php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_charset.c	2009-11-24 13:59:56 UTC (rev 291265)
@@ -316,7 +316,7 @@
 	{  28, "gbk", "gbk_chinese_ci", 1, 2, "", mysqlnd_mbcharlen_gbk, check_mb_gbk},
 	{  30, "latin5", "latin5_turkish_ci", 1, 1, "", NULL, NULL},
 	{  32, "armscii8", "armscii8_general_ci", 1, 1, "", NULL, NULL},
-	{  33, "utf8", "utf8_general_ci", 1, 2, "UTF-8 Unicode", mysqlnd_mbcharlen_utf8,  check_mb_utf8_valid},
+	{  33, "utf8", "utf8_general_ci", 1, 3, "UTF-8 Unicode", mysqlnd_mbcharlen_utf8,  check_mb_utf8_valid},
 	{  35, "ucs2", "ucs2_general_ci", 2, 2, "UCS-2 Unicode", mysqlnd_mbcharlen_ucs2, check_mb_ucs2},
 	{  36, "cp866", "cp866_general_ci", 1, 1, "", NULL, NULL},
 	{  37, "keybcs2", "keybcs2_general_ci", 1, 1, "", NULL, NULL},
@@ -372,7 +372,7 @@
 	{  81, "cp852", "cp852_bin", 1, 1, "", NULL, NULL},
 	{  82, "swe7", "swe7_bin", 1, 1, "", NULL, NULL},
 	{  93, "geostd8", "geostd8_bin", 1, 1, "", NULL, NULL},
-	{  83, "utf8", "utf8_bin", 1, 2, "UTF-8 Unicode", mysqlnd_mbcharlen_utf8,  check_mb_utf8_valid},
+	{  83, "utf8", "utf8_bin", 1, 3, "UTF-8 Unicode", mysqlnd_mbcharlen_utf8,  check_mb_utf8_valid},
 	{  84, "big5", "big5_bin", 1, 2, "", mysqlnd_mbcharlen_big5, check_mb_big5},
 	{  85, "euckr", "euckr_bin", 1, 2, "", mysqlnd_mbcharlen_euckr, check_mb_euckr},
 	{  86, "gb2312", "gb2312_bin", 1, 2, "", mysqlnd_mbcharlen_gb2312, check_mb_gb2312},
@@ -424,7 +424,47 @@
 	{ 208, "utf8", "utf8_persian_ci", 1, 3, "", mysqlnd_mbcharlen_utf8, check_mb_utf8_valid},
 	{ 209, "utf8", "utf8_esperanto_ci", 1, 3, "", mysqlnd_mbcharlen_utf8, check_mb_utf8_valid},
 	{ 210, "utf8", "utf8_hungarian_ci", 1, 3, "", mysqlnd_mbcharlen_utf8, check_mb_utf8_valid},
-	{ 254, "utf8", "utf8_general_cs", 1, 3, "", mysqlnd_mbcharlen_utf8, check_mb_utf8_valid},
+	{ 192, "utf8mb3", "utf8mb3_general_ci", 1, 3, "", mysqlnd_mbcharlen_utf8, check_mb_utf8_valid},
+	{ 193, "utf8mb3", "utf8mb3_icelandic_ci", 1, 3, "", mysqlnd_mbcharlen_utf8, check_mb_utf8_valid},
+	{ 194, "utf8mb3", "utf8mb3_latvian_ci", 1, 3, "", mysqlnd_mbcharlen_utf8,  check_mb_utf8_valid},
+	{ 195, "utf8mb3", "utf8mb3_romanian_ci", 1, 3, "", mysqlnd_mbcharlen_utf8, check_mb_utf8_valid},
+	{ 196, "utf8mb3", "utf8mb3_slovenian_ci", 1, 3, "", mysqlnd_mbcharlen_utf8, check_mb_utf8_valid},
+	{ 197, "utf8mb3", "utf8mb3_polish_ci", 1, 3, "", mysqlnd_mbcharlen_utf8, check_mb_utf8_valid},
+	{ 198, "utf8mb3", "utf8mb3_estonian_ci", 1, 3, "", mysqlnd_mbcharlen_utf8, check_mb_utf8_valid},
+	{ 119, "utf8mb3", "utf8mb3_spanish_ci", 1, 3, "", mysqlnd_mbcharlen_utf8, check_mb_utf8_valid},
+	{ 200, "utf8mb3", "utf8mb3_swedish_ci", 1, 3, "", mysqlnd_mbcharlen_utf8, check_mb_utf8_valid},
+	{ 201, "utf8mb3", "utf8mb3_turkish_ci", 1, 3, "", mysqlnd_mbcharlen_utf8, check_mb_utf8_valid},
+	{ 202, "utf8mb3", "utf8mb3_czech_ci", 1, 3, "", mysqlnd_mbcharlen_utf8, check_mb_utf8_valid},
+	{ 203, "utf8mb3", "utf8mb3_danish_ci", 1, 3, "", mysqlnd_mbcharlen_utf8, check_mb_utf8_valid },
+	{ 204, "utf8mb3", "utf8mb3_lithunian_ci", 1, 3, "", mysqlnd_mbcharlen_utf8, check_mb_utf8_valid },
+	{ 205, "utf8mb3", "utf8mb3_slovak_ci", 1, 3, "", mysqlnd_mbcharlen_utf8, check_mb_utf8_valid},
+	{ 206, "utf8mb3", "utf8mb3_spanish2_ci", 1, 3, "", mysqlnd_mbcharlen_utf8, check_mb_utf8_valid},
+	{ 207, "utf8mb3", "utf8mb3_roman_ci", 1, 3, "", mysqlnd_mbcharlen_utf8, check_mb_utf8_valid},
+	{ 208, "utf8mb3", "utf8mb3_persian_ci", 1, 3, "", mysqlnd_mbcharlen_utf8, check_mb_utf8_valid},
+	{ 209, "utf8mb3", "utf8mb3_esperanto_ci", 1, 3, "", mysqlnd_mbcharlen_utf8, check_mb_utf8_valid},
+	{ 210, "utf8mb3", "utf8mb3_hungarian_ci", 1, 3, "", mysqlnd_mbcharlen_utf8, check_mb_utf8_valid},
+	{ 211, "utf8mb3", "utf8mb3_sinhala_ci", 1, 3, "", mysqlnd_mbcharlen_utf8, check_mb_utf8_valid},
+	{ 224, "utf8", "utf8_unicode_ci", 1, 4, "", mysqlnd_mbcharlen_utf8, check_mb_utf8_valid},
+	{ 225, "utf8", "utf8_icelandic_ci", 1, 4, "", mysqlnd_mbcharlen_utf8, check_mb_utf8_valid},
+	{ 226, "utf8", "utf8_latvian_ci", 1, 4, "", mysqlnd_mbcharlen_utf8, check_mb_utf8_valid},
+	{ 227, "utf8", "utf8_romanian_ci", 1, 4, "", mysqlnd_mbcharlen_utf8, check_mb_utf8_valid},
+	{ 228, "utf8", "utf8_slovenian_ci", 1, 4, "", mysqlnd_mbcharlen_utf8, check_mb_utf8_valid},
+	{ 229, "utf8", "utf8_polish_ci", 1, 4, "", mysqlnd_mbcharlen_utf8, check_mb_utf8_valid},
+	{ 230, "utf8", "utf8_estonian_ci", 1, 4, "", mysqlnd_mbcharlen_utf8, check_mb_utf8_valid},
+	{ 231, "utf8", "utf8_spanish_ci", 1, 4, ""

[PHP-CVS] svn: /php/php-src/ branches/PHP_5_3/ext/mysqlnd/mysqlnd_portability.h trunk/ext/mysqlnd/mysqlnd_portability.h

2009-12-02 Thread Andrey Hristov
andrey   Wed, 02 Dec 2009 11:58:04 +

Revision: http://svn.php.net/viewvc?view=revision&revision=291586

Log:
fix macro so that 5-byte BIT values are decoded correctly

Changed paths:
U   php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_portability.h
U   php/php-src/trunk/ext/mysqlnd/mysqlnd_portability.h

Modified: php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_portability.h
===
--- php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_portability.h  
2009-12-02 10:30:23 UTC (rev 291585)
+++ php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_portability.h  
2009-12-02 11:58:04 UTC (rev 291586)
@@ -247,10 +247,10 @@

(((uint32_t) (((zend_uchar*) (A))[0])) << 24)))

 #define bit_uint5korr(A)  ((uint64_t)(((uint32_t) ((zend_uchar) (A)[4])) +\
-  (((uint32_t) ((zend_uchar) (A)[3])) << 8) +\
-  (((uint32_t) ((zend_uchar) (A)[2])) << 16) +\
-  (((uint32_t) ((zend_uchar) (A)[1])) << 24)) 
+\
-   (((uint64_t) ((zend_uchar) (A)[0])) << 32))
+  (((uint32_t) ((zend_uchar*) (A)[3])) << 8) +\
+  (((uint32_t) ((zend_uchar*) (A)[2])) << 16) 
+\
+  (((uint32_t) ((zend_uchar*) (A)[1])) << 24)) 
+\
+   (((uint64_t) ((zend_uchar*) (A)[0])) << 32))

 #define bit_uint6korr(A)   ((uint64_t)(((uint32_t) (((zend_uchar*) 
(A))[5])) +\

(((uint32_t) (((zend_uchar*) (A))[4])) << 8) +\

Modified: php/php-src/trunk/ext/mysqlnd/mysqlnd_portability.h
===
--- php/php-src/trunk/ext/mysqlnd/mysqlnd_portability.h 2009-12-02 10:30:23 UTC 
(rev 291585)
+++ php/php-src/trunk/ext/mysqlnd/mysqlnd_portability.h 2009-12-02 11:58:04 UTC 
(rev 291586)
@@ -247,10 +247,10 @@

(((uint32_t) (((zend_uchar*) (A))[0])) << 24)))

 #define bit_uint5korr(A)  ((uint64_t)(((uint32_t) ((zend_uchar) (A)[4])) +\
-  (((uint32_t) ((zend_uchar) (A)[3])) << 8) +\
-  (((uint32_t) ((zend_uchar) (A)[2])) << 16) +\
-  (((uint32_t) ((zend_uchar) (A)[1])) << 24)) 
+\
-   (((uint64_t) ((zend_uchar) (A)[0])) << 32))
+  (((uint32_t) ((zend_uchar*) (A)[3])) << 8) +\
+  (((uint32_t) ((zend_uchar*) (A)[2])) << 16) 
+\
+  (((uint32_t) ((zend_uchar*) (A)[1])) << 24)) 
+\
+   (((uint64_t) ((zend_uchar*) (A)[0])) << 32))

 #define bit_uint6korr(A)   ((uint64_t)(((uint32_t) (((zend_uchar*) 
(A))[5])) +\

(((uint32_t) (((zend_uchar*) (A))[4])) << 8) +\

-- 
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

2009-12-03 Thread Andrey Hristov
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

2009-12-03 Thread Pierre Joye
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

[PHP-CVS] svn: /php/php-src/ branches/PHP_5_3/ext/mysqlnd/mysqlnd.c trunk/ext/mysqlnd/mysqlnd.c

2009-12-03 Thread Andrey Hristov
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

[PHP-CVS] svn: /php/php-src/ branches/PHP_5_3/ext/mysqlnd/mysqlnd_portability.h trunk/ext/mysqlnd/mysqlnd_portability.h

2009-12-09 Thread Andrey Hristov
andrey   Wed, 09 Dec 2009 18:11:03 +

Revision: http://svn.php.net/viewvc?view=revision&revision=291926

Log:
Fix compilation warnings

Changed paths:
U   php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_portability.h
U   php/php-src/trunk/ext/mysqlnd/mysqlnd_portability.h

Modified: php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_portability.h
===
--- php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_portability.h	2009-12-09 17:47:38 UTC (rev 291925)
+++ php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_portability.h	2009-12-09 18:11:03 UTC (rev 291926)
@@ -235,49 +235,46 @@
 #define uint1korr(A)	(*(((uint8_t*)(A

 /* Bit values are sent in reverted order of bytes, compared to normal !!! */
-#define bit_uint2korr(A) ((uint16_t) (((uint16_t) (((zend_uchar*) (A))[1])) +\
-	((uint16_t) (((zend_uchar*) (A))[0]) << 8)))
-#define bit_uint3korr(A) ((uint32_t) (((uint32_t) (((zend_uchar*) (A))[2])) +\
-	(((uint32_t) (((zend_uchar*) (A))[1])) << 8) +\
-	(((uint32_t) (((zend_uchar*) (A))[0])) << 16)))
+#define bit_uint2korr(A) ((uint16_t) (((uint16_t) (((unsigned char*) (A))[1])) +\
+   ((uint16_t) (((unsigned char*) (A))[0]) << 8)))
+#define bit_uint3korr(A) ((uint32_t) (((uint32_t) (((unsigned char*) (A))[2])) +\
+   (((uint32_t) (((unsigned char*) (A))[1])) << 8) +\
+   (((uint32_t) (((unsigned char*) (A))[0])) << 16)))
+#define bit_uint4korr(A) ((uint32_t) (((uint32_t) (((unsigned char*) (A))[3])) +\
+   (((uint32_t) (((unsigned char*) (A))[2])) << 8) +\
+   (((uint32_t) (((unsigned char*) (A))[1])) << 16) +\
+   (((uint32_t) (((unsigned char*) (A))[0])) << 24)))
+#define bit_uint5korr(A) ((uint64_t)(((uint32_t) (((unsigned char*) (A))[4])) +\
+(((uint32_t) (((unsigned char*) (A))[3])) << 8) +\
+(((uint32_t) (((unsigned char*) (A))[2])) << 16) +\
+   (((uint32_t) (((unsigned char*) (A))[1])) << 24)) +\
+(((uint64_t) (((unsigned char*) (A))[0])) << 32))
+#define bit_uint6korr(A) ((uint64_t)(((uint32_t) (((unsigned char*) (A))[5])) +\
+(((uint32_t) (((unsigned char*) (A))[4])) << 8) +\
+(((uint32_t) (((unsigned char*) (A))[3])) << 16) +\
+(((uint32_t) (((unsigned char*) (A))[2])) << 24)) +\
+(((uint64_t) (((uint32_t) (((unsigned char*) (A))[1])) +\
+(((uint32_t) (((unsigned char*) (A))[0]) << 8 <<\
+ 32))
+#define bit_uint7korr(A) ((uint64_t)(((uint32_t) (((unsigned char*) (A))[6])) +\
+(((uint32_t) (((unsigned char*) (A))[5])) << 8) +\
+(((uint32_t) (((unsigned char*) (A))[4])) << 16) +\
+   (((uint32_t) (((unsigned char*) (A))[3])) << 24)) +\
+(((uint64_t) (((uint32_t) (((unsigned char*) (A))[2])) +\
+(((uint32_t) (((unsigned char*) (A))[1])) << 8) +\
+(((uint32_t) (((unsigned char*) (A))[0])) << 16))) <<\
+ 32))
+#define bit_uint8korr(A) ((uint64_t)(((uint32_t) (((unsigned char*) (A))[7])) +\
+(((uint32_t) (((unsigned char*) (A))[6])) << 8) +\
+(((uint32_t) (((unsigned char*) (A))[5])) << 16) +\
+(((uint32_t) (((unsigned char*) (A))[4])) << 24)) +\
+(((uint64_t) (((uint32_t) (((unsigned char*) (A))[3])) +\
+(((uint32_t) (((unsigned char*) (A))[2])) << 8) +\
+(((uint32_t) (((unsigned char*) (A))[1])) << 16) +\
+(((uint32_t) (((unsigned char*) (A))[0])) << 24))) <<\
+32))

-#define bit_uint4korr(A) ((uint32_t) (((uint32_t) (((zend_uchar*) (A))[3])) +\
-	(((uint32_t) (((zend_uchar*) (A))[2])) << 8) +\
-	(((uint32_t) (((zend_uchar*) (A))[1])) << 16) +\
-	(((uint32_t) (((zend_uchar*) (A))[0])) << 24)))

-#define bit_uint5korr(A)  ((uint64_t)(((uint32_t) ((zend_uchar) (A)[4])) +\
-  (((uint32_t) ((zend_uchar*) (A)[3])) << 8) +\
-  (((uint32_t) ((zend_uchar*) (A)[2])) << 16) +\
-  (((uint32_t) ((zend_uchar*) (A)[1])) << 24)) +\
-   (((uint64_t) ((zend_uchar*) (A)[0])) << 32))
-
-#define bit_uint6korr(A)	((ui

[PHP-CVS] svn: /php/php-src/ branches/PHP_5_3/ext/mysqlnd/mysqlnd.h trunk/ext/mysqlnd/mysqlnd.h

2009-12-10 Thread Andrey Hristov
andrey   Thu, 10 Dec 2009 11:59:14 +

Revision: http://svn.php.net/viewvc?view=revision&revision=291947

Log:
bump version number

Changed paths:
U   php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd.h
U   php/php-src/trunk/ext/mysqlnd/mysqlnd.h

Modified: php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd.h
===
--- php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd.h  2009-12-10 11:18:05 UTC 
(rev 291946)
+++ php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd.h  2009-12-10 11:59:14 UTC 
(rev 291947)
@@ -22,8 +22,8 @@
 #ifndef MYSQLND_H
 #define MYSQLND_H

-#define MYSQLND_VERSION "mysqlnd 5.0.6-dev - 091022 - $Revision$"
-#define MYSQLND_VERSION_ID 50006
+#define MYSQLND_VERSION "mysqlnd 5.0.7-dev - 091210 - $Revision$"
+#define MYSQLND_VERSION_ID 50007

 /* This forces inlining of some accessor functions */
 #define MYSQLND_USE_OPTIMISATIONS 0

Modified: php/php-src/trunk/ext/mysqlnd/mysqlnd.h
===
--- php/php-src/trunk/ext/mysqlnd/mysqlnd.h 2009-12-10 11:18:05 UTC (rev 
291946)
+++ php/php-src/trunk/ext/mysqlnd/mysqlnd.h 2009-12-10 11:59:14 UTC (rev 
291947)
@@ -22,8 +22,8 @@
 #ifndef MYSQLND_H
 #define MYSQLND_H

-#define MYSQLND_VERSION "mysqlnd 5.0.6-dev - 091022 - $Revision$"
-#define MYSQLND_VERSION_ID 50006
+#define MYSQLND_VERSION "mysqlnd 5.0.7-dev - 091210 - $Revision$"
+#define MYSQLND_VERSION_ID 50007

 /* This forces inlining of some accessor functions */
 #define MYSQLND_USE_OPTIMISATIONS 0

-- 
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

2009-12-11 Thread Andrey Hristov
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

[PHP-CVS] svn: /php/php-src/ branches/PHP_5_3/ext/mysqlnd/mysqlnd.h trunk/ext/mysqlnd/mysqlnd.h

2009-12-15 Thread Andrey Hristov
andrey   Tue, 15 Dec 2009 14:48:24 +

Revision: http://svn.php.net/viewvc?view=revision&revision=292174

Log:
remove C++ comments

Changed paths:
U   php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd.h
U   php/php-src/trunk/ext/mysqlnd/mysqlnd.h

Modified: php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd.h
===
--- php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd.h  2009-12-15 14:34:16 UTC 
(rev 292173)
+++ php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd.h  2009-12-15 14:48:24 UTC 
(rev 292174)
@@ -40,8 +40,8 @@
   on production systems, if of course measured performance degradation is not
   minimal.
 */
-#if PHP_DEBUG
-//#define MYSQLND_DO_WIRE_CHECK_BEFORE_COMMAND 1
+#if A0 && PHP_DEBUG
+#define MYSQLND_DO_WIRE_CHECK_BEFORE_COMMAND 1
 #endif

 #if PHP_DEBUG && !defined(PHP_WIN32)

Modified: php/php-src/trunk/ext/mysqlnd/mysqlnd.h
===
--- php/php-src/trunk/ext/mysqlnd/mysqlnd.h 2009-12-15 14:34:16 UTC (rev 
292173)
+++ php/php-src/trunk/ext/mysqlnd/mysqlnd.h 2009-12-15 14:48:24 UTC (rev 
292174)
@@ -40,8 +40,8 @@
   on production systems, if of course measured performance degradation is not
   minimal.
 */
-#if PHP_DEBUG
-//#define MYSQLND_DO_WIRE_CHECK_BEFORE_COMMAND 1
+#if A0 && PHP_DEBUG
+#define MYSQLND_DO_WIRE_CHECK_BEFORE_COMMAND 1
 #endif

 #if PHP_DEBUG && !defined(PHP_WIN32)

-- 
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

2009-12-15 Thread Andrey Hristov
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_net.c trunk/ext/mysqlnd/mysqlnd_net.c

2009-12-16 Thread Andrey Hristov
andrey   Wed, 16 Dec 2009 14:38:30 +

Revision: http://svn.php.net/viewvc?view=revision&revision=292212

Log:
call free_contents in every case, in case something is not freed
by the calling code

Changed paths:
U   php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_net.c
U   php/php-src/trunk/ext/mysqlnd/mysqlnd_net.c

Modified: php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_net.c
===
--- php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_net.c  2009-12-16 
14:06:09 UTC (rev 292211)
+++ php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_net.c  2009-12-16 
14:38:30 UTC (rev 292212)
@@ -287,6 +287,7 @@
DBG_ENTER("mysqlnd_net_free");

if (net) {
+   net->m.free_contents(net TSRMLS_CC);
if (net->cmd_buffer.buffer) {
DBG_INF("Freeing cmd buffer");
mnd_pefree(net->cmd_buffer.buffer, pers);

Modified: php/php-src/trunk/ext/mysqlnd/mysqlnd_net.c
===
--- php/php-src/trunk/ext/mysqlnd/mysqlnd_net.c 2009-12-16 14:06:09 UTC (rev 
292211)
+++ php/php-src/trunk/ext/mysqlnd/mysqlnd_net.c 2009-12-16 14:38:30 UTC (rev 
292212)
@@ -287,6 +287,7 @@
DBG_ENTER("mysqlnd_net_free");

if (net) {
+   net->m.free_contents(net TSRMLS_CC);
if (net->cmd_buffer.buffer) {
DBG_INF("Freeing cmd buffer");
mnd_pefree(net->cmd_buffer.buffer, pers);

-- 
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_wireprotocol.c trunk/ext/mysqlnd/mysqlnd_wireprotocol.c

2009-12-21 Thread Andrey Hristov
andrey   Mon, 21 Dec 2009 16:17:31 +

Revision: http://svn.php.net/viewvc?view=revision&revision=292421

Log:
magic numbers to macros

Changed paths:
U   php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_wireprotocol.c
U   php/php-src/trunk/ext/mysqlnd/mysqlnd_wireprotocol.c

Modified: php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_wireprotocol.c
===
--- php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_wireprotocol.c	2009-12-21 16:09:13 UTC (rev 292420)
+++ php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_wireprotocol.c	2009-12-21 16:17:31 UTC (rev 292421)
@@ -72,6 +72,9 @@
 char * mysqlnd_read_body_name	= "mysqlnd_read_body";


+#define ERROR_MARKER 0xFF
+#define EODATA_MARKER 0xFE
+
 /* {{{ mysqlnd_command_to_text
  */
 const char * const mysqlnd_command_to_text[COM_END] =
@@ -342,7 +345,7 @@
 	packet->protocol_version = uint1korr(p);
 	p++;

-	if (packet->protocol_version == 0xFF) {
+	if (ERROR_MARKER == packet->protocol_version) {
 		php_mysqlnd_read_error_from_line(p, packet->header.size - 1,
 		 packet->error, sizeof(packet->error),
 		 &packet->error_no, packet->sqlstate
@@ -564,11 +567,11 @@

 	PACKET_READ_HEADER_AND_BODY(packet, conn, buf, buf_len, "OK", PROT_OK_PACKET);

-	/* Should be always 0x0 or 0xFF for error */
+	/* Should be always 0x0 or ERROR_MARKER for error */
 	packet->field_count = uint1korr(p);
 	p++;

-	if (0xFF == packet->field_count) {
+	if (ERROR_MARKER == packet->field_count) {
 		php_mysqlnd_read_error_from_line(p, packet->header.size - 1,
 		 packet->error, sizeof(packet->error),
 		 &packet->error_no, packet->sqlstate
@@ -644,11 +647,11 @@

 	PACKET_READ_HEADER_AND_BODY(packet, conn, buf, buf_len, "EOF", PROT_EOF_PACKET);

-	/* Should be always 0xFE */
+	/* Should be always EODATA_MARKER */
 	packet->field_count = uint1korr(p);
 	p++;

-	if (0xFF == packet->field_count) {
+	if (ERROR_MARKER == packet->field_count) {
 		php_mysqlnd_read_error_from_line(p, packet->header.size - 1,
 		 packet->error, sizeof(packet->error),
 		 &packet->error_no, packet->sqlstate
@@ -782,10 +785,10 @@
 	PACKET_READ_HEADER_AND_BODY(packet, conn, buf, buf_len, "resultset header", PROT_RSET_HEADER_PACKET);

 	/*
-	  Don't increment. First byte is 0xFF on error, but otherwise is starting byte
+	  Don't increment. First byte is ERROR_MARKER on error, but otherwise is starting byte
 	  of encoded sequence for length.
 	*/
-	if (*p == 0xFF) {
+	if (ERROR_MARKER == *p) {
 		/* Error */
 		p++;
 		php_mysqlnd_read_error_from_line(p, packet->header.size - 1,
@@ -900,7 +903,7 @@
 	if (packet->skip_parsing) {
 		DBG_RETURN(PASS);
 	}
-	if (*p == 0xFF) {
+	if (ERROR_MARKER == *p) {
 		/* Error */
 		p++;
 		php_mysqlnd_read_error_from_line(p, packet->header.size - 1,
@@ -909,7 +912,7 @@
 		 TSRMLS_CC);
 		DBG_ERR_FMT("Server error : (%d) %s", packet->error_info.error_no, packet->error_info.error);
 		DBG_RETURN(PASS);
-	} else if (*p == 0xFE && packet->header.size < 8) {
+	} else if (EODATA_MARKER == *p && packet->header.size < 8) {
 		/* Premature EOF. That should be COM_FIELD_LIST */
 		DBG_INF("Premature EOF. That should be COM_FIELD_LIST");
 		packet->stupid_list_fields_eof = TRUE;
@@ -1155,7 +1158,7 @@
 	end_field = (current_field = start_field = fields) + field_count;


-	/* skip the first byte, not 0xFE -> 0x0, status */
+	/* skip the first byte, not EODATA_MARKER -> 0x0, status */
 	p++;
 	null_ptr= p;
 	p += (field_count + 9)/8;		/* skip null bits */
@@ -1485,7 +1488,7 @@
 	packet->header.size = data_size;
 	packet->row_buffer->app = data_size;

-	if ((*(p = packet->row_buffer->ptr)) == 0xFF) {
+	if (ERROR_MARKER == (*(p = packet->row_buffer->ptr))) {
 		/*
 		   Error message as part of the result set,
 		   not good but we should not hang. See:
@@ -1498,7 +1501,7 @@
 		 &packet->error_info.error_no,
 		 packet->error_info.sqlstate
 		 TSRMLS_CC);
-	} else if (*p == 0xFE && data_size < 8) { /* EOF */
+	} else if (EODATA_MARKER == *p && data_size < 8) { /* EOF */
 		packet->eof = TRUE;
 		p++;
 		if (data_size > 1) {
@@ -1637,7 +1640,7 @@
 	packet->error_code = uint1korr(p);
 	p++;

-	if (0xFF == packet->error_code) {
+	if (ERROR_MARKER == packet->error_code) {
 		php_mysqlnd_read_error_from_line(p, data_size - 1,
 		 packet->error_info.error,
 		 sizeof(packet->error_info.error),
@@ -1714,21 +1717,20 @@
 	PACKET_READ_HEADER_AND_BODY(packet, conn, buf, buf_len, "change user response", PROT_CHG_USER_PACKET);

 	/*
-	  Don't increment. First byte is 0xFF on error, but otherwise is starting byte
+	  Don't increment. First byte is ERROR_MARKER on error, but otherwise is starting byte
 	  of encoded sequence for length.
 	*/

-	/* Should be always 0x0 or 0xFF for error */
+	/* Should be always 0x0 or ERROR_MARKER for error */
 	packet->field_count= uint1korr(p);
 	p++;

-	if (packet->header.size == 1 &&

[PHP-CVS] svn: /php/php-src/ branches/PHP_5_3/ext/mysqlnd/mysqlnd.c trunk/ext/mysqlnd/mysqlnd.c

2009-12-22 Thread Andrey Hristov
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

2009-12-22 Thread Andrey Hristov
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_wireprotocol.h trunk/ext/mysqlnd/mysqlnd_wireprotocol.h

2010-01-11 Thread Andrey Hristov
andrey   Mon, 11 Jan 2010 20:12:46 +

Revision: http://svn.php.net/viewvc?view=revision&revision=293429

Log:
remove stale export

Changed paths:
U   php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_wireprotocol.h
U   php/php-src/trunk/ext/mysqlnd/mysqlnd_wireprotocol.h

Modified: php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_wireprotocol.h
===
--- php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_wireprotocol.h 
2010-01-11 20:10:10 UTC (rev 293428)
+++ php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_wireprotocol.h 
2010-01-11 20:12:46 UTC (rev 293429)
@@ -244,8 +244,6 @@
 } MYSQLND_PACKET_CHG_USER_RESPONSE;


-size_t mysqlnd_stream_write_w_header(MYSQLND * const conn, char * const buf, 
size_t count TSRMLS_DC);
-
 void php_mysqlnd_scramble(zend_uchar * const buffer, const zend_uchar * const 
scramble, const zend_uchar * const pass);

 unsigned long  php_mysqlnd_net_field_length(zend_uchar **packet);

Modified: php/php-src/trunk/ext/mysqlnd/mysqlnd_wireprotocol.h
===
--- php/php-src/trunk/ext/mysqlnd/mysqlnd_wireprotocol.h2010-01-11 
20:10:10 UTC (rev 293428)
+++ php/php-src/trunk/ext/mysqlnd/mysqlnd_wireprotocol.h2010-01-11 
20:12:46 UTC (rev 293429)
@@ -244,8 +244,6 @@
 } MYSQLND_PACKET_CHG_USER_RESPONSE;


-size_t mysqlnd_stream_write_w_header(MYSQLND * const conn, char * const buf, 
size_t count TSRMLS_DC);
-
 void php_mysqlnd_scramble(zend_uchar * const buffer, const zend_uchar * const 
scramble, const zend_uchar * const pass);

 unsigned long  php_mysqlnd_net_field_length(zend_uchar **packet);

-- 
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

2010-01-13 Thread Andrey Hristov
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_portability.h trunk/ext/mysqlnd/mysqlnd_portability.h

2010-01-14 Thread Andrey Hristov
andrey   Thu, 14 Jan 2010 10:35:28 +

Revision: http://svn.php.net/viewvc?view=revision&revision=293537

Log:
remove redefinition of bit_uint8korr

Changed paths:
U   php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_portability.h
U   php/php-src/trunk/ext/mysqlnd/mysqlnd_portability.h

Modified: php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_portability.h
===
--- php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_portability.h  
2010-01-14 10:32:05 UTC (rev 293536)
+++ php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_portability.h  
2010-01-14 10:35:28 UTC (rev 293537)
@@ -369,16 +369,6 @@
(((uint32_t) ((zend_uchar) (A)[2])) << 16) +\
(((uint32_t) ((zend_uchar) (A)[3])) << 24))

-
-#define bit_uint8korr(A) ((uint64_t)(((uint32_t) (((zend_uchar*) (A))[7])) +\
-   
(((uint32_t) (((zend_uchar*) (A))[6])) << 8) +\
-   
(((uint32_t) (((zend_uchar*) (A))[5])) << 16) +\
-   
(((uint32_t) (((zend_uchar*) (A))[4])) << 24)) +\
-   
(((uint64_t) (((uint32_t) (((zend_uchar*) (A))[3])) +\
-   
(((uint32_t) (((zend_uchar*) (A))[2])) << 8) +\
-   
(((uint32_t) (((zend_uchar*) (A))[1])) << 16) +\
-   
(((uint32_t) (((zend_uchar*) (A))[0])) << 24))) << 32))
-
 #define uint8korr(A)   ((uint64_t)(((uint32_t) ((zend_uchar) (A)[0])) +\

(((uint32_t) ((zend_uchar) (A)[1])) << 8) +\

(((uint32_t) ((zend_uchar) (A)[2])) << 16) +\

Modified: php/php-src/trunk/ext/mysqlnd/mysqlnd_portability.h
===
--- php/php-src/trunk/ext/mysqlnd/mysqlnd_portability.h 2010-01-14 10:32:05 UTC 
(rev 293536)
+++ php/php-src/trunk/ext/mysqlnd/mysqlnd_portability.h 2010-01-14 10:35:28 UTC 
(rev 293537)
@@ -369,16 +369,6 @@
(((uint32_t) ((zend_uchar) (A)[2])) << 16) +\
(((uint32_t) ((zend_uchar) (A)[3])) << 24))

-
-#define bit_uint8korr(A) ((uint64_t)(((uint32_t) (((zend_uchar*) (A))[7])) +\
-   
(((uint32_t) (((zend_uchar*) (A))[6])) << 8) +\
-   
(((uint32_t) (((zend_uchar*) (A))[5])) << 16) +\
-   
(((uint32_t) (((zend_uchar*) (A))[4])) << 24)) +\
-   
(((uint64_t) (((uint32_t) (((zend_uchar*) (A))[3])) +\
-   
(((uint32_t) (((zend_uchar*) (A))[2])) << 8) +\
-   
(((uint32_t) (((zend_uchar*) (A))[1])) << 16) +\
-   
(((uint32_t) (((zend_uchar*) (A))[0])) << 24))) << 32))
-
 #define uint8korr(A)   ((uint64_t)(((uint32_t) ((zend_uchar) (A)[0])) +\

(((uint32_t) ((zend_uchar) (A)[1])) << 8) +\

(((uint32_t) ((zend_uchar) (A)[2])) << 16) +\

-- 
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_debug.c trunk/ext/mysqlnd/mysqlnd_debug.c

2010-01-14 Thread Andrey Hristov
andrey   Thu, 14 Jan 2010 11:39:18 +

Revision: http://svn.php.net/viewvc?view=revision&revision=293539

Log:
Fix compiler warning

Changed paths:
U   php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_debug.c
U   php/php-src/trunk/ext/mysqlnd/mysqlnd_debug.c

Modified: php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_debug.c
===
--- php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_debug.c2010-01-14 
11:11:56 UTC (rev 293538)
+++ php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_debug.c2010-01-14 
11:39:18 UTC (rev 293539)
@@ -317,7 +317,7 @@
}

if ((self->flags & MYSQLND_DEBUG_TRACE_MEMORY_CALLS) == 0 && 
self->skip_functions) {
-   char ** p = self->skip_functions;
+   const char ** p = self->skip_functions;
while (*p) {
if (*p == func_name) {
zend_stack_push(&self->call_stack, "", 
sizeof(""));

Modified: php/php-src/trunk/ext/mysqlnd/mysqlnd_debug.c
===
--- php/php-src/trunk/ext/mysqlnd/mysqlnd_debug.c   2010-01-14 11:11:56 UTC 
(rev 293538)
+++ php/php-src/trunk/ext/mysqlnd/mysqlnd_debug.c   2010-01-14 11:39:18 UTC 
(rev 293539)
@@ -317,7 +317,7 @@
}

if ((self->flags & MYSQLND_DEBUG_TRACE_MEMORY_CALLS) == 0 && 
self->skip_functions) {
-   char ** p = self->skip_functions;
+   const char ** p = self->skip_functions;
while (*p) {
if (*p == func_name) {
zend_stack_push(&self->call_stack, "", 
sizeof(""));

-- 
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_net.c trunk/ext/mysqlnd/mysqlnd_net.c

2010-01-14 Thread Andrey Hristov
andrey   Thu, 14 Jan 2010 12:31:29 +

Revision: http://svn.php.net/viewvc?view=revision&revision=293542

Log:
Fix compiler warning, copy&paste error

Changed paths:
U   php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_net.c
U   php/php-src/trunk/ext/mysqlnd/mysqlnd_net.c

Modified: php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_net.c
===
--- php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_net.c  2010-01-14 
12:30:30 UTC (rev 293541)
+++ php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_net.c  2010-01-14 
12:31:29 UTC (rev 293542)
@@ -475,7 +475,7 @@


 /* {{{ mysqlnd_net::receive */
-static enum_func_status
+static size_t
 MYSQLND_METHOD(mysqlnd_net, receive)(MYSQLND * conn, zend_uchar * buffer, 
size_t count TSRMLS_DC)
 {
size_t to_read = count;

Modified: php/php-src/trunk/ext/mysqlnd/mysqlnd_net.c
===
--- php/php-src/trunk/ext/mysqlnd/mysqlnd_net.c 2010-01-14 12:30:30 UTC (rev 
293541)
+++ php/php-src/trunk/ext/mysqlnd/mysqlnd_net.c 2010-01-14 12:31:29 UTC (rev 
293542)
@@ -475,7 +475,7 @@


 /* {{{ mysqlnd_net::receive */
-static enum_func_status
+static size_t
 MYSQLND_METHOD(mysqlnd_net, receive)(MYSQLND * conn, zend_uchar * buffer, 
size_t count TSRMLS_DC)
 {
size_t to_read = count;

-- 
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_debug.h trunk/ext/mysqlnd/mysqlnd_debug.h

2010-01-19 Thread Andrey Hristov
andrey   Tue, 19 Jan 2010 11:44:43 +

Revision: http://svn.php.net/viewvc?view=revision&revision=293723

Log:
fix windows

Changed paths:
U   php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_debug.h
U   php/php-src/trunk/ext/mysqlnd/mysqlnd_debug.h

Modified: php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_debug.h
===
--- php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_debug.h2010-01-19 
10:47:51 UTC (rev 293722)
+++ php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_debug.h2010-01-19 
11:44:43 UTC (rev 293723)
@@ -80,6 +80,7 @@

 PHPAPI char *  mysqlnd_get_backtrace(TSRMLS_D);

+#if !defined(PHP_WIN32)
 #define DBG_INF_EX(dbg_obj, msg)   do { if (dbg_skip_trace == 
FALSE) (dbg_obj)->m->log((dbg_obj), __LINE__, __FILE__, -1, "info : ", (msg)); 
} while (0)
 #define DBG_ERR_EX(dbg_obj, msg)   do { if (dbg_skip_trace == 
FALSE) (dbg_obj)->m->log((dbg_obj), __LINE__, __FILE__, -1, "error: ", (msg)); 
} while (0)
 #define DBG_INF_FMT_EX(dbg_obj, ...)   do { if (dbg_skip_trace == FALSE) 
(dbg_obj)->m->log_va((dbg_obj), __LINE__, __FILE__, -1, "info : ", 
__VA_ARGS__); } while (0)
@@ -89,7 +90,17 @@
 #define DBG_RETURN_EX(dbg_obj, value)  do { if ((dbg_obj)) 
(dbg_obj)->m->func_leave((dbg_obj), __LINE__, __FILE__); return (value); } 
while (0)
 #define DBG_VOID_RETURN_EX(dbg_obj)do { if ((dbg_obj)) 
(dbg_obj)->m->func_leave((dbg_obj), __LINE__, __FILE__); return; } while (0)

+#else
+static inline void DBG_INF_EX(MYSQLND_DEBUG * dbg_obj, const char * const msg) 
{}
+static inline void DBG_ERR_EX(MYSQLND_DEBUG * dbg_obj, const char * const msg) 
{}
+static inline void DBG_INF_FMT_EX(MYSQLND_DEBUG * dbg_obj, ...) {}
+static inline void DBG_ERR_FMT_EX(MYSQLND_DEBUG * dbg_obj, ...) {}
+static inline void DBG_ENTER_EX(MYSQLND_DEBUG * dbg_obj, const char * const 
func_name) {}
+#define DBG_RETURN_EX(dbg_obj, value) return (value)
+#define DBG_VOID_RETURN_EX(dbg_obj) return

+#endif
+
 #if MYSQLND_DBG_ENABLED == 1

 #define DBG_INF(msg)   DBG_INF_EX(MYSQLND_G(dbg), (msg))
@@ -103,6 +114,8 @@

 #elif MYSQLND_DBG_ENABLED == 0

+
+
 static inline void DBG_INF(const char * const msg) {}
 static inline void DBG_ERR(const char * const msg) {}
 static inline void DBG_INF_FMT(const char * const format, ...) {}

Modified: php/php-src/trunk/ext/mysqlnd/mysqlnd_debug.h
===
--- php/php-src/trunk/ext/mysqlnd/mysqlnd_debug.h   2010-01-19 10:47:51 UTC 
(rev 293722)
+++ php/php-src/trunk/ext/mysqlnd/mysqlnd_debug.h   2010-01-19 11:44:43 UTC 
(rev 293723)
@@ -80,6 +80,7 @@

 PHPAPI char *  mysqlnd_get_backtrace(TSRMLS_D);

+#if !defined(PHP_WIN32)
 #define DBG_INF_EX(dbg_obj, msg)   do { if (dbg_skip_trace == 
FALSE) (dbg_obj)->m->log((dbg_obj), __LINE__, __FILE__, -1, "info : ", (msg)); 
} while (0)
 #define DBG_ERR_EX(dbg_obj, msg)   do { if (dbg_skip_trace == 
FALSE) (dbg_obj)->m->log((dbg_obj), __LINE__, __FILE__, -1, "error: ", (msg)); 
} while (0)
 #define DBG_INF_FMT_EX(dbg_obj, ...)   do { if (dbg_skip_trace == FALSE) 
(dbg_obj)->m->log_va((dbg_obj), __LINE__, __FILE__, -1, "info : ", 
__VA_ARGS__); } while (0)
@@ -89,7 +90,17 @@
 #define DBG_RETURN_EX(dbg_obj, value)  do { if ((dbg_obj)) 
(dbg_obj)->m->func_leave((dbg_obj), __LINE__, __FILE__); return (value); } 
while (0)
 #define DBG_VOID_RETURN_EX(dbg_obj)do { if ((dbg_obj)) 
(dbg_obj)->m->func_leave((dbg_obj), __LINE__, __FILE__); return; } while (0)

+#else
+static inline void DBG_INF_EX(MYSQLND_DEBUG * dbg_obj, const char * const msg) 
{}
+static inline void DBG_ERR_EX(MYSQLND_DEBUG * dbg_obj, const char * const msg) 
{}
+static inline void DBG_INF_FMT_EX(MYSQLND_DEBUG * dbg_obj, ...) {}
+static inline void DBG_ERR_FMT_EX(MYSQLND_DEBUG * dbg_obj, ...) {}
+static inline void DBG_ENTER_EX(MYSQLND_DEBUG * dbg_obj, const char * const 
func_name) {}
+#define DBG_RETURN_EX(dbg_obj, value) return (value)
+#define DBG_VOID_RETURN_EX(dbg_obj) return

+#endif
+
 #if MYSQLND_DBG_ENABLED == 1

 #define DBG_INF(msg)   DBG_INF_EX(MYSQLND_G(dbg), (msg))
@@ -103,6 +114,8 @@

 #elif MYSQLND_DBG_ENABLED == 0

+
+
 static inline void DBG_INF(const char * const msg) {}
 static inline void DBG_ERR(const char * const msg) {}
 static inline void DBG_INF_FMT(const char * const format, ...) {}

-- 
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_debug.h trunk/ext/mysqlnd/mysqlnd_debug.h

2010-01-19 Thread Andrey Hristov
andrey   Tue, 19 Jan 2010 12:13:06 +

Revision: http://svn.php.net/viewvc?view=revision&revision=293725

Log:
Make it GCC only feature (tracing). VC7 and up do the work
too and it might be tweaked later.

Changed paths:
U   php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_debug.h
U   php/php-src/trunk/ext/mysqlnd/mysqlnd_debug.h

Modified: php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_debug.h
===
--- php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_debug.h2010-01-19 
12:03:07 UTC (rev 293724)
+++ php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_debug.h2010-01-19 
12:13:06 UTC (rev 293725)
@@ -80,7 +80,7 @@

 PHPAPI char *  mysqlnd_get_backtrace(TSRMLS_D);

-#if !defined(PHP_WIN32)
+#if defined(__GNUC__)
 #define DBG_INF_EX(dbg_obj, msg)   do { if (dbg_skip_trace == 
FALSE) (dbg_obj)->m->log((dbg_obj), __LINE__, __FILE__, -1, "info : ", (msg)); 
} while (0)
 #define DBG_ERR_EX(dbg_obj, msg)   do { if (dbg_skip_trace == 
FALSE) (dbg_obj)->m->log((dbg_obj), __LINE__, __FILE__, -1, "error: ", (msg)); 
} while (0)
 #define DBG_INF_FMT_EX(dbg_obj, ...)   do { if (dbg_skip_trace == FALSE) 
(dbg_obj)->m->log_va((dbg_obj), __LINE__, __FILE__, -1, "info : ", 
__VA_ARGS__); } while (0)

Modified: php/php-src/trunk/ext/mysqlnd/mysqlnd_debug.h
===
--- php/php-src/trunk/ext/mysqlnd/mysqlnd_debug.h   2010-01-19 12:03:07 UTC 
(rev 293724)
+++ php/php-src/trunk/ext/mysqlnd/mysqlnd_debug.h   2010-01-19 12:13:06 UTC 
(rev 293725)
@@ -80,7 +80,7 @@

 PHPAPI char *  mysqlnd_get_backtrace(TSRMLS_D);

-#if !defined(PHP_WIN32)
+#if defined(__GNUC__)
 #define DBG_INF_EX(dbg_obj, msg)   do { if (dbg_skip_trace == 
FALSE) (dbg_obj)->m->log((dbg_obj), __LINE__, __FILE__, -1, "info : ", (msg)); 
} while (0)
 #define DBG_ERR_EX(dbg_obj, msg)   do { if (dbg_skip_trace == 
FALSE) (dbg_obj)->m->log((dbg_obj), __LINE__, __FILE__, -1, "error: ", (msg)); 
} while (0)
 #define DBG_INF_FMT_EX(dbg_obj, ...)   do { if (dbg_skip_trace == FALSE) 
(dbg_obj)->m->log_va((dbg_obj), __LINE__, __FILE__, -1, "info : ", 
__VA_ARGS__); } while (0)

-- 
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_statistics.h trunk/ext/mysqlnd/mysqlnd_statistics.h

2010-01-19 Thread Andrey Hristov
andrey   Tue, 19 Jan 2010 15:31:39 +

Revision: http://svn.php.net/viewvc?view=revision&revision=293735

Log:
Fix possible lock-ups when a trigger triggers a trigger.
Hanging was possible on the subsequent try to acquire a mutex.
Now it is correctly implemented and if a trigger is being executed
then no other trigger will be fired, on recursive calls.

Changed paths:
U   php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_statistics.h
U   php/php-src/trunk/ext/mysqlnd/mysqlnd_statistics.h

Modified: php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_statistics.h
===
--- php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_statistics.h   
2010-01-19 14:24:35 UTC (rev 293734)
+++ php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_statistics.h   
2010-01-19 15:31:39 UTC (rev 293735)
@@ -42,13 +42,20 @@
 #define MYSQLND_STATS_UNLOCK(stats)
 #endif

-#define MYSQLND_CHECK_AND_CALL_HANDLER(stats, statistic, value) \
+#define MYSQLND_UPDATE_VALUE_AND_CALL_TRIGGER(stats, statistic, value) \
{ \
+   MYSQLND_STATS_LOCK(stats); \
+   (stats)->values[(statistic)] += (value); \
if ((stats)->triggers[(statistic)] && 
(stats)->in_trigger == FALSE) { \
(stats)->in_trigger = TRUE; \
+   MYSQLND_STATS_UNLOCK(stats); \
+   

\
(stats)->triggers[(statistic)]((stats), 
(statistic), (value) TSRMLS_CC); \
+   

\
+   MYSQLND_STATS_LOCK(stats); \
(stats)->in_trigger = FALSE; \
} \
+   MYSQLND_STATS_UNLOCK(_p_s); \
} \

 #define MYSQLND_DEC_STATISTIC(enabler, stats, statistic) \
@@ -56,10 +63,7 @@
enum_mysqlnd_collected_stats _s = (statistic);\
MYSQLND_STATS * _p_s = (MYSQLND_STATS *) (stats); \
if ((enabler) && _p_s && _s != _p_s->count) { \
-   MYSQLND_STATS_LOCK(_p_s); \
-   MYSQLND_CHECK_AND_CALL_HANDLER(_p_s, _s, -1); \
-   _p_s->values[_s]--; \
-   MYSQLND_STATS_UNLOCK(_p_s); \
+   MYSQLND_UPDATE_VALUE_AND_CALL_TRIGGER(_p_s, _s, -1); \
}\
  }

@@ -68,10 +72,7 @@
enum_mysqlnd_collected_stats _s = (statistic);\
MYSQLND_STATS * _p_s = (MYSQLND_STATS *) (stats); \
if ((enabler) && _p_s && _s != _p_s->count) { \
-   MYSQLND_STATS_LOCK(_p_s); \
-   MYSQLND_CHECK_AND_CALL_HANDLER(_p_s, _s, 1); \
-   _p_s->values[_s]++; \
-   MYSQLND_STATS_UNLOCK(_p_s); \
+   MYSQLND_UPDATE_VALUE_AND_CALL_TRIGGER(_p_s, _s, 1); \
}\
  }

@@ -81,10 +82,7 @@
MYSQLND_STATS * _p_s = (MYSQLND_STATS *) (stats); \
if ((enabler) && _p_s && _s != _p_s->count) { \
uint64_t v = (uint64_t) (value); \
-   MYSQLND_STATS_LOCK(_p_s); \
-   MYSQLND_CHECK_AND_CALL_HANDLER(_p_s, _s, v); \
-   _p_s->values[_s] += v; \
-   MYSQLND_STATS_UNLOCK(_p_s); \
+   MYSQLND_UPDATE_VALUE_AND_CALL_TRIGGER(_p_s, _s, v); \
}\
  }

@@ -96,16 +94,8 @@
uint64_t v2 = (uint64_t) (value2); \
enum_mysqlnd_collected_stats _s1 = (statistic1);\
enum_mysqlnd_collected_stats _s2 = (statistic2);\
-   MYSQLND_STATS_LOCK(_p_s); \
-   if (_s1 != _p_s->count) { \
-   MYSQLND_CHECK_AND_CALL_HANDLER(_p_s, _s1, v1); \
-   _p_s->values[_s1]+= v1; \
-   } \
-   if (_s2 != _p_s->count) { \
-   MYSQLND_CHECK_AND_CALL_HANDLER(_p_s, _s2, v2); \
-   _p_s->values[_s2]+= v2; \
-   } \
-   MYSQLND_STATS_UNLOCK(_p_s); \
+   if (_s1 != _p_s->count) 
MYSQLND_UPDATE_VALUE_AND_CALL_TRIGGER(_p_s, _s1, v1); \
+   if (_s2 != _p_s->count) 
MYSQLND_UPDATE_VALUE_AND_CALL_TRIGGER(_p_s, _s2, v2); \
}\
  }

@@ -119,20 +109,9 @@
enum_mysqlnd_collected_stats _s1 = (statistic1);\
enum_mysqlnd_collected_stats _s2 = (statistic2);\
enum_mysqlnd_collected_stats _s3 = (statistic3);\
-   MYSQLND_STATS_LOCK(_p_s); \
-   if (_s1 != _p_s->count) { \
-   MYSQLND_CHECK_AND_CALL_HANDLER(_p_s, _s1, v1); \
-   _p_s->values[_s1]+= v1; \
-   } \
-   if (_s2 != _p_s->count) { \
-  

[PHP-CVS] svn: /php/php-src/ branches/PHP_5_3/ext/mysqlnd/mysqlnd_debug.c trunk/ext/mysqlnd/mysqlnd_debug.c

2010-01-21 Thread Andrey Hristov
andrey   Thu, 21 Jan 2010 18:17:19 +

Revision: http://svn.php.net/viewvc?view=revision&revision=293816

Log:
decrement correctly!

Changed paths:
U   php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_debug.c
U   php/php-src/trunk/ext/mysqlnd/mysqlnd_debug.c

Modified: php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_debug.c
===
--- php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_debug.c2010-01-21 
18:12:18 UTC (rev 293815)
+++ php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_debug.c2010-01-21 
18:17:19 UTC (rev 293816)
@@ -1120,9 +1120,10 @@
len = va_arg(args, int*);
num = va_arg(args, int*);

-   if (!(*level)--) {
+   if (!*level) {
return ZEND_HASH_APPLY_KEEP;
}
+   --*level;

s_tmp = emalloc(1 + MAX_LENGTH_OF_LONG + 1 + 1);
sprintf(s_tmp, "#%d ", (*num)++);
@@ -1296,9 +1297,10 @@
len = va_arg(args, int*);
num = va_arg(args, int*);

-   if (!(*level)--) {
+   if (!*level) {
return ZEND_HASH_APPLY_KEEP;
}
+   --*level;

s_tmp = emalloc(1 + MAX_LENGTH_OF_LONG + 1 + 1);
sprintf(s_tmp, "#%d ", (*num)++);

Modified: php/php-src/trunk/ext/mysqlnd/mysqlnd_debug.c
===
--- php/php-src/trunk/ext/mysqlnd/mysqlnd_debug.c   2010-01-21 18:12:18 UTC 
(rev 293815)
+++ php/php-src/trunk/ext/mysqlnd/mysqlnd_debug.c   2010-01-21 18:17:19 UTC 
(rev 293816)
@@ -1120,9 +1120,10 @@
len = va_arg(args, int*);
num = va_arg(args, int*);

-   if (!(*level)--) {
+   if (!*level) {
return ZEND_HASH_APPLY_KEEP;
}
+   --*level;

s_tmp = emalloc(1 + MAX_LENGTH_OF_LONG + 1 + 1);
sprintf(s_tmp, "#%d ", (*num)++);
@@ -1296,9 +1297,10 @@
len = va_arg(args, int*);
num = va_arg(args, int*);

-   if (!(*level)--) {
+   if (!*level) {
return ZEND_HASH_APPLY_KEEP;
}
+   --*level;

s_tmp = emalloc(1 + MAX_LENGTH_OF_LONG + 1 + 1);
sprintf(s_tmp, "#%d ", (*num)++);

-- 
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_wireprotocol.c trunk/ext/mysqlnd/mysqlnd_wireprotocol.c

2010-02-01 Thread Andrey Hristov
andrey   Mon, 01 Feb 2010 16:12:03 +

Revision: http://svn.php.net/viewvc?view=revision&revision=294313

Log:
Fix a bug in mysqlnd where a pointer was not incremented
and thus wrong data was saved MYSQLND_FIELD::db. However, this
wasn't caught because there is no code in mysql/mysqli/pdo_mysql
which reads that field of the structure. The problem was found
during code review.

Changed paths:
U   php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_wireprotocol.c
U   php/php-src/trunk/ext/mysqlnd/mysqlnd_wireprotocol.c

Modified: php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_wireprotocol.c
===
--- php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_wireprotocol.c 
2010-02-01 15:31:58 UTC (rev 294312)
+++ php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_wireprotocol.c 
2010-02-01 16:12:03 UTC (rev 294313)
@@ -957,6 +957,7 @@
len = meta->db_length;
meta->db = memcpy(root_ptr, meta->db, len);
*(root_ptr + len) = '\0';
+   root_ptr++;
}

if (meta->table && meta->table != mysqlnd_empty_string) {

Modified: php/php-src/trunk/ext/mysqlnd/mysqlnd_wireprotocol.c
===
--- php/php-src/trunk/ext/mysqlnd/mysqlnd_wireprotocol.c2010-02-01 
15:31:58 UTC (rev 294312)
+++ php/php-src/trunk/ext/mysqlnd/mysqlnd_wireprotocol.c2010-02-01 
16:12:03 UTC (rev 294313)
@@ -957,6 +957,7 @@
len = meta->db_length;
meta->db = memcpy(root_ptr, meta->db, len);
*(root_ptr + len) = '\0';
+   root_ptr++;
}

if (meta->table && meta->table != mysqlnd_empty_string) {

-- 
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_wireprotocol.c trunk/ext/mysqlnd/mysqlnd_wireprotocol.c

2010-02-01 Thread Andrey Hristov
andrey   Mon, 01 Feb 2010 17:12:40 +

Revision: http://svn.php.net/viewvc?view=revision&revision=294317

Log:
Fix second bug in that code, + instead of += thus not increasing
a pointer and mangling data. Again, ext/mysql and ext/mysqli doesn't
have access to this codepath.

Changed paths:
U   php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_wireprotocol.c
U   php/php-src/trunk/ext/mysqlnd/mysqlnd_wireprotocol.c

Modified: php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_wireprotocol.c
===
--- php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_wireprotocol.c 
2010-02-01 16:21:56 UTC (rev 294316)
+++ php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_wireprotocol.c 
2010-02-01 17:12:40 UTC (rev 294317)
@@ -956,7 +956,7 @@
if (meta->db && meta->db != mysqlnd_empty_string) {
len = meta->db_length;
meta->db = memcpy(root_ptr, meta->db, len);
-   *(root_ptr + len) = '\0';
+   *(root_ptr +=len) = '\0';
root_ptr++;
}


Modified: php/php-src/trunk/ext/mysqlnd/mysqlnd_wireprotocol.c
===
--- php/php-src/trunk/ext/mysqlnd/mysqlnd_wireprotocol.c2010-02-01 
16:21:56 UTC (rev 294316)
+++ php/php-src/trunk/ext/mysqlnd/mysqlnd_wireprotocol.c2010-02-01 
17:12:40 UTC (rev 294317)
@@ -956,7 +956,7 @@
if (meta->db && meta->db != mysqlnd_empty_string) {
len = meta->db_length;
meta->db = memcpy(root_ptr, meta->db, len);
-   *(root_ptr + len) = '\0';
+   *(root_ptr +=len) = '\0';
root_ptr++;
}


-- 
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

2010-02-24 Thread Andrey Hristov
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

2010-02-24 Thread Andrey Hristov
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_net.c trunk/ext/mysqlnd/mysqlnd_net.c

2010-04-01 Thread Andrey Hristov
andrey   Thu, 01 Apr 2010 12:46:21 +

Revision: http://svn.php.net/viewvc?view=revision&revision=297274

Log:
Better fix for bug #51347 mysqli_close / connection memory leak

Bug: http://bugs.php.net/51347 (Open) mysqli_close / connection memory leak
  
Changed paths:
U   php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_net.c
U   php/php-src/trunk/ext/mysqlnd/mysqlnd_net.c

Modified: php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_net.c
===
--- php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_net.c  2010-04-01 
12:08:55 UTC (rev 297273)
+++ php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_net.c  2010-04-01 
12:46:21 UTC (rev 297274)
@@ -159,6 +159,14 @@
 #endif
efree(hashed_details);
}
+   /*
+ Streams are not meant for C extensions! Thus we need a hack. Every 
connected stream will
+ be registered as resource (in EG(regular_list). So far, so good. 
However, it won't be
+ unregistered till the script ends. So, we need to take care of that.
+   */
+   net->stream->in_free = 1;
+   zend_hash_index_del(&EG(regular_list), net->stream->rsrc_id);
+   net->stream->in_free = 0;

if (!net->options.timeout_read) {
/* should always happen because read_timeout cannot be set via 
API */
@@ -703,15 +711,6 @@
mnd_pefree(net->cmd_buffer.buffer, pers);
net->cmd_buffer.buffer = NULL;
}
-   /*
- Streams are not meant for C extensions! Thus we need a hack. 
Every connected stream will
- be registered as resource (in EG(regular_list). So far, so 
good. However, it won't be
- unregistered till the script ends. So, we need to take care 
of that.
- */
-   net->stream->in_free = 1;
-   zend_hash_index_del(&EG(regular_list), net->stream->rsrc_id);
-   net->stream->in_free = 0;
-
if (net->stream) {
DBG_INF_FMT("Freeing stream. abstract=%p", 
net->stream->abstract);
if (pers) {

Modified: php/php-src/trunk/ext/mysqlnd/mysqlnd_net.c
===
--- php/php-src/trunk/ext/mysqlnd/mysqlnd_net.c 2010-04-01 12:08:55 UTC (rev 
297273)
+++ php/php-src/trunk/ext/mysqlnd/mysqlnd_net.c 2010-04-01 12:46:21 UTC (rev 
297274)
@@ -159,6 +159,14 @@
 #endif
efree(hashed_details);
}
+   /*
+ Streams are not meant for C extensions! Thus we need a hack. Every 
connected stream will
+ be registered as resource (in EG(regular_list). So far, so good. 
However, it won't be
+ unregistered till the script ends. So, we need to take care of that.
+   */
+   net->stream->in_free = 1;
+   zend_hash_index_del(&EG(regular_list), net->stream->rsrc_id);
+   net->stream->in_free = 0;

if (!net->options.timeout_read) {
/* should always happen because read_timeout cannot be set via 
API */
@@ -703,15 +711,6 @@
mnd_pefree(net->cmd_buffer.buffer, pers);
net->cmd_buffer.buffer = NULL;
}
-   /*
- Streams are not meant for C extensions! Thus we need a hack. 
Every connected stream will
- be registered as resource (in EG(regular_list). So far, so 
good. However, it won't be
- unregistered till the script ends. So, we need to take care 
of that.
- */
-   net->stream->in_free = 1;
-   zend_hash_index_del(&EG(regular_list), net->stream->rsrc_id);
-   net->stream->in_free = 0;
-
if (net->stream) {
DBG_INF_FMT("Freeing stream. abstract=%p", 
net->stream->abstract);
if (pers) {

-- 
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_debug.c trunk/ext/mysqlnd/mysqlnd_debug.c

2010-04-06 Thread Andrey Hristov
andrey   Tue, 06 Apr 2010 14:33:55 +

Revision: http://svn.php.net/viewvc?view=revision&revision=297584

Log:
Stricly C

Changed paths:
U   php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_debug.c
U   php/php-src/trunk/ext/mysqlnd/mysqlnd_debug.c

Modified: php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_debug.c
===
--- php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_debug.c2010-04-06 
13:42:21 UTC (rev 297583)
+++ php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_debug.c2010-04-06 
14:33:55 UTC (rev 297584)
@@ -696,9 +696,9 @@
DBG_INF_FMT("size=%lu ptr=%p persistent=%d", size, ret, persistent);

if (collect_memory_statistics) {
-   *(size_t *) ret = size;
enum mysqlnd_collected_stats s1 = persistent? 
STAT_MEM_MALLOC_COUNT:STAT_MEM_EMALLOC_COUNT;
enum mysqlnd_collected_stats s2 = persistent? 
STAT_MEM_MALLOC_AMOUNT:STAT_MEM_EMALLOC_AMOUNT;
+   *(size_t *) ret = size;
MYSQLND_INC_GLOBAL_STATISTIC_W_VALUE2(s1, 1, s2, size);
}

@@ -741,9 +741,9 @@
DBG_INF_FMT("size=%lu ptr=%p", size, ret);

if (collect_memory_statistics) {
-   *(size_t *) ret = size;
enum mysqlnd_collected_stats s1 = persistent? 
STAT_MEM_CALLOC_COUNT:STAT_MEM_ECALLOC_COUNT;
enum mysqlnd_collected_stats s2 = persistent? 
STAT_MEM_CALLOC_AMOUNT:STAT_MEM_ECALLOC_AMOUNT;
+   *(size_t *) ret = size;
MYSQLND_INC_GLOBAL_STATISTIC_W_VALUE2(s1, 1, s2, size);
}

@@ -789,9 +789,9 @@
DBG_INF_FMT("new_ptr=%p", ret);

if (collect_memory_statistics) {
-   *(size_t *) ret = new_size;
enum mysqlnd_collected_stats s1 = persistent? 
STAT_MEM_REALLOC_COUNT:STAT_MEM_EREALLOC_COUNT;
enum mysqlnd_collected_stats s2 = persistent? 
STAT_MEM_REALLOC_AMOUNT:STAT_MEM_EREALLOC_AMOUNT;
+   *(size_t *) ret = new_size;
MYSQLND_INC_GLOBAL_STATISTIC_W_VALUE2(s1, 1, s2, new_size);
}
DBG_RETURN(FAKE_PTR(ret));

Modified: php/php-src/trunk/ext/mysqlnd/mysqlnd_debug.c
===
--- php/php-src/trunk/ext/mysqlnd/mysqlnd_debug.c   2010-04-06 13:42:21 UTC 
(rev 297583)
+++ php/php-src/trunk/ext/mysqlnd/mysqlnd_debug.c   2010-04-06 14:33:55 UTC 
(rev 297584)
@@ -696,9 +696,9 @@
DBG_INF_FMT("size=%lu ptr=%p persistent=%d", size, ret, persistent);

if (collect_memory_statistics) {
-   *(size_t *) ret = size;
enum mysqlnd_collected_stats s1 = persistent? 
STAT_MEM_MALLOC_COUNT:STAT_MEM_EMALLOC_COUNT;
enum mysqlnd_collected_stats s2 = persistent? 
STAT_MEM_MALLOC_AMOUNT:STAT_MEM_EMALLOC_AMOUNT;
+   *(size_t *) ret = size;
MYSQLND_INC_GLOBAL_STATISTIC_W_VALUE2(s1, 1, s2, size);
}

@@ -741,9 +741,9 @@
DBG_INF_FMT("size=%lu ptr=%p", size, ret);

if (collect_memory_statistics) {
-   *(size_t *) ret = size;
enum mysqlnd_collected_stats s1 = persistent? 
STAT_MEM_CALLOC_COUNT:STAT_MEM_ECALLOC_COUNT;
enum mysqlnd_collected_stats s2 = persistent? 
STAT_MEM_CALLOC_AMOUNT:STAT_MEM_ECALLOC_AMOUNT;
+   *(size_t *) ret = size;
MYSQLND_INC_GLOBAL_STATISTIC_W_VALUE2(s1, 1, s2, size);
}

@@ -789,9 +789,9 @@
DBG_INF_FMT("new_ptr=%p", ret);

if (collect_memory_statistics) {
-   *(size_t *) ret = new_size;
enum mysqlnd_collected_stats s1 = persistent? 
STAT_MEM_REALLOC_COUNT:STAT_MEM_EREALLOC_COUNT;
enum mysqlnd_collected_stats s2 = persistent? 
STAT_MEM_REALLOC_AMOUNT:STAT_MEM_EREALLOC_AMOUNT;
+   *(size_t *) ret = new_size;
MYSQLND_INC_GLOBAL_STATISTIC_W_VALUE2(s1, 1, s2, new_size);
}
DBG_RETURN(FAKE_PTR(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_wireprotocol.c trunk/ext/mysqlnd/mysqlnd_wireprotocol.c

2010-04-08 Thread Andrey Hristov
andrey   Thu, 08 Apr 2010 13:20:37 +

Revision: http://svn.php.net/viewvc?view=revision&revision=297701

Log:
Fixint INT_AND_FLOAT_AS native. It was working ok on 64bit but
because on 32bit SIZEOF_LONG is 4 and INT64 from MySQL is 8 everything
was converted to string, even if it was able to put it in a long.
This closes Request #50651 Native type cast returns wrong result

Bug: http://bugs.php.net/50651 (Assigned) Native type cast returns wrong result
  
Changed paths:
U   php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_wireprotocol.c
U   php/php-src/trunk/ext/mysqlnd/mysqlnd_wireprotocol.c

Modified: php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_wireprotocol.c
===
--- php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_wireprotocol.c 
2010-04-08 13:18:52 UTC (rev 297700)
+++ php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_wireprotocol.c 
2010-04-08 13:20:37 UTC (rev 297701)
@@ -1273,14 +1273,11 @@
}

 #ifdef MYSQLND_STRING_TO_INT_CONVERSION
-   if (as_int_or_float && perm_bind.php_type == IS_LONG &&
-   perm_bind.pack_len <= SIZEOF_LONG)
-   {
+   if (as_int_or_float && perm_bind.php_type == IS_LONG) {
zend_uchar save = *(p + len);
/* We have to make it ASCIIZ temporarily */
*(p + len) = '\0';
-   if (perm_bind.pack_len < SIZEOF_LONG)
-   {
+   if (perm_bind.pack_len < SIZEOF_LONG) {
/* direct conversion */
int64_t v =
 #ifndef PHP_WIN32
@@ -1304,6 +1301,8 @@
if ((uns == TRUE && v > 
L64(2147483647)) ||
(uns == FALSE && (( 
L64(2147483647) < (int64_t) v) ||
(L64(-2147483648) > (int64_t) 
v
+#else
+#error Need fix for this architecture
 #endif /* SIZEOF */
{
ZVAL_STRINGL(*current_field, 
(char *)p, len, 0);

Modified: php/php-src/trunk/ext/mysqlnd/mysqlnd_wireprotocol.c
===
--- php/php-src/trunk/ext/mysqlnd/mysqlnd_wireprotocol.c2010-04-08 
13:18:52 UTC (rev 297700)
+++ php/php-src/trunk/ext/mysqlnd/mysqlnd_wireprotocol.c2010-04-08 
13:20:37 UTC (rev 297701)
@@ -1273,14 +1273,11 @@
}

 #ifdef MYSQLND_STRING_TO_INT_CONVERSION
-   if (as_int_or_float && perm_bind.php_type == IS_LONG &&
-   perm_bind.pack_len <= SIZEOF_LONG)
-   {
+   if (as_int_or_float && perm_bind.php_type == IS_LONG) {
zend_uchar save = *(p + len);
/* We have to make it ASCIIZ temporarily */
*(p + len) = '\0';
-   if (perm_bind.pack_len < SIZEOF_LONG)
-   {
+   if (perm_bind.pack_len < SIZEOF_LONG) {
/* direct conversion */
int64_t v =
 #ifndef PHP_WIN32
@@ -1304,6 +1301,8 @@
if ((uns == TRUE && v > 
L64(2147483647)) ||
(uns == FALSE && (( 
L64(2147483647) < (int64_t) v) ||
(L64(-2147483648) > (int64_t) 
v
+#else
+#error Need fix for this architecture
 #endif /* SIZEOF */
{
ZVAL_STRINGL(*current_field, 
(char *)p, len, 0);

-- 
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_alloc.c trunk/ext/mysqlnd/mysqlnd_alloc.c

2010-04-15 Thread Andrey Hristov
andrey   Thu, 15 Apr 2010 15:22:56 +

Revision: http://svn.php.net/viewvc?view=revision&revision=298041

Log:
Remove unused file

Changed paths:
D   php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_alloc.c
D   php/php-src/trunk/ext/mysqlnd/mysqlnd_alloc.c

Deleted: php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_alloc.c
===
--- php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_alloc.c	2010-04-15 15:22:28 UTC (rev 298040)
+++ php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_alloc.c	2010-04-15 15:22:56 UTC (rev 298041)
@@ -1,285 +0,0 @@
-/*
-  +--+
-  | PHP Version 6|
-  +--+
-  | Copyright (c) 2006-2009 The PHP Group|
-  +--+
-  | This source file is subject to version 3.01 of the PHP license,  |
-  | that is bundled with this package in the file LICENSE, and is|
-  | available through the world-wide-web at the following url:   |
-  | http://www.php.net/license/3_01.txt  |
-  | If you did not receive a copy of the PHP license and are unable to   |
-  | obtain it through the world-wide-web, please send a note to  |
-  | lice...@php.net so we can mail you a copy immediately.   |
-  +--+
-  | Authors: Georg Richter  |
-  |  Andrey Hristov|
-  |  Ulf Wendel   |
-  +--+
-
-*/
-
-/* $Id$ */
-#include "php.h"
-#include "mysqlnd.h"
-#include "mysqlnd_priv.h"
-#include "mysqlnd_palloc.h"
-
-
-#define MYSQLND_SILENT
-#define MYSQLND_DONT_DUMP_STATS
-
-#define MYSQLND_ZVALS_MAX_CACHE 5000
-
-
-#if A0
-/* Caching zval allocator */
-zval * mysqlnd_alloc_get_zval(MYSQLND_ZVAL_CACHE * const cache);
-void mysqlnd_alloc_zval_ptr_dtor(zval **zv, MYSQLND_ZVAL_CACHE * const cache);
-MYSQLND_ZVAL_CACHE* mysqlnd_alloc_init_cache();
-MYSQLND_ZVAL_CACHE* mysqlnd_alloc_get_cache_reference(MYSQLND_ZVAL_CACHE *cache);
-voidmysqlnd_alloc_free_cache_reference(MYSQLND_ZVAL_CACHE **cache);
-#endif
-
-
-/*
- The cache line is a big contiguous array of zval pointers.
- Because the CPU cache will cache starting from an address, and not
- before it, then we have to organize our structure according to this.
- Thus, if 'last_added' is valid pointer (not NULL) then last_added is
- increased. When zval is cached, if there is room, last_added is decreased
- and then the zval pointer will be assigned to it. This means that some
- positions may become hot points and stay in the cache.
- Imagine we have 5 pointers in a line
- 1. last_added = list_item->ptr_line + cache->max_items;
- 2. get_zval -> *last_added = NULL. Use MAKE_STD_ZVAL
- 3. get_zval -> *last_added = NULL. Use MAKE_STD_ZVAL
- 4. get_zval -> *last_added = NULL. Use MAKE_STD_ZVAL
-0x0
-	0x0
-	0x0
-	0x0
-	0x0
-	---
-empty_position, always 0x0 <-- last_added
-
- 5. free_zval -> if (free_items++ != max_items) {// we can add more
-   *(--last_added) = zval_ptr;
-}
-	(memory addresses increase downwards)
-0x0
-	0x0
-	0x0
-	0x0
-	0xA <-- last_added
-	---
-	0x0
-
- 6. free_zval -> if (free_items++ != max_items) {// we can add more
-   *(--last_added) = zval_ptr;
-}
-0x0
-	0x0
-	0x0
-	0xB <-- last_added
-	0xA
-	---
-	0x0
-
- 7. free_zval -> if (free_items++ != max_items) {// we can add more
-   *(--last_added) = zval_ptr;
-}
-0x0
-	0x0
-	0xC <-- last_added
-	0xB
-	0xA
-	---
-	0x0
-
- 8. get_zval -> *last_added != NULL. -> p = *last_added; *last_added++ = NULL;
-0x0
-	0x0
-	0x0
-	0xB <-- last_added
-	0xA
-	---
-	0x0
-
- 9. get_zval -> *last_added != NULL. -> p = *last_added; *last_added++ = NULL;
-0x0
-	0x0
-	0x0
-	0x0
-	0xA <-- last_added
-	---
-	0x0
-
-10. get_zval -> *last_added != NULL. -> p = *last_added; *last_added++ = NULL;
-0x0
-	0x0
-	0x0
-	0x0
-	0x0
-	---
-	0x0 <-- last_added
-
-*/
-
-
-zval * mysqlnd_alloc_get_zval(MYSQLND_ZVAL_CACHE * const cache)
-{
-	zval *ret = NULL;
-
-#ifndef MYSQLND_SILENT
-	php_printf("[mysqlnd_alloc_get_zval %p] *last_added=%p free_items=%d  ", cache, cache? cache->free_list->last_added:NULL, cache->free_items);
-#endif
-
-	if (cache) {
-		if ((ret = *cache->free_list->last_added)) {
-			*cache->free_list->last_added++ = NULL;
-
-			--cache->free_items;
-			++cache->get_hits;
-		} else {
-			++cache->get_misses;
-		}
-	}
-	if (!ret) {
-		ALLOC_ZVAL(ret);
-	}
-	INIT_PZVAL(ret);
-
-#ifndef MYSQLND_SILENT
-	php_printf("ret=%p\n", ret);
-#endif
-	return ret;
-}
-
-s

[PHP-CVS] svn: /php/php-src/ branches/PHP_5_3/ext/mysqlnd/mysqlnd_wireprotocol.c trunk/ext/mysqlnd/mysqlnd_wireprotocol.c

2010-04-15 Thread Andrey Hristov
andrey   Thu, 15 Apr 2010 15:58:26 +

Revision: http://svn.php.net/viewvc?view=revision&revision=298046

Log:
Last batch of int/uint comparison fixes

Changed paths:
U   php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_wireprotocol.c
U   php/php-src/trunk/ext/mysqlnd/mysqlnd_wireprotocol.c

Modified: php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_wireprotocol.c
===
--- php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_wireprotocol.c 
2010-04-15 15:53:58 UTC (rev 298045)
+++ php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_wireprotocol.c 
2010-04-15 15:58:26 UTC (rev 298046)
@@ -545,7 +545,7 @@
p+= 2;

/* There is a message */
-   if (packet->header.size > p - buf && (i = 
php_mysqlnd_net_field_length(&p))) {
+   if (packet->header.size > (size_t) (p - buf) && (i = 
php_mysqlnd_net_field_length(&p))) {
packet->message = mnd_pestrndup((char *)p, MIN(i, buf_len - (p 
- begin)), FALSE);
packet->message_len = i;
} else {
@@ -780,7 +780,7 @@
packet->warning_count = uint2korr(p);
p+=2;
/* Check for additional textual data */
-   if (packet->header.size  > (p - buf) && (len = 
php_mysqlnd_net_field_length(&p))) {
+   if (packet->header.size  > (size_t) (p - buf) && (len = 
php_mysqlnd_net_field_length(&p))) {
packet->info_or_local_file = mnd_emalloc(len + 
1);
memcpy(packet->info_or_local_file, p, len);
packet->info_or_local_file[len] = '\0';
@@ -935,7 +935,7 @@
  NULL_LENGTH (0xFB) comes from COM_FIELD_LIST when the default value 
is NULL.
  Otherwise the string is length encoded.
*/
-   if (packet->header.size > (p - buf) &&
+   if (packet->header.size > (size_t) (p - buf) &&
(len = php_mysqlnd_net_field_length(&p)) &&
len != MYSQLND_NULL_LENGTH)
{

Modified: php/php-src/trunk/ext/mysqlnd/mysqlnd_wireprotocol.c
===
--- php/php-src/trunk/ext/mysqlnd/mysqlnd_wireprotocol.c2010-04-15 
15:53:58 UTC (rev 298045)
+++ php/php-src/trunk/ext/mysqlnd/mysqlnd_wireprotocol.c2010-04-15 
15:58:26 UTC (rev 298046)
@@ -545,7 +545,7 @@
p+= 2;

/* There is a message */
-   if (packet->header.size > p - buf && (i = 
php_mysqlnd_net_field_length(&p))) {
+   if (packet->header.size > (size_t) (p - buf) && (i = 
php_mysqlnd_net_field_length(&p))) {
packet->message = mnd_pestrndup((char *)p, MIN(i, buf_len - (p 
- begin)), FALSE);
packet->message_len = i;
} else {
@@ -780,7 +780,7 @@
packet->warning_count = uint2korr(p);
p+=2;
/* Check for additional textual data */
-   if (packet->header.size  > (p - buf) && (len = 
php_mysqlnd_net_field_length(&p))) {
+   if (packet->header.size  > (size_t) (p - buf) && (len = 
php_mysqlnd_net_field_length(&p))) {
packet->info_or_local_file = mnd_emalloc(len + 
1);
memcpy(packet->info_or_local_file, p, len);
packet->info_or_local_file[len] = '\0';
@@ -935,7 +935,7 @@
  NULL_LENGTH (0xFB) comes from COM_FIELD_LIST when the default value 
is NULL.
  Otherwise the string is length encoded.
*/
-   if (packet->header.size > (p - buf) &&
+   if (packet->header.size > (size_t) (p - buf) &&
(len = php_mysqlnd_net_field_length(&p)) &&
len != MYSQLND_NULL_LENGTH)
{

-- 
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_wireprotocol.c trunk/ext/mysqlnd/mysqlnd_wireprotocol.c

2010-04-20 Thread Andrey Hristov
andrey   Tue, 20 Apr 2010 19:09:56 +

Revision: http://svn.php.net/viewvc?view=revision&revision=298230

Log:
put the trigger in the right place

Changed paths:
U   php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_wireprotocol.c
U   php/php-src/trunk/ext/mysqlnd/mysqlnd_wireprotocol.c

Modified: php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_wireprotocol.c
===
--- php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_wireprotocol.c 
2010-04-20 18:04:24 UTC (rev 298229)
+++ php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_wireprotocol.c 
2010-04-20 19:09:56 UTC (rev 298230)
@@ -1689,11 +1689,11 @@

if (packet->header.size == 1 && buf[0] == EODATA_MARKER && 
packet->server_capabilities & CLIENT_SECURE_CONNECTION) {
/* We don't handle 3.23 authentication */
+   packet->server_asked_323_auth = TRUE;
DBG_RETURN(FAIL);
}

if (ERROR_MARKER == packet->field_count) {
-   packet->server_asked_323_auth = TRUE;
php_mysqlnd_read_error_from_line(p, packet->header.size - 1,

 packet->error_info.error,

 sizeof(packet->error_info.error),

Modified: php/php-src/trunk/ext/mysqlnd/mysqlnd_wireprotocol.c
===
--- php/php-src/trunk/ext/mysqlnd/mysqlnd_wireprotocol.c2010-04-20 
18:04:24 UTC (rev 298229)
+++ php/php-src/trunk/ext/mysqlnd/mysqlnd_wireprotocol.c2010-04-20 
19:09:56 UTC (rev 298230)
@@ -1689,11 +1689,11 @@

if (packet->header.size == 1 && buf[0] == EODATA_MARKER && 
packet->server_capabilities & CLIENT_SECURE_CONNECTION) {
/* We don't handle 3.23 authentication */
+   packet->server_asked_323_auth = TRUE;
DBG_RETURN(FAIL);
}

if (ERROR_MARKER == packet->field_count) {
-   packet->server_asked_323_auth = TRUE;
php_mysqlnd_read_error_from_line(p, packet->header.size - 1,

 packet->error_info.error,

 sizeof(packet->error_info.error),

-- 
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_wireprotocol.c trunk/ext/mysqlnd/mysqlnd_wireprotocol.c

2010-04-20 Thread Andrey Hristov
andrey   Tue, 20 Apr 2010 20:02:32 +

Revision: http://svn.php.net/viewvc?view=revision&revision=298235

Log:
Hardening the reads of mysqlnd.
All packets but the row data packet are read into preallocated buffer,
either on the stack or on the heap (cmd_buffer). The size of the buffer
is always checked to skip buffer overruns. Only up to the size of the
buffer is stored into the buffer but packet->header.size has the size of
all data sent. In this case network layer bails.

This patch hardenes the reads, so if packets are malformed and shorter
than they should be there will be no further reads in the buffer.
In short, detection of malformed packets.

Changed paths:
U   php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_wireprotocol.c
U   php/php-src/trunk/ext/mysqlnd/mysqlnd_wireprotocol.c

Modified: php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_wireprotocol.c
===
--- php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_wireprotocol.c	2010-04-20 19:57:04 UTC (rev 298234)
+++ php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_wireprotocol.c	2010-04-20 20:02:32 UTC (rev 298235)
@@ -61,6 +61,13 @@
 	}


+#define BAIL_IF_NO_MORE_DATA \
+	if ((size_t)(p - begin) > packet->header.size) { \
+		php_error_docref(NULL TSRMLS_CC, E_WARNING, "At line %d", __LINE__); \
+		goto premature_end; \
+	} \
+
+
 static const char *unknown_sqlstate= "HY000";

 char * const mysqlnd_empty_string = "";
@@ -294,9 +301,11 @@
 	DBG_ENTER("php_mysqlnd_greet_read");

 	PACKET_READ_HEADER_AND_BODY(packet, conn, buf, sizeof(buf), "greeting", PROT_GREET_PACKET);
+	BAIL_IF_NO_MORE_DATA;

 	packet->protocol_version = uint1korr(p);
 	p++;
+	BAIL_IF_NO_MORE_DATA;

 	if (ERROR_MARKER == packet->protocol_version) {
 		php_mysqlnd_read_error_from_line(p, packet->header.size - 1,
@@ -316,27 +325,35 @@

 	packet->server_version = estrdup((char *)p);
 	p+= strlen(packet->server_version) + 1; /* eat the '\0' */
+	BAIL_IF_NO_MORE_DATA;

 	packet->thread_id = uint4korr(p);
 	p+=4;
+	BAIL_IF_NO_MORE_DATA;

 	memcpy(packet->scramble_buf, p, SCRAMBLE_LENGTH_323);
 	p+= 8;
+	BAIL_IF_NO_MORE_DATA;

 	/* pad1 */
 	p++;
+	BAIL_IF_NO_MORE_DATA;

 	packet->server_capabilities = uint2korr(p);
 	p+= 2;
+	BAIL_IF_NO_MORE_DATA;

 	packet->charset_no = uint1korr(p);
 	p++;
+	BAIL_IF_NO_MORE_DATA;

 	packet->server_status = uint2korr(p);
 	p+= 2;
+	BAIL_IF_NO_MORE_DATA;

 	/* pad2 */
 	p+= 13;
+	BAIL_IF_NO_MORE_DATA;

 	if ((size_t) (p - buf) < packet->header.size) {
 		/* scramble_buf is split into two parts */
@@ -352,14 +369,12 @@
 	DBG_INF_FMT("server_capabilities=%d charset_no=%d server_status=%d",
 packet->server_capabilities, packet->charset_no, packet->server_status);

-	if ((size_t)(p - begin) > packet->header.size) {
-		DBG_ERR_FMT("GREET packet %d bytes shorter than expected", p - begin - packet->header.size);
-		php_error_docref(NULL TSRMLS_CC, E_WARNING, "GREET packet "MYSQLND_SZ_T_SPEC" bytes shorter than expected",
-		 p - begin - packet->header.size);
-		DBG_RETURN(FAIL);
-	}
-
 	DBG_RETURN(PASS);
+premature_end:
+	DBG_ERR_FMT("GREET packet %d bytes shorter than expected", p - begin - packet->header.size);
+	php_error_docref(NULL TSRMLS_CC, E_WARNING, "GREET packet "MYSQLND_SZ_T_SPEC" bytes shorter than expected",
+	 p - begin - packet->header.size);
+	DBG_RETURN(FAIL);
 }
 /* }}} */

@@ -522,10 +537,12 @@
 	DBG_ENTER("php_mysqlnd_ok_read");

 	PACKET_READ_HEADER_AND_BODY(packet, conn, buf, buf_len, "OK", PROT_OK_PACKET);
+	BAIL_IF_NO_MORE_DATA;

 	/* Should be always 0x0 or ERROR_MARKER for error */
 	packet->field_count = uint1korr(p);
 	p++;
+	BAIL_IF_NO_MORE_DATA;

 	if (ERROR_MARKER == packet->field_count) {
 		php_mysqlnd_read_error_from_line(p, packet->header.size - 1,
@@ -536,13 +553,18 @@
 	}
 	/* Everything was fine! */
 	packet->affected_rows  = php_mysqlnd_net_field_length_ll(&p);
+	BAIL_IF_NO_MORE_DATA;
+
 	packet->last_insert_id = php_mysqlnd_net_field_length_ll(&p);
+	BAIL_IF_NO_MORE_DATA;

 	packet->server_status = uint2korr(p);
 	p+= 2;
+	BAIL_IF_NO_MORE_DATA;

 	packet->warning_count = uint2korr(p);
 	p+= 2;
+	BAIL_IF_NO_MORE_DATA;

 	/* There is a message */
 	if (packet->header.size > (size_t) (p - buf) && (i = php_mysqlnd_net_field_length(&p))) {
@@ -556,14 +578,14 @@
 packet->affected_rows, packet->last_insert_id, packet->server_status,
 packet->warning_count);

-	if ((size_t)(p - begin) > packet->header.size) {
-		DBG_ERR_FMT("OK packet %d bytes shorter than expected", p - begin - packet->header.size);
-		php_error_docref(NULL TSRMLS_CC, E_WARNING, "OK packet "MYSQLND_SZ_T_SPEC" bytes shorter than expected",
-		 p - begin - packet->header.size);
-		DBG_RETURN(FAIL);
-	}
+	BAIL_IF_NO_MORE_DATA;

 	DBG_RETURN(PASS);
+premature_end:
+	DBG_ERR_FMT("OK packet %d bytes shorter than expected", p - begin - packet->header.size);
+	php_error_docref(NULL TSRMLS_CC, E_WARNING, "OK packet "MYSQLND_SZ_T_SPEC" bytes sh

[PHP-CVS] svn: /php/php-src/ branches/PHP_5_3/ext/mysqlnd/mysqlnd_statistics.h trunk/ext/mysqlnd/mysqlnd_statistics.h

2010-04-22 Thread Andrey Hristov
andrey   Thu, 22 Apr 2010 13:03:44 +

Revision: http://svn.php.net/viewvc?view=revision&revision=298318

Log:
Add the posibility to switch off the compilation of statistics
collection, for those who want to optimize the last percent of their
binaries.

Changed paths:
U   php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_statistics.h
U   php/php-src/trunk/ext/mysqlnd/mysqlnd_statistics.h

Modified: php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_statistics.h
===
--- php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_statistics.h   
2010-04-22 12:43:37 UTC (rev 298317)
+++ php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_statistics.h   
2010-04-22 13:03:44 UTC (rev 298318)
@@ -42,21 +42,28 @@
 #define MYSQLND_STATS_UNLOCK(stats)
 #endif

+#ifndef MYSQLND_CORE_STATISTICS_TRIGGERS_DISABLED
+#define MYSQLND_STAT_CALL_TRIGGER(s_array, statistic, val) \
+   if ((s_array)->triggers[(statistic)] && 
(s_array)->in_trigger == FALSE) { \
+   (s_array)->in_trigger = TRUE; \
+   MYSQLND_STATS_UNLOCK((s_array)); \
+   

\
+   (s_array)->triggers[(statistic)]((s_array), 
(statistic), (val) TSRMLS_CC); \
+   

\
+   MYSQLND_STATS_LOCK((s_array)); \
+   (s_array)->in_trigger = FALSE; \
+   }
+#else
+#define MYSQLND_STAT_CALL_TRIGGER(s_array, statistic, val)
+#endif /* MYSQLND_CORE_STATISTICS_TRIGGERS_DISABLED */
+
 #define MYSQLND_UPDATE_VALUE_AND_CALL_TRIGGER(stats, statistic, value) \
{ \
MYSQLND_STATS_LOCK(stats); \
(stats)->values[(statistic)] += (value); \
-   if ((stats)->triggers[(statistic)] && 
(stats)->in_trigger == FALSE) { \
-   (stats)->in_trigger = TRUE; \
-   MYSQLND_STATS_UNLOCK(stats); \
-   

\
-   (stats)->triggers[(statistic)]((stats), 
(statistic), (value) TSRMLS_CC); \
-   

\
-   MYSQLND_STATS_LOCK(stats); \
-   (stats)->in_trigger = FALSE; \
-   } \
+   MYSQLND_STAT_CALL_TRIGGER((stats), (statistic), 
(value)); \
MYSQLND_STATS_UNLOCK(_p_s); \
-   } \
+   }

 #define MYSQLND_DEC_STATISTIC(enabler, stats, statistic) \
  { \
@@ -116,6 +123,9 @@
  }


+
+#ifndef MYSQLND_CORE_STATISTICS_DISABLED
+
 #define MYSQLND_INC_GLOBAL_STATISTIC(statistic) \
MYSQLND_INC_STATISTIC(MYSQLND_G(collect_statistics), 
mysqlnd_global_stats, (statistic))

@@ -141,7 +151,18 @@
MYSQLND_INC_STATISTIC_W_VALUE3(MYSQLND_G(collect_statistics), 
mysqlnd_global_stats, (statistic1), (value1), (statistic2), (value2), 
(statistic3), (value3)); \
MYSQLND_INC_STATISTIC_W_VALUE3(MYSQLND_G(collect_statistics), 
(conn_stats), (statistic1), (value1), (statistic2), (value2), (statistic3), 
(value3));

+#else

+#define MYSQLND_INC_GLOBAL_STATISTIC(statistic)
+#define MYSQLND_DEC_CONN_STATISTIC(conn_stats, statistic)
+#define MYSQLND_INC_GLOBAL_STATISTIC_W_VALUE2(statistic1, value1, statistic2, 
value2)
+#define MYSQLND_INC_CONN_STATISTIC(conn_stats, statistic)
+#define MYSQLND_INC_CONN_STATISTIC_W_VALUE(conn_stats, statistic, value)
+#define MYSQLND_INC_CONN_STATISTIC_W_VALUE2(conn_stats, statistic1, value1, 
statistic2, value2)
+#define MYSQLND_INC_CONN_STATISTIC_W_VALUE3(conn_stats, statistic1, value1, 
statistic2, value2, statistic3, value3)
+
+#endif /* MYSQLND_CORE_STATISTICS_DISABLED */
+
 PHPAPI void mysqlnd_fill_stats_hash(const MYSQLND_STATS * const stats, const 
MYSQLND_STRING * names, zval *return_value TSRMLS_DC ZEND_FILE_LINE_DC);

 PHPAPI void mysqlnd_stats_init(MYSQLND_STATS ** stats, size_t statistic_count);

Modified: php/php-src/trunk/ext/mysqlnd/mysqlnd_statistics.h
===
--- php/php-src/trunk/ext/mysqlnd/mysqlnd_statistics.h  2010-04-22 12:43:37 UTC 
(rev 298317)
+++ php/php-src/trunk/ext/mysqlnd/mysqlnd_statistics.h  2010-04-22 13:03:44 UTC 
(rev 298318)
@@ -42,21 +42,28 @@
 #de

[PHP-CVS] svn: /php/php-src/ branches/PHP_5_3/ext/mysqlnd/php_mysqlnd.c trunk/ext/mysqlnd/php_mysqlnd.c

2010-04-22 Thread Andrey Hristov
andrey   Thu, 22 Apr 2010 15:14:45 +

Revision: http://svn.php.net/viewvc?view=revision&revision=298324

Log:
adding what last commit was missing

Changed paths:
U   php/php-src/branches/PHP_5_3/ext/mysqlnd/php_mysqlnd.c
U   php/php-src/trunk/ext/mysqlnd/php_mysqlnd.c

Modified: php/php-src/branches/PHP_5_3/ext/mysqlnd/php_mysqlnd.c
===
--- php/php-src/branches/PHP_5_3/ext/mysqlnd/php_mysqlnd.c  2010-04-22 
15:07:40 UTC (rev 298323)
+++ php/php-src/branches/PHP_5_3/ext/mysqlnd/php_mysqlnd.c  2010-04-22 
15:14:45 UTC (rev 298324)
@@ -151,6 +151,7 @@
mysqlnd_globals->net_read_buffer_size = 32768;
mysqlnd_globals->net_read_timeout = 31536000;
mysqlnd_globals->log_mask = 0;
+   mysqlnd_globals->log_mask = 16000;
 }
 /* }}} */


Modified: php/php-src/trunk/ext/mysqlnd/php_mysqlnd.c
===
--- php/php-src/trunk/ext/mysqlnd/php_mysqlnd.c 2010-04-22 15:07:40 UTC (rev 
298323)
+++ php/php-src/trunk/ext/mysqlnd/php_mysqlnd.c 2010-04-22 15:14:45 UTC (rev 
298324)
@@ -151,6 +151,7 @@
mysqlnd_globals->net_read_buffer_size = 32768;
mysqlnd_globals->net_read_timeout = 31536000;
mysqlnd_globals->log_mask = 0;
+   mysqlnd_globals->log_mask = 16000;
 }
 /* }}} */


-- 
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/php_mysqlnd.c trunk/ext/mysqlnd/php_mysqlnd.c

2010-04-22 Thread Andrey Hristov
andrey   Thu, 22 Apr 2010 16:22:56 +

Revision: http://svn.php.net/viewvc?view=revision&revision=298335

Log:
Fix problem spotted by Felipe.

Changed paths:
U   php/php-src/branches/PHP_5_3/ext/mysqlnd/php_mysqlnd.c
U   php/php-src/trunk/ext/mysqlnd/php_mysqlnd.c

Modified: php/php-src/branches/PHP_5_3/ext/mysqlnd/php_mysqlnd.c
===
--- php/php-src/branches/PHP_5_3/ext/mysqlnd/php_mysqlnd.c  2010-04-22 
16:20:08 UTC (rev 298334)
+++ php/php-src/branches/PHP_5_3/ext/mysqlnd/php_mysqlnd.c  2010-04-22 
16:22:56 UTC (rev 298335)
@@ -151,7 +151,7 @@
mysqlnd_globals->net_read_buffer_size = 32768;
mysqlnd_globals->net_read_timeout = 31536000;
mysqlnd_globals->log_mask = 0;
-   mysqlnd_globals->log_mask = 16000;
+   mysqlnd_globals->mempool_default_size = 16000;
 }
 /* }}} */


Modified: php/php-src/trunk/ext/mysqlnd/php_mysqlnd.c
===
--- php/php-src/trunk/ext/mysqlnd/php_mysqlnd.c 2010-04-22 16:20:08 UTC (rev 
298334)
+++ php/php-src/trunk/ext/mysqlnd/php_mysqlnd.c 2010-04-22 16:22:56 UTC (rev 
298335)
@@ -151,7 +151,7 @@
mysqlnd_globals->net_read_buffer_size = 32768;
mysqlnd_globals->net_read_timeout = 31536000;
mysqlnd_globals->log_mask = 0;
-   mysqlnd_globals->log_mask = 16000;
+   mysqlnd_globals->mempool_default_size = 16000;
 }
 /* }}} */


-- 
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_enum_n_def.h trunk/ext/mysqlnd/mysqlnd_enum_n_def.h

2010-04-27 Thread Andrey Hristov
andrey   Tue, 27 Apr 2010 11:02:51 +

Revision: http://svn.php.net/viewvc?view=revision&revision=298650

Log:
Of course, 64*4 is 256, not 1024

Changed paths:
U   php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_enum_n_def.h
U   php/php-src/trunk/ext/mysqlnd/mysqlnd_enum_n_def.h

Modified: php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_enum_n_def.h
===
--- php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_enum_n_def.h   
2010-04-27 10:53:27 UTC (rev 298649)
+++ php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_enum_n_def.h   
2010-04-27 11:02:51 UTC (rev 298650)
@@ -39,8 +39,8 @@
 #define MYSQLND_SQLSTATE_LENGTH5
 #define MYSQLND_SQLSTATE_NULL  "0"

-#define MYSQLND_MAX_ALLOWED_USER_LEN   1024  /* 64 char * 4byte . MySQL 
supports now only 16 char, but let it be forward compatible */
-#define MYSQLND_MAX_ALLOWED_DB_LEN 1024  /* 256 char * 4byte. 
MySQL supports now only 64 char in the tables, but on the FS could be 
different. Forward compatible. */
+#define MYSQLND_MAX_ALLOWED_USER_LEN   256 /* 64 char * 4byte . 
MySQL supports now only 16 char, but let it be forward compatible */
+#define MYSQLND_MAX_ALLOWED_DB_LEN 1024/* 256 char * 4byte. 
MySQL supports now only 64 char in the tables, but on the FS could be 
different. Forward compatible. */

 #define MYSQLND_NET_CMD_BUFFER_MIN_SIZE4096
 #define MYSQLND_NET_CMD_BUFFER_MIN_SIZE_STR"4096"

Modified: php/php-src/trunk/ext/mysqlnd/mysqlnd_enum_n_def.h
===
--- php/php-src/trunk/ext/mysqlnd/mysqlnd_enum_n_def.h  2010-04-27 10:53:27 UTC 
(rev 298649)
+++ php/php-src/trunk/ext/mysqlnd/mysqlnd_enum_n_def.h  2010-04-27 11:02:51 UTC 
(rev 298650)
@@ -39,8 +39,8 @@
 #define MYSQLND_SQLSTATE_LENGTH5
 #define MYSQLND_SQLSTATE_NULL  "0"

-#define MYSQLND_MAX_ALLOWED_USER_LEN   1024  /* 64 char * 4byte . MySQL 
supports now only 16 char, but let it be forward compatible */
-#define MYSQLND_MAX_ALLOWED_DB_LEN 1024  /* 256 char * 4byte. 
MySQL supports now only 64 char in the tables, but on the FS could be 
different. Forward compatible. */
+#define MYSQLND_MAX_ALLOWED_USER_LEN   256 /* 64 char * 4byte . 
MySQL supports now only 16 char, but let it be forward compatible */
+#define MYSQLND_MAX_ALLOWED_DB_LEN 1024/* 256 char * 4byte. 
MySQL supports now only 64 char in the tables, but on the FS could be 
different. Forward compatible. */

 #define MYSQLND_NET_CMD_BUFFER_MIN_SIZE4096
 #define MYSQLND_NET_CMD_BUFFER_MIN_SIZE_STR"4096"

-- 
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_wireprotocol.c trunk/ext/mysqlnd/mysqlnd_wireprotocol.c

2010-04-29 Thread Andrey Hristov
andrey   Thu, 29 Apr 2010 11:49:08 +

Revision: http://svn.php.net/viewvc?view=revision&revision=298767

Log:
Fix crash if OOM and USE_ZEND_ALLOC=0

Changed paths:
U   php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_wireprotocol.c
U   php/php-src/trunk/ext/mysqlnd/mysqlnd_wireprotocol.c

Modified: php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_wireprotocol.c
===
--- php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_wireprotocol.c 
2010-04-29 10:53:24 UTC (rev 298766)
+++ php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_wireprotocol.c 
2010-04-29 11:49:08 UTC (rev 298767)
@@ -705,7 +705,7 @@
MYSQLND_PACKET_COMMAND *packet= (MYSQLND_PACKET_COMMAND *) _packet;
MYSQLND_NET *net = conn->net;
unsigned int error_reporting = EG(error_reporting);
-   size_t written;
+   size_t written = 0;

DBG_ENTER("php_mysqlnd_cmd_write");
/*
@@ -734,6 +734,9 @@
size_t tmp_len = packet->arg_len + 1 + MYSQLND_HEADER_SIZE, ret;
zend_uchar *tmp, *p;
tmp = (tmp_len > net->cmd_buffer.length)? 
mnd_emalloc(tmp_len):net->cmd_buffer.buffer;
+   if (!tmp) {
+   goto end;
+   }
p = tmp + MYSQLND_HEADER_SIZE; /* skip the header */

int1store(p, packet->command);
@@ -748,6 +751,7 @@
}
written = ret;
}
+end:
if (error_reporting) {
/* restore error reporting */
EG(error_reporting) = error_reporting;

Modified: php/php-src/trunk/ext/mysqlnd/mysqlnd_wireprotocol.c
===
--- php/php-src/trunk/ext/mysqlnd/mysqlnd_wireprotocol.c2010-04-29 
10:53:24 UTC (rev 298766)
+++ php/php-src/trunk/ext/mysqlnd/mysqlnd_wireprotocol.c2010-04-29 
11:49:08 UTC (rev 298767)
@@ -705,7 +705,7 @@
MYSQLND_PACKET_COMMAND *packet= (MYSQLND_PACKET_COMMAND *) _packet;
MYSQLND_NET *net = conn->net;
unsigned int error_reporting = EG(error_reporting);
-   size_t written;
+   size_t written = 0;

DBG_ENTER("php_mysqlnd_cmd_write");
/*
@@ -734,6 +734,9 @@
size_t tmp_len = packet->arg_len + 1 + MYSQLND_HEADER_SIZE, ret;
zend_uchar *tmp, *p;
tmp = (tmp_len > net->cmd_buffer.length)? 
mnd_emalloc(tmp_len):net->cmd_buffer.buffer;
+   if (!tmp) {
+   goto end;
+   }
p = tmp + MYSQLND_HEADER_SIZE; /* skip the header */

int1store(p, packet->command);
@@ -748,6 +751,7 @@
}
written = ret;
}
+end:
if (error_reporting) {
/* restore error reporting */
EG(error_reporting) = error_reporting;

-- 
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

2010-04-29 Thread Andrey Hristov
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

2010-04-29 Thread Andrey Hristov
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

2010-05-03 Thread Andrey Hristov
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_debug.c trunk/ext/mysqlnd/mysqlnd_debug.c

2010-05-03 Thread Andrey Hristov
andrey   Mon, 03 May 2010 13:51:30 +

Revision: http://svn.php.net/viewvc?view=revision&revision=298902

Log:
Fix compiler warnings - unused functions

Changed paths:
U   php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_debug.c
U   php/php-src/trunk/ext/mysqlnd/mysqlnd_debug.c

Modified: php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_debug.c
===
--- php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_debug.c2010-05-03 
13:45:58 UTC (rev 298901)
+++ php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_debug.c2010-05-03 
13:51:30 UTC (rev 298902)
@@ -28,60 +28,6 @@
 #include "mysqlnd_statistics.h"
 #include "zend_builtin_functions.h"

-static void * mysqlnd_zend_mm_emalloc(size_t size MYSQLND_MEM_D);
-static void * mysqlnd_zend_mm_pemalloc(size_t size, zend_bool persistent 
MYSQLND_MEM_D);
-static void * mysqlnd_zend_mm_ecalloc(unsigned int nmemb, size_t size 
MYSQLND_MEM_D);
-static void * mysqlnd_zend_mm_pecalloc(unsigned int nmemb, size_t size, 
zend_bool persistent MYSQLND_MEM_D);
-static void * mysqlnd_zend_mm_erealloc(void *ptr, size_t new_size 
MYSQLND_MEM_D);
-static void * mysqlnd_zend_mm_perealloc(void *ptr, size_t new_size, zend_bool 
persistent MYSQLND_MEM_D);
-static void mysqlnd_zend_mm_efree(void * ptr MYSQLND_MEM_D);
-static void mysqlnd_zend_mm_pefree(void * ptr, zend_bool persistent 
MYSQLND_MEM_D);
-static void * mysqlnd_zend_mm_malloc(size_t size MYSQLND_MEM_D);
-static void * mysqlnd_zend_mm_calloc(unsigned int nmemb, size_t size 
MYSQLND_MEM_D);
-static void * mysqlnd_zend_mm_realloc(void * ptr, size_t new_size 
MYSQLND_MEM_D);
-static void mysqlnd_zend_mm_free(void * ptr MYSQLND_MEM_D);
-static char * mysqlnd_zend_mm_pestrndup(const char * const ptr, size_t length, 
zend_bool persistent MYSQLND_MEM_D);
-static char * mysqlnd_zend_mm_pestrdup(const char * const ptr, zend_bool 
persistent MYSQLND_MEM_D);
-
-#define MYSQLND_DEBUG_MEMORY 1
-
-struct st_mysqlnd_allocator_methods mysqlnd_allocator =
-{
-#if MYSQLND_DEBUG_MEMORY
-   _mysqlnd_emalloc,
-   _mysqlnd_pemalloc,
-   _mysqlnd_ecalloc,
-   _mysqlnd_pecalloc,
-   _mysqlnd_erealloc,
-   _mysqlnd_perealloc,
-   _mysqlnd_efree,
-   _mysqlnd_pefree,
-   _mysqlnd_malloc,
-   _mysqlnd_calloc,
-   _mysqlnd_realloc,
-   _mysqlnd_free,
-   _mysqlnd_pestrndup,
-   _mysqlnd_pestrdup
-#else
-   mysqlnd_zend_mm_emalloc,
-   mysqlnd_zend_mm_pemalloc,
-   mysqlnd_zend_mm_ecalloc,
-   mysqlnd_zend_mm_pecalloc,
-   mysqlnd_zend_mm_erealloc,
-   mysqlnd_zend_mm_perealloc,
-   mysqlnd_zend_mm_efree,
-   mysqlnd_zend_mm_pefree,
-   mysqlnd_zend_mm_malloc,
-   mysqlnd_zend_mm_calloc,
-   mysqlnd_zend_mm_realloc,
-   mysqlnd_zend_mm_free,
-   mysqlnd_zend_mm_pestrndup,
-   mysqlnd_zend_mm_pestrdup
-#endif
-};
-
-
-
 static const char * const mysqlnd_debug_default_trace_file = 
"/tmp/mysqlnd.trace";

 #ifdef ZTS
@@ -1046,6 +992,7 @@
 }
 /* }}} */

+#if MYSQLND_DEBUG_MEMORY

 /* {{{ mysqlnd_zend_mm_emalloc */
 static void * mysqlnd_zend_mm_emalloc(size_t size MYSQLND_MEM_D)
@@ -1158,8 +1105,48 @@
 }
 /* }}} */

+#endif


+#define MYSQLND_DEBUG_MEMORY 1
+
+struct st_mysqlnd_allocator_methods mysqlnd_allocator =
+{
+#if MYSQLND_DEBUG_MEMORY
+   _mysqlnd_emalloc,
+   _mysqlnd_pemalloc,
+   _mysqlnd_ecalloc,
+   _mysqlnd_pecalloc,
+   _mysqlnd_erealloc,
+   _mysqlnd_perealloc,
+   _mysqlnd_efree,
+   _mysqlnd_pefree,
+   _mysqlnd_malloc,
+   _mysqlnd_calloc,
+   _mysqlnd_realloc,
+   _mysqlnd_free,
+   _mysqlnd_pestrndup,
+   _mysqlnd_pestrdup
+#else
+   mysqlnd_zend_mm_emalloc,
+   mysqlnd_zend_mm_pemalloc,
+   mysqlnd_zend_mm_ecalloc,
+   mysqlnd_zend_mm_pecalloc,
+   mysqlnd_zend_mm_erealloc,
+   mysqlnd_zend_mm_perealloc,
+   mysqlnd_zend_mm_efree,
+   mysqlnd_zend_mm_pefree,
+   mysqlnd_zend_mm_malloc,
+   mysqlnd_zend_mm_calloc,
+   mysqlnd_zend_mm_realloc,
+   mysqlnd_zend_mm_free,
+   mysqlnd_zend_mm_pestrndup,
+   mysqlnd_zend_mm_pestrdup
+#endif
+};
+
+
+
 /* Follows code borrowed from zend_builtin_functions.c because the functions 
there are static */

 #if PHP_MAJOR_VERSION >= 6

Modified: php/php-src/trunk/ext/mysqlnd/mysqlnd_debug.c
===
--- php/php-src/trunk/ext/mysqlnd/mysqlnd_debug.c   2010-05-03 13:45:58 UTC 
(rev 298901)
+++ php/php-src/trunk/ext/mysqlnd/mysqlnd_debug.c   2010-05-03 13:51:30 UTC 
(rev 298902)
@@ -28,60 +28,6 @@
 #include "mysqlnd_statistics.h"
 #include "zend_builtin_functions.h"

-static void * mysqlnd_zend_mm_emalloc(size_t size MYSQLND_MEM_D);
-static void * mysqlnd_zend_mm_pemalloc(size_t size, zend_bool persistent 
MYSQLND_MEM_D);
-static void * mysqlnd_zend_mm_ecalloc(unsigned int nmemb, size_t size 
MYSQLND_MEM_D);
-stati

[PHP-CVS] svn: /php/php-src/ branches/PHP_5_3/ext/mysqlnd/mysqlnd_block_alloc.c trunk/ext/mysqlnd/mysqlnd_block_alloc.c

2010-05-03 Thread Andrey Hristov
andrey   Mon, 03 May 2010 14:26:08 +

Revision: http://svn.php.net/viewvc?view=revision&revision=298904

Log:
One more case to handle in case of OOM, in block_alloc_resize_chunk

Changed paths:
U   php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_block_alloc.c
U   php/php-src/trunk/ext/mysqlnd/mysqlnd_block_alloc.c

Modified: php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_block_alloc.c
===
--- php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_block_alloc.c  
2010-05-03 14:16:04 UTC (rev 298903)
+++ php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_block_alloc.c  
2010-05-03 14:26:08 UTC (rev 298904)
@@ -99,7 +99,12 @@
}
}
} else {
-   chunk->ptr = mnd_realloc(chunk->ptr, size);
+   zend_uchar *new_ptr = mnd_realloc(chunk->ptr, size);
+   if (!new_ptr) {
+   DBG_RETURN(FAIL);
+   }
+   chunk->ptr = new_ptr;
+
}
DBG_RETURN(PASS);
 }

Modified: php/php-src/trunk/ext/mysqlnd/mysqlnd_block_alloc.c
===
--- php/php-src/trunk/ext/mysqlnd/mysqlnd_block_alloc.c 2010-05-03 14:16:04 UTC 
(rev 298903)
+++ php/php-src/trunk/ext/mysqlnd/mysqlnd_block_alloc.c 2010-05-03 14:26:08 UTC 
(rev 298904)
@@ -99,7 +99,12 @@
}
}
} else {
-   chunk->ptr = mnd_realloc(chunk->ptr, size);
+   zend_uchar *new_ptr = mnd_realloc(chunk->ptr, size);
+   if (!new_ptr) {
+   DBG_RETURN(FAIL);
+   }
+   chunk->ptr = new_ptr;
+
}
DBG_RETURN(PASS);
 }

-- 
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_result.c trunk/ext/mysqlnd/mysqlnd_result.c

2010-05-03 Thread Andrey Hristov
andrey   Mon, 03 May 2010 19:02:48 +

Revision: http://svn.php.net/viewvc?view=revision&revision=298922

Log:
Handle OOM in mysqlnd_fetch_row_unbuffered_c()

Changed paths:
U   php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_result.c
U   php/php-src/trunk/ext/mysqlnd/mysqlnd_result.c

Modified: php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_result.c
===
--- php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_result.c   2010-05-03 
18:53:10 UTC (rev 298921)
+++ php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_result.c   2010-05-03 
19:02:48 UTC (rev 298922)
@@ -646,27 +646,30 @@
  
result->conn->stats TSRMLS_CC);

retrow = mnd_malloc(result->field_count * sizeof(char 
*));
+   if (retrow) {
+   for (i = 0; i < field_count; i++, field++, 
zend_hash_key++) {
+   zval *data = 
result->unbuf->last_row_data[i];
+   unsigned int len;

-   for (i = 0; i < field_count; i++, field++, 
zend_hash_key++) {
-   zval *data = result->unbuf->last_row_data[i];
-   unsigned int len;
+   if (Z_TYPE_P(data) != IS_NULL) {
+   convert_to_string(data);
+   retrow[i] = Z_STRVAL_P(data);
+   len = Z_STRLEN_P(data);
+   } else {
+   retrow[i] = NULL;
+   len = 0;
+   }

-   if (Z_TYPE_P(data) != IS_NULL) {
-   convert_to_string(data);
-   retrow[i] = Z_STRVAL_P(data);
-   len = Z_STRLEN_P(data);
-   } else {
-   retrow[i] = NULL;
-   len = 0;
-   }
+   if (lengths) {
+   lengths[i] = len;
+   }

-   if (lengths) {
-   lengths[i] = len;
+   if (field->max_length < len) {
+   field->max_length = len;
+   }
}
-
-   if (field->max_length < len) {
-   field->max_length = len;
-   }
+   } else {
+   SET_OOM_ERROR(result->conn->error_info);
}
}
} else if (ret == FAIL) {

Modified: php/php-src/trunk/ext/mysqlnd/mysqlnd_result.c
===
--- php/php-src/trunk/ext/mysqlnd/mysqlnd_result.c  2010-05-03 18:53:10 UTC 
(rev 298921)
+++ php/php-src/trunk/ext/mysqlnd/mysqlnd_result.c  2010-05-03 19:02:48 UTC 
(rev 298922)
@@ -646,27 +646,30 @@
  
result->conn->stats TSRMLS_CC);

retrow = mnd_malloc(result->field_count * sizeof(char 
*));
+   if (retrow) {
+   for (i = 0; i < field_count; i++, field++, 
zend_hash_key++) {
+   zval *data = 
result->unbuf->last_row_data[i];
+   unsigned int len;

-   for (i = 0; i < field_count; i++, field++, 
zend_hash_key++) {
-   zval *data = result->unbuf->last_row_data[i];
-   unsigned int len;
+   if (Z_TYPE_P(data) != IS_NULL) {
+   convert_to_string(data);
+   retrow[i] = Z_STRVAL_P(data);
+   len = Z_STRLEN_P(data);
+   } else {
+   retrow[i] = NULL;
+   len = 0;
+   }

-   if (Z_TYPE_P(data) != IS_NULL) {
-   convert_to_string(data);
-   retrow[i] = Z_STRVAL_P(data);
-   len = Z_STRLEN_P(data);
-   } else {
-   

[PHP-CVS] svn: /php/php-src/ branches/PHP_5_3/ext/mysqlnd/mysqlnd_result.c trunk/ext/mysqlnd/mysqlnd_result.c

2010-05-03 Thread Andrey Hristov
andrey   Mon, 03 May 2010 19:09:45 +

Revision: http://svn.php.net/viewvc?view=revision&revision=298925

Log:
Handle OOM in mysqlnd_fetch_row_buffered_c()

Changed paths:
U   php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_result.c
U   php/php-src/trunk/ext/mysqlnd/mysqlnd_result.c

Modified: php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_result.c
===
--- php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_result.c   2010-05-03 
19:08:26 UTC (rev 298924)
+++ php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_result.c   2010-05-03 
19:09:45 UTC (rev 298925)
@@ -939,20 +939,23 @@
}
}

+   set->data_cursor += result->meta->field_count;
+   
MYSQLND_INC_GLOBAL_STATISTIC(STAT_ROWS_FETCHED_FROM_CLIENT_NORMAL_BUF);
+
ret = mnd_malloc(result->field_count * sizeof(char *));
+   if (ret) {
+   for (i = 0; i < result->field_count; i++, field++, 
zend_hash_key++) {
+   zval *data = current_row[i];

-   for (i = 0; i < result->field_count; i++, field++, 
zend_hash_key++) {
-   zval *data = current_row[i];
-
-   if (Z_TYPE_P(data) != IS_NULL) {
-   convert_to_string(data);
-   ret[i] = Z_STRVAL_P(data);
-   } else {
-   ret[i] = NULL;
+   if (Z_TYPE_P(data) != IS_NULL) {
+   convert_to_string(data);
+   ret[i] = Z_STRVAL_P(data);
+   } else {
+   ret[i] = NULL;
+   }
}
}
-   set->data_cursor += result->meta->field_count;
-   
MYSQLND_INC_GLOBAL_STATISTIC(STAT_ROWS_FETCHED_FROM_CLIENT_NORMAL_BUF);
+   /* there is no conn handle in this function thus we can't set 
OOM in error_info */
} else {
set->data_cursor = NULL;
DBG_INF("EOF reached");

Modified: php/php-src/trunk/ext/mysqlnd/mysqlnd_result.c
===
--- php/php-src/trunk/ext/mysqlnd/mysqlnd_result.c  2010-05-03 19:08:26 UTC 
(rev 298924)
+++ php/php-src/trunk/ext/mysqlnd/mysqlnd_result.c  2010-05-03 19:09:45 UTC 
(rev 298925)
@@ -939,20 +939,23 @@
}
}

+   set->data_cursor += result->meta->field_count;
+   
MYSQLND_INC_GLOBAL_STATISTIC(STAT_ROWS_FETCHED_FROM_CLIENT_NORMAL_BUF);
+
ret = mnd_malloc(result->field_count * sizeof(char *));
+   if (ret) {
+   for (i = 0; i < result->field_count; i++, field++, 
zend_hash_key++) {
+   zval *data = current_row[i];

-   for (i = 0; i < result->field_count; i++, field++, 
zend_hash_key++) {
-   zval *data = current_row[i];
-
-   if (Z_TYPE_P(data) != IS_NULL) {
-   convert_to_string(data);
-   ret[i] = Z_STRVAL_P(data);
-   } else {
-   ret[i] = NULL;
+   if (Z_TYPE_P(data) != IS_NULL) {
+   convert_to_string(data);
+   ret[i] = Z_STRVAL_P(data);
+   } else {
+   ret[i] = NULL;
+   }
}
}
-   set->data_cursor += result->meta->field_count;
-   
MYSQLND_INC_GLOBAL_STATISTIC(STAT_ROWS_FETCHED_FROM_CLIENT_NORMAL_BUF);
+   /* there is no conn handle in this function thus we can't set 
OOM in error_info */
} else {
set->data_cursor = NULL;
DBG_INF("EOF reached");

-- 
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_result.c trunk/ext/mysqlnd/mysqlnd_result.c

2010-05-03 Thread Andrey Hristov
andrey   Mon, 03 May 2010 19:32:07 +

Revision: http://svn.php.net/viewvc?view=revision&revision=298929

Log:
Handle OOM in mysqlnd_res::store_result_fetch_data

Changed paths:
U   php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_result.c
U   php/php-src/trunk/ext/mysqlnd/mysqlnd_result.c

Modified: php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_result.c
===
--- php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_result.c   2010-05-03 
19:31:50 UTC (rev 298928)
+++ php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_result.c   2010-05-03 
19:32:07 UTC (rev 298929)
@@ -1080,8 +1080,18 @@
conn->thread_id, binary_protocol, to_cache);

result->stored_data = set = mnd_pecalloc(1, 
sizeof(MYSQLND_RES_BUFFERED), to_cache);
+   if (!set) {
+   SET_OOM_ERROR(conn->error_info);
+   ret = FAIL;
+   goto end;
+   }
if (free_rows) {
set->row_buffers = mnd_pemalloc(free_rows * 
sizeof(MYSQLND_MEMORY_POOL_CHUNK *), to_cache);
+   if (!set->row_buffers) {
+   SET_OOM_ERROR(conn->error_info);
+   ret = FAIL;
+   goto end;
+   }
}
set->persistent = to_cache;
set->references = 1;
@@ -1091,6 +1101,11 @@

/* non-persistent */
row_packet = conn->protocol->m.get_row_packet(conn->protocol, FALSE 
TSRMLS_CC);
+   if (!row_packet) {
+   SET_OOM_ERROR(conn->error_info);
+   ret = FAIL;
+   goto end;
+   }
row_packet->result_set_memory_pool = result->result_set_memory_pool;
row_packet->field_count = meta->field_count;
row_packet->binary_protocol = binary_protocol;
@@ -1103,10 +1118,17 @@
while (FAIL != (ret = PACKET_READ(row_packet, conn)) && 
!row_packet->eof) {
if (!free_rows) {
uint64_t total_allocated_rows = free_rows = next_extend 
= next_extend * 11 / 10; /* extend with 10% */
+   MYSQLND_MEMORY_POOL_CHUNK ** new_row_buffers;
total_allocated_rows += set->row_count;
-   set->row_buffers = mnd_perealloc(set->row_buffers,
-   
 total_allocated_rows * sizeof(MYSQLND_MEMORY_POOL_CHUNK *),
-   
 set->persistent);
+   new_row_buffers = mnd_perealloc(set->row_buffers,
+   
total_allocated_rows * sizeof(MYSQLND_MEMORY_POOL_CHUNK *),
+   
set->persistent);
+   if (!new_row_buffers) {
+   SET_OOM_ERROR(conn->error_info);
+   ret = FAIL;
+   goto end;
+   }
+   set->row_buffers = new_row_buffers;
}
free_rows--;
set->row_buffers[set->row_count] = row_packet->row_buffer;
@@ -1128,6 +1150,11 @@
if (set->row_count) {
/* if pecalloc is used valgrind barks gcc version 4.3.1 
20080507 (prerelease) [gcc-4_3-branch revision 135036] (SUSE Linux) */
set->data = mnd_pemalloc(set->row_count * meta->field_count * 
sizeof(zval *), to_cache);
+   if (!set->data) {
+   SET_OOM_ERROR(conn->error_info);
+   ret = FAIL;
+   goto end;
+   }
memset(set->data, 0, set->row_count * meta->field_count * 
sizeof(zval *));
}

@@ -1163,6 +1190,7 @@
/* libmysql's documentation says it should be so for SELECT 
statements */
conn->upsert_status.affected_rows = set->row_count;
}
+end:
PACKET_FREE(row_packet);

DBG_INF_FMT("ret=%s row_count=%u warnings=%u server_status=%u", ret == 
PASS? "PASS":"FAIL",

Modified: php/php-src/trunk/ext/mysqlnd/mysqlnd_result.c
===
--- php/php-src/trunk/ext/mysqlnd/mysqlnd_result.c  2010-05-03 19:31:50 UTC 
(rev 298928)
+++ php/php-src/trunk/ext/mysqlnd/mysqlnd_result.c  2010-05-03 19:32:07 UTC 
(rev 298929)
@@ -1080,8 +1080,18 @@
conn->thread_id, binary_protocol, to_cache);

result->stored_data = set = mnd_pecalloc(1, 
sizeof(MYSQLND_RES_BUFFERED), to_cache);
+   if (!set) {
+   SET_OOM_ERROR(conn->error_info);
+   ret = FAIL;
+   goto end;
+   }
if (free_rows) {
set->row_buffers = mnd_pemalloc(free_rows * 
sizeof

[PHP-CVS] svn: /php/php-src/ branches/PHP_5_3/ext/mysqlnd/mysqlnd_debug.c trunk/ext/mysqlnd/mysqlnd_debug.c

2010-05-21 Thread Andrey Hristov
andrey   Fri, 21 May 2010 13:06:52 +

Revision: http://svn.php.net/viewvc?view=revision&revision=299578

Log:
When OOM hits the wire, don't crash.

Changed paths:
U   php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_debug.c
U   php/php-src/trunk/ext/mysqlnd/mysqlnd_debug.c

Modified: php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_debug.c
===
--- php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_debug.c2010-05-21 
12:16:07 UTC (rev 299577)
+++ php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_debug.c2010-05-21 
13:06:52 UTC (rev 299578)
@@ -1,4 +1,4 @@
-;/*
+/*
   +--+
   | PHP Version 5|
   +--+
@@ -679,7 +679,7 @@

DBG_INF_FMT("size=%lu ptr=%p", size, ret);

-   if (collect_memory_statistics) {
+   if (ret && collect_memory_statistics) {
*(size_t *) ret = size;
MYSQLND_INC_GLOBAL_STATISTIC_W_VALUE2(STAT_MEM_EMALLOC_COUNT, 
1, STAT_MEM_EMALLOC_AMOUNT, size);
}
@@ -711,7 +711,7 @@

DBG_INF_FMT("size=%lu ptr=%p persistent=%d", size, ret, persistent);

-   if (collect_memory_statistics) {
+   if (ret && collect_memory_statistics) {
enum mysqlnd_collected_stats s1 = persistent? 
STAT_MEM_MALLOC_COUNT:STAT_MEM_EMALLOC_COUNT;
enum mysqlnd_collected_stats s2 = persistent? 
STAT_MEM_MALLOC_AMOUNT:STAT_MEM_EMALLOC_AMOUNT;
*(size_t *) ret = size;
@@ -747,7 +747,7 @@

DBG_INF_FMT("after : %lu", zend_memory_usage(FALSE TSRMLS_CC));
DBG_INF_FMT("size=%lu ptr=%p", size, ret);
-   if (collect_memory_statistics) {
+   if (ret && collect_memory_statistics) {
*(size_t *) ret = size;
MYSQLND_INC_GLOBAL_STATISTIC_W_VALUE2(STAT_MEM_ECALLOC_COUNT, 
1, STAT_MEM_ECALLOC_AMOUNT, size);
}
@@ -779,7 +779,7 @@

DBG_INF_FMT("size=%lu ptr=%p", size, ret);

-   if (collect_memory_statistics) {
+   if (ret && collect_memory_statistics) {
enum mysqlnd_collected_stats s1 = persistent? 
STAT_MEM_CALLOC_COUNT:STAT_MEM_ECALLOC_COUNT;
enum mysqlnd_collected_stats s2 = persistent? 
STAT_MEM_CALLOC_AMOUNT:STAT_MEM_ECALLOC_AMOUNT;
*(size_t *) ret = size;
@@ -815,7 +815,7 @@
 #endif

DBG_INF_FMT("new_ptr=%p", (char*)ret);
-   if (collect_memory_statistics) {
+   if (ret && collect_memory_statistics) {
*(size_t *) ret = new_size;
MYSQLND_INC_GLOBAL_STATISTIC_W_VALUE2(STAT_MEM_EREALLOC_COUNT, 
1, STAT_MEM_EREALLOC_AMOUNT, new_size);
}
@@ -849,7 +849,7 @@

DBG_INF_FMT("new_ptr=%p", (char*)ret);

-   if (collect_memory_statistics) {
+   if (ret && collect_memory_statistics) {
enum mysqlnd_collected_stats s1 = persistent? 
STAT_MEM_REALLOC_COUNT:STAT_MEM_EREALLOC_COUNT;
enum mysqlnd_collected_stats s2 = persistent? 
STAT_MEM_REALLOC_AMOUNT:STAT_MEM_EREALLOC_AMOUNT;
*(size_t *) ret = new_size;

Modified: php/php-src/trunk/ext/mysqlnd/mysqlnd_debug.c
===
--- php/php-src/trunk/ext/mysqlnd/mysqlnd_debug.c   2010-05-21 12:16:07 UTC 
(rev 299577)
+++ php/php-src/trunk/ext/mysqlnd/mysqlnd_debug.c   2010-05-21 13:06:52 UTC 
(rev 299578)
@@ -1,4 +1,4 @@
-;/*
+/*
   +--+
   | PHP Version 5|
   +--+
@@ -679,7 +679,7 @@

DBG_INF_FMT("size=%lu ptr=%p", size, ret);

-   if (collect_memory_statistics) {
+   if (ret && collect_memory_statistics) {
*(size_t *) ret = size;
MYSQLND_INC_GLOBAL_STATISTIC_W_VALUE2(STAT_MEM_EMALLOC_COUNT, 
1, STAT_MEM_EMALLOC_AMOUNT, size);
}
@@ -711,7 +711,7 @@

DBG_INF_FMT("size=%lu ptr=%p persistent=%d", size, ret, persistent);

-   if (collect_memory_statistics) {
+   if (ret && collect_memory_statistics) {
enum mysqlnd_collected_stats s1 = persistent? 
STAT_MEM_MALLOC_COUNT:STAT_MEM_EMALLOC_COUNT;
enum mysqlnd_collected_stats s2 = persistent? 
STAT_MEM_MALLOC_AMOUNT:STAT_MEM_EMALLOC_AMOUNT;
*(size_t *) ret = size;
@@ -747,7 +747,7 @@

DBG_INF_FMT("after : %lu", zend_memory_usage(FALSE TSRMLS_CC));
DBG_INF_FMT("size=%lu ptr=%p", size, ret);
-   if (collect_memory_statistics) {
+   if (ret && collect_memory_statistics) {
*(size_t *) ret = size;
MYSQLND_INC_GLOBAL_STATISTIC_W_VALUE2(STAT_MEM_ECALLOC_COUNT, 
1, STAT_MEM_ECALLOC_AMOUNT, size);
   

  1   2   3   >