[PHP-CVS] svn: /php/php-src/trunk/ Zend/zend_API.c Zend/zend_compile.c Zend/zend_constants.c Zend/zend_extensions.h Zend/zend_globals.h Zend/zend_modules.h Zend/zend_string.c Zend/zend_string.h main/m

2010-05-25 Thread Dmitry Stogov
 = zend_new_interned_string(class_type-u.constant.value.str.val, class_type-u.constant.value.str.len + 1, 1 TSRMLS_CC);
 			cur_arg_info-class_name = class_type-u.constant.value.str.val;
 			cur_arg_info-class_name_len = class_type-u.constant.value.str.len;
 			if (op == ZEND_RECV_INIT) {
@@ -4766,7 +4766,7 @@
 		CG(doc_comment_len) = 0;
 	}

-	zend_declare_property_ex(CG(active_class_entry), CG(new_interned_string)(var_name-u.constant.value.str.val, var_name-u.constant.value.str.len + 1, 0 TSRMLS_CC), var_name-u.constant.value.str.len, property, access_type, comment, comment_len TSRMLS_CC);
+	zend_declare_property_ex(CG(active_class_entry), zend_new_interned_string(var_name-u.constant.value.str.val, var_name-u.constant.value.str.len + 1, 0 TSRMLS_CC), var_name-u.constant.value.str.len, property, access_type, comment, comment_len TSRMLS_CC);
 	efree(var_name-u.constant.value.str.val);
 }
 /* }}} */
@@ -4787,7 +4787,7 @@
 	ALLOC_ZVAL(property);
 	*property = value-u.constant;

-	if (zend_hash_add(CG(active_class_entry)-constants_table, CG(new_interned_string)(var_name-u.constant.value.str.val, var_name-u.constant.value.str.len+1, 0 TSRMLS_CC), var_name-u.constant.value.str.len+1, property, sizeof(zval *), NULL)==FAILURE) {
+	if (zend_hash_add(CG(active_class_entry)-constants_table, zend_new_interned_string(var_name-u.constant.value.str.val, var_name-u.constant.value.str.len+1, 0 TSRMLS_CC), var_name-u.constant.value.str.len+1, property, sizeof(zval *), NULL)==FAILURE) {
 		FREE_ZVAL(property);
 		zend_error(E_COMPILE_ERROR, Cannot redefine class constant %s::%s, CG(active_class_entry)-name, var_name-u.constant.value.str.val);
 	}

Modified: php/php-src/trunk/Zend/zend_constants.c
===
--- php/php-src/trunk/Zend/zend_constants.c	2010-05-25 07:27:14 UTC (rev 299732)
+++ php/php-src/trunk/Zend/zend_constants.c	2010-05-25 09:00:20 UTC (rev 299733)
@@ -459,14 +459,14 @@
 		/* keep in mind that c-name_len already contains the '\0' */
 		lowercase_name = estrndup(c-name, c-name_len-1);
 		zend_str_tolower(lowercase_name, c-name_len-1);
-		lowercase_name = CG(new_interned_string)(lowercase_name, c-name_len, 1 TSRMLS_CC);
+		lowercase_name = zend_new_interned_string(lowercase_name, c-name_len, 1 TSRMLS_CC);
 		name = lowercase_name;
 	} else {
 		char *slash = strrchr(c-name, '\\');
 		if(slash) {
 			lowercase_name = estrndup(c-name, c-name_len-1);
 			zend_str_tolower(lowercase_name, slash-c-name);
-			lowercase_name = CG(new_interned_string)(lowercase_name, c-name_len, 1 TSRMLS_CC);
+			lowercase_name = zend_new_interned_string(lowercase_name, c-name_len, 1 TSRMLS_CC);
 			name = lowercase_name;
 		} else {
 			name = c-name;

Modified: php/php-src/trunk/Zend/zend_extensions.h
===
--- php/php-src/trunk/Zend/zend_extensions.h	2010-05-25 07:27:14 UTC (rev 299732)
+++ php/php-src/trunk/Zend/zend_extensions.h	2010-05-25 09:00:20 UTC (rev 299733)
@@ -28,7 +28,7 @@
 /* The first number is the engine version and the rest is the date.
  * This way engine 2/3 API no. is always greater than engine 1 API no..
  */
-#define ZEND_EXTENSION_API_NO	220100409
+#define ZEND_EXTENSION_API_NO	220100525

 typedef struct _zend_extension_version_info {
 	int zend_extension_api_no;

Modified: php/php-src/trunk/Zend/zend_globals.h
===
--- php/php-src/trunk/Zend/zend_globals.h	2010-05-25 07:27:14 UTC (rev 299732)
+++ php/php-src/trunk/Zend/zend_globals.h	2010-05-25 09:00:20 UTC (rev 299733)
@@ -147,10 +147,6 @@

 	HashTable interned_strings;

-	char *(*new_interned_string)(char *str, int len, int free_src TSRMLS_DC);
-	void (*interned_strings_snapshot)(TSRMLS_D);
-	void (*interned_strings_restore)(TSRMLS_D);
-
 #ifdef ZEND_MULTIBYTE
 	zend_encoding **script_encoding_list;
 	size_t script_encoding_list_size;

Modified: php/php-src/trunk/Zend/zend_modules.h
===
--- php/php-src/trunk/Zend/zend_modules.h	2010-05-25 07:27:14 UTC (rev 299732)
+++ php/php-src/trunk/Zend/zend_modules.h	2010-05-25 09:00:20 UTC (rev 299733)
@@ -33,7 +33,7 @@
 #define ZEND_MODULE_INFO_FUNC_ARGS zend_module_entry *zend_module TSRMLS_DC
 #define ZEND_MODULE_INFO_FUNC_ARGS_PASSTHRU zend_module TSRMLS_CC

-#define ZEND_MODULE_API_NO 20100409
+#define ZEND_MODULE_API_NO 20100525
 #ifdef ZTS
 #define USING_ZTS 1
 #else

Modified: php/php-src/trunk/Zend/zend_string.c
===
--- php/php-src/trunk/Zend/zend_string.c	2010-05-25 07:27:14 UTC (rev 299732)
+++ php/php-src/trunk/Zend/zend_string.c	2010-05-25 09:00:20 UTC (rev 299733)
@@ -29,10 +29,14 @@
 # include sys/mman.h
 #endif

-static char *zend_new_interned_string(char *str, int len, int free_src TSRMLS_DC);
-static void zend_interned_strings_snapshot(TSRMLS_D);
-static void zend_interned_strings_restore

[PHP-CVS] svn: /php/php-src/trunk/ext/tidy/ tidy.c

2010-05-25 Thread Dmitry Stogov
dmitry   Tue, 25 May 2010 11:38:48 +

Revision: http://svn.php.net/viewvc?view=revisionrevision=299737

Log:
Fixed compatibility with Run Time Cache patch

Changed paths:
U   php/php-src/trunk/ext/tidy/tidy.c

Modified: php/php-src/trunk/ext/tidy/tidy.c
===
--- php/php-src/trunk/ext/tidy/tidy.c   2010-05-25 10:37:17 UTC (rev 299736)
+++ php/php-src/trunk/ext/tidy/tidy.c   2010-05-25 11:38:48 UTC (rev 299737)
@@ -828,6 +828,9 @@
tidySaveBuffer (obj-ptdoc-doc, output);

if (output.size) {
+   if (!obj-std.properties) {
+   rebuild_object_properties(obj-std);
+   }
MAKE_STD_ZVAL(temp);
ZVAL_STRINGL(temp, (char*)output.bp, output.size-1, TRUE);
zend_hash_update(obj-std.properties, value, sizeof(value), 
(void *)temp, sizeof(zval *), NULL);
@@ -836,6 +839,9 @@
tidyBufFree(output);

if (obj-ptdoc-errbuf-size) {
+   if (!obj-std.properties) {
+   rebuild_object_properties(obj-std);
+   }
MAKE_STD_ZVAL(temp);
ZVAL_STRINGL(temp, (char*)obj-ptdoc-errbuf-bp, 
obj-ptdoc-errbuf-size-1, TRUE);
zend_hash_update(obj-std.properties, errorBuffer, 
sizeof(errorBuffer), (void *)temp, sizeof(zval *), NULL);
@@ -854,6 +860,9 @@
switch(type) {

case is_node:
+   if (!obj-std.properties) {
+   rebuild_object_properties(obj-std);
+   }
tidyBufInit(buf);
tidyNodeGetText(obj-ptdoc-doc, obj-node, buf);
ADD_PROPERTY_STRINGL(obj-std.properties, value, 
buf.bp, buf.size-1);
@@ -923,6 +932,9 @@
break;

case is_doc:
+   if (!obj-std.properties) {
+   rebuild_object_properties(obj-std);
+   }
ADD_PROPERTY_NULL(obj-std.properties, errorBuffer);
ADD_PROPERTY_NULL(obj-std.properties, value);
break;

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

[PHP-CVS] svn: /SVNROOT/ global_avail

2010-05-25 Thread Derick Rethans
derick   Tue, 25 May 2010 16:28:35 +

Revision: http://svn.php.net/viewvc?view=revisionrevision=299744

Log:
- Give Mark GTK access by request of Elizabeth

Changed paths:
U   SVNROOT/global_avail

Modified: SVNROOT/global_avail
===
--- SVNROOT/global_avail2010-05-25 16:00:45 UTC (rev 299743)
+++ SVNROOT/global_avail2010-05-25 16:28:35 UTC (rev 299744)
@@ -285,7 +285,7 @@
 avail|graham,myang|pecl/optimizer
 avail|joonas|pecl/llvm
 avail|indeyets|pecl/spread,pecl/xslcache
-avail|markskilbeck,akshat|pecl/cairo,phpdoc
+avail|markskilbeck,akshat|pecl/cairo,phpdoc,gtk/php-gtk,gtk/php-gtk-doc
 avail|mgdm|pecl/cairo,pecl/rsvg
 avail|txforward|pecl/txforward
 avail|smantoor|php/php-src/*/ext/standard,php/php-src/*/ext/date

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

2010-05-25 Thread Andrey Hristov
andrey   Tue, 25 May 2010 18:14:37 +

Revision: http://svn.php.net/viewvc?view=revisionrevision=299750

Log:
Fix metadata duplicatin which wasn't crash-safe in case of OOM.

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

Modified: php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_result_meta.c
===
--- php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_result_meta.c  
2010-05-25 17:52:35 UTC (rev 299749)
+++ php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_result_meta.c  
2010-05-25 18:14:37 UTC (rev 299750)
@@ -309,18 +309,31 @@
 {
unsigned int i;
/* +1 is to have empty marker at the end */
-   MYSQLND_RES_METADATA *new_meta = 
mnd_pemalloc(sizeof(MYSQLND_RES_METADATA), persistent);
-   MYSQLND_FIELD *new_fields = mnd_pecalloc(meta-field_count + 1, 
sizeof(MYSQLND_FIELD), persistent);
-   MYSQLND_FIELD *orig_fields = meta-fields;
+   MYSQLND_RES_METADATA * new_meta = NULL;
+   MYSQLND_FIELD * new_fields;
+   MYSQLND_FIELD * orig_fields = meta-fields;
size_t len = meta-field_count * sizeof(struct mysqlnd_field_hash_key);

DBG_ENTER(mysqlnd_res_meta::clone_metadata);
DBG_INF_FMT(persistent=%d, persistent);

+   new_meta = mnd_pecalloc(1, sizeof(MYSQLND_RES_METADATA), persistent);
+   if (!new_meta) {
+   goto oom;
+   }
new_meta-persistent = persistent;
+   new_meta-m = meta-m;
+
+   new_fields = mnd_pecalloc(meta-field_count + 1, sizeof(MYSQLND_FIELD), 
persistent);
+   if (!new_fields) {
+   goto oom;
+   }
+
new_meta-zend_hash_keys = mnd_pemalloc(len, persistent);
+   if (!new_meta-zend_hash_keys) {
+   goto oom;
+   }
memcpy(new_meta-zend_hash_keys, meta-zend_hash_keys, len);
-   new_meta-m = meta-m;

/*
  This will copy also the strings and the root, which we will have
@@ -330,6 +343,9 @@
for (i = 0; i  meta-field_count; i++) {
/* First copy the root, then field by field adjust the pointers 
*/
new_fields[i].root = mnd_pemalloc(orig_fields[i].root_len, 
persistent);
+   if (!new_fields[i].root) {
+   goto oom;
+   }
memcpy(new_fields[i].root, orig_fields[i].root, 
new_fields[i].root_len);

if (orig_fields[i].name  orig_fields[i].name != 
mysqlnd_empty_string) {
@@ -357,6 +373,9 @@
/* def is not on the root, if allocated at all */
if (orig_fields[i].def) {
new_fields[i].def = 
mnd_pemalloc(orig_fields[i].def_length + 1, persistent);
+   if (!new_fields[i].def) {
+   goto oom;
+   }
/* copy the trailing \0 too */
memcpy(new_fields[i].def, orig_fields[i].def, 
orig_fields[i].def_length + 1);
}
@@ -364,6 +383,9 @@
if (new_meta-zend_hash_keys[i].ustr.u) {
new_meta-zend_hash_keys[i].ustr.u =

eustrndup(new_meta-zend_hash_keys[i].ustr.u, new_meta-zend_hash_keys[i].ulen);
+   if (!new_meta-zend_hash_keys[i].ustr.u) {
+   goto oom;
+   }
}
 #endif
}
@@ -373,6 +395,12 @@
new_meta-fields = new_fields;

DBG_RETURN(new_meta);
+oom:
+   if (new_meta) {
+   new_meta-m-free_metadata(new_meta TSRMLS_CC);
+   new_meta = NULL;
+   }
+   DBG_RETURN(NULL);
 }
 /* }}} */


Modified: php/php-src/trunk/ext/mysqlnd/mysqlnd_result_meta.c
===
--- php/php-src/trunk/ext/mysqlnd/mysqlnd_result_meta.c 2010-05-25 17:52:35 UTC 
(rev 299749)
+++ php/php-src/trunk/ext/mysqlnd/mysqlnd_result_meta.c 2010-05-25 18:14:37 UTC 
(rev 299750)
@@ -309,18 +309,31 @@
 {
unsigned int i;
/* +1 is to have empty marker at the end */
-   MYSQLND_RES_METADATA *new_meta = 
mnd_pemalloc(sizeof(MYSQLND_RES_METADATA), persistent);
-   MYSQLND_FIELD *new_fields = mnd_pecalloc(meta-field_count + 1, 
sizeof(MYSQLND_FIELD), persistent);
-   MYSQLND_FIELD *orig_fields = meta-fields;
+   MYSQLND_RES_METADATA * new_meta = NULL;
+   MYSQLND_FIELD * new_fields;
+   MYSQLND_FIELD * orig_fields = meta-fields;
size_t len = meta-field_count * sizeof(struct mysqlnd_field_hash_key);

DBG_ENTER(mysqlnd_res_meta::clone_metadata);
DBG_INF_FMT(persistent=%d, persistent);

+   new_meta = mnd_pecalloc(1, sizeof(MYSQLND_RES_METADATA), persistent);
+   if (!new_meta) {
+   goto oom;
+   }
new_meta-persistent = persistent;
+ 

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

2010-05-25 Thread Andrey Hristov
andrey   Tue, 25 May 2010 19:19:29 +

Revision: http://svn.php.net/viewvc?view=revisionrevision=299752

Log:
Handle OOM in the code that generates PS Execute requests
to the server. Fixes crashes in case of OOM.

Changed paths:
U   php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_ps.c
U   php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_ps_codec.c
U   php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_result.c
U   php/php-src/trunk/ext/mysqlnd/mysqlnd_ps.c
U   php/php-src/trunk/ext/mysqlnd/mysqlnd_ps_codec.c
U   php/php-src/trunk/ext/mysqlnd/mysqlnd_result.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-05-25 18:58:30 UTC (rev 299751)
+++ php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_ps.c	2010-05-25 19:19:29 UTC (rev 299752)
@@ -39,8 +39,7 @@
 static struct st_mysqlnd_stmt_methods *mysqlnd_stmt_methods;

 /* Exported by mysqlnd_ps_codec.c */
-zend_uchar* mysqlnd_stmt_execute_generate_request(MYSQLND_STMT *stmt, size_t *request_len,
-  zend_bool *free_buffer TSRMLS_DC);
+enum_func_status mysqlnd_stmt_execute_generate_request(MYSQLND_STMT * s, zend_uchar ** request, size_t *request_len, zend_bool * free_buffer TSRMLS_DC);


 MYSQLND_RES * _mysqlnd_stmt_use_result(MYSQLND_STMT *stmt TSRMLS_DC);
@@ -523,8 +522,8 @@
 {
 	MYSQLND_STMT_DATA * stmt = s-data;
 	enum_func_status ret;
-	MYSQLND		*conn = stmt-conn;
-	zend_uchar	*request;
+	MYSQLND *	conn = stmt-conn;
+	zend_uchar *request = NULL;
 	size_t		request_len;
 	zend_bool	free_request;

@@ -628,14 +627,16 @@
 			DBG_RETURN(FAIL);
 		}
 	}
-	request = mysqlnd_stmt_execute_generate_request(s, request_len, free_request TSRMLS_CC);
-
-	/* support for buffer types should be added here ! */
+	ret = mysqlnd_stmt_execute_generate_request(s, request, request_len, free_request TSRMLS_CC);
+	if (ret == PASS) {
+		/* support for buffer types should be added here ! */
+		ret = stmt-conn-m-simple_command(stmt-conn, COM_STMT_EXECUTE, (char *)request, request_len,
+			PROT_LAST /* we will handle the response packet*/,
+			FALSE, FALSE TSRMLS_CC);
+	} else {
+		SET_STMT_ERROR(stmt, CR_UNKNOWN_ERROR, UNKNOWN_SQLSTATE, Couldn't generate the request. Possibly OOM.);
+	}

-	ret = stmt-conn-m-simple_command(stmt-conn, COM_STMT_EXECUTE, (char *)request, request_len,
-		PROT_LAST /* we will handle the response packet*/,
-		FALSE, FALSE TSRMLS_CC);
-
 	if (free_request) {
 		mnd_efree(request);
 	}

Modified: php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_ps_codec.c
===
--- php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_ps_codec.c	2010-05-25 18:58:30 UTC (rev 299751)
+++ php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_ps_codec.c	2010-05-25 19:19:29 UTC (rev 299752)
@@ -578,22 +578,26 @@


 /* {{{ mysqlnd_stmt_copy_it */
-static void
+static enum_func_status
 mysqlnd_stmt_copy_it(zval *** copies, zval *original, unsigned int param_count, unsigned int current TSRMLS_DC)
 {
 	if (!*copies) {
 		*copies = mnd_ecalloc(param_count, sizeof(zval *));
 	}
-	MAKE_STD_ZVAL((*copies)[current]);
-	*(*copies)[current] = *original;
-	Z_SET_REFCOUNT_P((*copies)[current], 1);
-	zval_copy_ctor((*copies)[current]);
+	if (*copies) {
+		MAKE_STD_ZVAL((*copies)[current]);
+		*(*copies)[current] = *original;
+		Z_SET_REFCOUNT_P((*copies)[current], 1);
+		zval_copy_ctor((*copies)[current]);
+		return PASS;
+	}
+	return FAIL;
 }
 /* }}} */


 /* {{{ mysqlnd_stmt_execute_store_params */
-static void
+static enum_func_status
 mysqlnd_stmt_execute_store_params(MYSQLND_STMT * s, zend_uchar **buf, zend_uchar **p,
   size_t *buf_len, unsigned int null_byte_offset TSRMLS_DC)
 {
@@ -603,7 +607,10 @@
 	size_t left = (*buf_len - (*p - *buf));
 	size_t data_size = 0;
 	zval **copies = NULL;/* if there are different types */
+	enum_func_status ret = FAIL;

+	DBG_ENTER(mysqlnd_stmt_execute_store_params);
+
 /* 1. Store type information */
 	if (stmt-send_types_to_server) {

@@ -613,6 +620,10 @@
 			zend_uchar *tmp_buf;
 			*buf_len = offset + stmt-param_count * 2 + 20;
 			tmp_buf = mnd_emalloc(*buf_len);
+			if (!tmp_buf) {
+SET_STMT_ERROR(stmt, CR_UNKNOWN_ERROR, UNKNOWN_SQLSTATE, OOM);
+goto end;
+			}
 			memcpy(tmp_buf, *buf, offset);
 			*buf = tmp_buf;

@@ -643,7 +654,10 @@
 		for (j = i + 1; j  stmt-param_count; j++) {
 			if (stmt-param_bind[j].zv == the_var) {
 /* Double binding of the same zval, make a copy */
-mysqlnd_stmt_copy_it(copies, the_var, stmt-param_count, i TSRMLS_CC);
+if (PASS != mysqlnd_stmt_copy_it(copies, the_var, stmt-param_count, i TSRMLS_CC)) {
+	SET_STMT_ERROR(stmt, CR_UNKNOWN_ERROR, UNKNOWN_SQLSTATE, OOM);
+	goto end;
+}
 break;
 			}
 		}
@@ -653,7 +667,10 @@
 data_size += 8;
 if (Z_TYPE_P(the_var) != IS_DOUBLE) {
 	

[PHP-CVS] svn: /php/php-src/trunk/main/ fopen_wrappers.h

2010-05-25 Thread Antony Dovgal
tony2001 Tue, 25 May 2010 19:19:45 +

Revision: http://svn.php.net/viewvc?view=revisionrevision=299753

Log:
use correct condition in the if

Changed paths:
U   php/php-src/trunk/main/fopen_wrappers.h

Modified: php/php-src/trunk/main/fopen_wrappers.h
===
--- php/php-src/trunk/main/fopen_wrappers.h 2010-05-25 19:19:29 UTC (rev 
299752)
+++ php/php-src/trunk/main/fopen_wrappers.h 2010-05-25 19:19:45 UTC (rev 
299753)
@@ -34,7 +34,7 @@
 PHPAPI int php_check_specific_open_basedir(const char *basedir, const char 
*path TSRMLS_DC);

 /* {{{ OPENBASEDIR_CHECKPATH(filename) to ease merge between 6.x and 5.x */
-#if (PHP_MAJOR_VERSION  6)
+#if PHP_API_VERSION  20100412
 # define OPENBASEDIR_CHECKPATH(filename) \
(PG(safe_mode)  (!php_checkuid(filename, NULL, 
CHECKUID_CHECK_FILE_AND_DIR))) || php_check_open_basedir(filename TSRMLS_CC)
 #else

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

[PHP-CVS] svn: /php/php-src/trunk/Zend/ zend_API.c

2010-05-25 Thread Antony Dovgal
tony2001 Tue, 25 May 2010 20:16:14 +

Revision: http://svn.php.net/viewvc?view=revisionrevision=299754

Log:
fix zend_std_get_static_property() in ZTS mode

Changed paths:
U   php/php-src/trunk/Zend/zend_API.c

Modified: php/php-src/trunk/Zend/zend_API.c
===
--- php/php-src/trunk/Zend/zend_API.c   2010-05-25 19:19:45 UTC (rev 299753)
+++ php/php-src/trunk/Zend/zend_API.c   2010-05-25 20:16:14 UTC (rev 299754)
@@ -1043,7 +1043,11 @@
) {
Z_ADDREF_PP(p);
Z_SET_ISREF_PP(p);
+#if ZTS
+   
CG(static_members_table)[(zend_intptr_t)(class_type-static_members_table)][i] 
= *p;
+#else
class_type-static_members_table[i] = 
*p;
+#endif
} else {
zval *r;

@@ -1051,7 +1055,11 @@
*r = **p;
INIT_PZVAL(r);
zval_copy_ctor(r);
+#if ZTS
+   
CG(static_members_table)[(zend_intptr_t)(class_type-static_members_table)][i] 
= r;
+#else
class_type-static_members_table[i] = r;
+#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.c branches/PHP_5_3/ext/mysqlnd/mysqlnd_debug.h trunk/ext/mysqlnd/mysqlnd_debug.c trunk/ext/mysqlnd/mysqlnd_debug.h

2010-05-25 Thread Andrey Hristov
andrey   Tue, 25 May 2010 21:54:21 +

Revision: http://svn.php.net/viewvc?view=revisionrevision=299755

Log:
Fix shared build

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

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-25 
20:16:14 UTC (rev 299754)
+++ php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_debug.c2010-05-25 
21:54:21 UTC (rev 299755)
@@ -1210,7 +1210,7 @@

 #define MYSQLND_DEBUG_MEMORY 1

-struct st_mysqlnd_allocator_methods mysqlnd_allocator =
+PHPAPI struct st_mysqlnd_allocator_methods mysqlnd_allocator =
 {
 #if MYSQLND_DEBUG_MEMORY
_mysqlnd_emalloc,

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-05-25 
20:16:14 UTC (rev 299754)
+++ php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_debug.h2010-05-25 
21:54:21 UTC (rev 299755)
@@ -131,7 +131,7 @@
char *  (*m_pestrdup)(const char * const ptr, zend_bool persistent 
MYSQLND_MEM_D);
 };

-extern struct st_mysqlnd_allocator_methods mysqlnd_allocator;
+PHPAPI extern struct st_mysqlnd_allocator_methods mysqlnd_allocator;


 PHPAPI void *  _mysqlnd_emalloc(size_t size MYSQLND_MEM_D);

Modified: php/php-src/trunk/ext/mysqlnd/mysqlnd_debug.c
===
--- php/php-src/trunk/ext/mysqlnd/mysqlnd_debug.c   2010-05-25 20:16:14 UTC 
(rev 299754)
+++ php/php-src/trunk/ext/mysqlnd/mysqlnd_debug.c   2010-05-25 21:54:21 UTC 
(rev 299755)
@@ -1210,7 +1210,7 @@

 #define MYSQLND_DEBUG_MEMORY 1

-struct st_mysqlnd_allocator_methods mysqlnd_allocator =
+PHPAPI struct st_mysqlnd_allocator_methods mysqlnd_allocator =
 {
 #if MYSQLND_DEBUG_MEMORY
_mysqlnd_emalloc,

Modified: php/php-src/trunk/ext/mysqlnd/mysqlnd_debug.h
===
--- php/php-src/trunk/ext/mysqlnd/mysqlnd_debug.h   2010-05-25 20:16:14 UTC 
(rev 299754)
+++ php/php-src/trunk/ext/mysqlnd/mysqlnd_debug.h   2010-05-25 21:54:21 UTC 
(rev 299755)
@@ -131,7 +131,7 @@
char *  (*m_pestrdup)(const char * const ptr, zend_bool persistent 
MYSQLND_MEM_D);
 };

-extern struct st_mysqlnd_allocator_methods mysqlnd_allocator;
+PHPAPI extern struct st_mysqlnd_allocator_methods mysqlnd_allocator;


 PHPAPI void *  _mysqlnd_emalloc(size_t size MYSQLND_MEM_D);

-- 
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-05-25 Thread Andrey Hristov
andrey   Tue, 25 May 2010 22:34:47 +

Revision: http://svn.php.net/viewvc?view=revisionrevision=299758

Log:
Access memory which was really allocated

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-05-25 22:30:05 UTC (rev 299757)
+++ php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_wireprotocol.c	2010-05-25 22:34:47 UTC (rev 299758)
@@ -1908,8 +1908,10 @@
 {
 	struct st_mysqlnd_packet_greet * packet = mnd_pecalloc(1, packet_methods[PROT_GREET_PACKET].struct_size, persistent);
 	DBG_ENTER(mysqlnd_protocol::get_greet_packet);
-	packet-header.m = packet_methods[PROT_GREET_PACKET];
-	packet-header.persistent = persistent;
+	if (packet) {
+		packet-header.m = packet_methods[PROT_GREET_PACKET];
+		packet-header.persistent = persistent;
+	}
 	DBG_RETURN(packet);
 }
 /* }}} */
@@ -1921,8 +1923,10 @@
 {
 	struct st_mysqlnd_packet_auth * packet = mnd_pecalloc(1, packet_methods[PROT_AUTH_PACKET].struct_size, persistent);
 	DBG_ENTER(mysqlnd_protocol::get_auth_packet);
-	packet-header.m = packet_methods[PROT_AUTH_PACKET];
-	packet-header.persistent = persistent;
+	if (packet) {
+		packet-header.m = packet_methods[PROT_AUTH_PACKET];
+		packet-header.persistent = persistent;
+	}
 	DBG_RETURN(packet);
 }
 /* }}} */
@@ -1934,8 +1938,10 @@
 {
 	struct st_mysqlnd_packet_ok * packet = mnd_pecalloc(1, packet_methods[PROT_OK_PACKET].struct_size, persistent);
 	DBG_ENTER(mysqlnd_protocol::get_ok_packet);
-	packet-header.m = packet_methods[PROT_OK_PACKET];
-	packet-header.persistent = persistent;
+	if (packet) {
+		packet-header.m = packet_methods[PROT_OK_PACKET];
+		packet-header.persistent = persistent;
+	}
 	DBG_RETURN(packet);
 }
 /* }}} */
@@ -1947,8 +1953,10 @@
 {
 	struct st_mysqlnd_packet_eof * packet = mnd_pecalloc(1, packet_methods[PROT_EOF_PACKET].struct_size, persistent);
 	DBG_ENTER(mysqlnd_protocol::get_eof_packet);
-	packet-header.m = packet_methods[PROT_EOF_PACKET];
-	packet-header.persistent = persistent;
+	if (packet) {
+		packet-header.m = packet_methods[PROT_EOF_PACKET];
+		packet-header.persistent = persistent;
+	}
 	DBG_RETURN(packet);
 }
 /* }}} */
@@ -1960,8 +1968,10 @@
 {
 	struct st_mysqlnd_packet_command * packet = mnd_pecalloc(1, packet_methods[PROT_CMD_PACKET].struct_size, persistent);
 	DBG_ENTER(mysqlnd_protocol::get_command_packet);
-	packet-header.m = packet_methods[PROT_CMD_PACKET];
-	packet-header.persistent = persistent;
+	if (packet) {
+		packet-header.m = packet_methods[PROT_CMD_PACKET];
+		packet-header.persistent = persistent;
+	}
 	DBG_RETURN(packet);
 }
 /* }}} */
@@ -1973,8 +1983,10 @@
 {
 	struct st_mysqlnd_packet_rset_header * packet = mnd_pecalloc(1, packet_methods[PROT_RSET_HEADER_PACKET].struct_size, persistent);
 	DBG_ENTER(mysqlnd_protocol::get_rset_header_packet);
-	packet-header.m = packet_methods[PROT_RSET_HEADER_PACKET];
-	packet-header.persistent = persistent;
+	if (packet) {
+		packet-header.m = packet_methods[PROT_RSET_HEADER_PACKET];
+		packet-header.persistent = persistent;
+	}
 	DBG_RETURN(packet);
 }
 /* }}} */
@@ -1986,8 +1998,10 @@
 {
 	struct st_mysqlnd_packet_res_field * packet = mnd_pecalloc(1, packet_methods[PROT_RSET_FLD_PACKET].struct_size, persistent);
 	DBG_ENTER(mysqlnd_protocol::get_result_field_packet);
-	packet-header.m = packet_methods[PROT_RSET_FLD_PACKET];
-	packet-header.persistent = persistent;
+	if (packet) {
+		packet-header.m = packet_methods[PROT_RSET_FLD_PACKET];
+		packet-header.persistent = persistent;
+	}
 	DBG_RETURN(packet);
 }
 /* }}} */
@@ -1999,8 +2013,10 @@
 {
 	struct st_mysqlnd_packet_row * packet = mnd_pecalloc(1, packet_methods[PROT_ROW_PACKET].struct_size, persistent);
 	DBG_ENTER(mysqlnd_protocol::get_row_packet);
-	packet-header.m = packet_methods[PROT_ROW_PACKET];
-	packet-header.persistent = persistent;
+	if (packet) {
+		packet-header.m = packet_methods[PROT_ROW_PACKET];
+		packet-header.persistent = persistent;
+	}
 	DBG_RETURN(packet);
 }
 /* }}} */
@@ -2012,8 +2028,10 @@
 {
 	struct st_mysqlnd_packet_stats * packet = mnd_pecalloc(1, packet_methods[PROT_STATS_PACKET].struct_size, persistent);
 	DBG_ENTER(mysqlnd_protocol::get_stats_packet);
-	packet-header.m = packet_methods[PROT_STATS_PACKET];
-	packet-header.persistent = persistent;
+	if (packet) {
+		packet-header.m = packet_methods[PROT_STATS_PACKET];
+		packet-header.persistent = persistent;
+	}
 	DBG_RETURN(packet);
 }
 /* }}} */
@@ -2025,8 +2043,10 @@
 {
 	struct st_mysqlnd_packet_prepare_response * packet = mnd_pecalloc(1, packet_methods[PROT_PREPARE_RESP_PACKET].struct_size, persistent);
 	DBG_ENTER(mysqlnd_protocol::get_prepare_response_packet);
-	packet-header.m = packet_methods[PROT_PREPARE_RESP_PACKET];
-	

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

2010-05-25 Thread Andrey Hristov
andrey   Tue, 25 May 2010 22:36:33 +

Revision: http://svn.php.net/viewvc?view=revisionrevision=299759

Log:
Use only memory that has been allocated

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-05-25 
22:34:47 UTC (rev 299758)
+++ php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_net.c  2010-05-25 
22:36:33 UTC (rev 299759)
@@ -885,13 +885,14 @@

DBG_ENTER(mysqlnd_net_init);
DBG_INF_FMT(persistent=%d, persistent);
-   net-persistent = persistent;
+   if (net) {
+   net-persistent = persistent;
+   net-m = mysqlnd_mysqlnd_net_methods;

-   net-m = mysqlnd_mysqlnd_net_methods;
-
-   {
-   unsigned int buf_size = MYSQLND_G(net_cmd_buffer_size); /* this 
is long, cast to unsigned int*/
-   net-m.set_client_option(net, 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*/
+   net-m.set_client_option(net, 
MYSQLND_OPT_NET_CMD_BUFFER_SIZE, (char *) buf_size TSRMLS_CC);
+   }
}
DBG_RETURN(net);
 }

Modified: php/php-src/trunk/ext/mysqlnd/mysqlnd_net.c
===
--- php/php-src/trunk/ext/mysqlnd/mysqlnd_net.c 2010-05-25 22:34:47 UTC (rev 
299758)
+++ php/php-src/trunk/ext/mysqlnd/mysqlnd_net.c 2010-05-25 22:36:33 UTC (rev 
299759)
@@ -885,13 +885,14 @@

DBG_ENTER(mysqlnd_net_init);
DBG_INF_FMT(persistent=%d, persistent);
-   net-persistent = persistent;
+   if (net) {
+   net-persistent = persistent;
+   net-m = mysqlnd_mysqlnd_net_methods;

-   net-m = mysqlnd_mysqlnd_net_methods;
-
-   {
-   unsigned int buf_size = MYSQLND_G(net_cmd_buffer_size); /* this 
is long, cast to unsigned int*/
-   net-m.set_client_option(net, 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*/
+   net-m.set_client_option(net, 
MYSQLND_OPT_NET_CMD_BUFFER_SIZE, (char *) buf_size TSRMLS_CC);
+   }
}
DBG_RETURN(net);
 }

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

2010-05-25 Thread Andrey Hristov
andrey   Tue, 25 May 2010 22:38:11 +

Revision: http://svn.php.net/viewvc?view=revisionrevision=299760

Log:
Use the specialized macro for this case

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

Modified: php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_ps_codec.c
===
--- php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_ps_codec.c 2010-05-25 
22:36:33 UTC (rev 299759)
+++ php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_ps_codec.c 2010-05-25 
22:38:11 UTC (rev 299760)
@@ -621,7 +621,7 @@
*buf_len = offset + stmt-param_count * 2 + 20;
tmp_buf = mnd_emalloc(*buf_len);
if (!tmp_buf) {
-   SET_STMT_ERROR(stmt, CR_UNKNOWN_ERROR, 
UNKNOWN_SQLSTATE, OOM);
+   SET_OOM_ERROR(stmt-error_info);
goto end;
}
memcpy(tmp_buf, *buf, offset);
@@ -655,7 +655,7 @@
if (stmt-param_bind[j].zv == the_var) {
/* Double binding of the same zval, make a copy 
*/
if (PASS != mysqlnd_stmt_copy_it(copies, 
the_var, stmt-param_count, i TSRMLS_CC)) {
-   SET_STMT_ERROR(stmt, CR_UNKNOWN_ERROR, 
UNKNOWN_SQLSTATE, OOM);
+   SET_OOM_ERROR(stmt-error_info);
goto end;
}
break;
@@ -668,7 +668,7 @@
if (Z_TYPE_P(the_var) != IS_DOUBLE) {
if (!copies || !copies[i]) {
if (PASS != 
mysqlnd_stmt_copy_it(copies, the_var, stmt-param_count, i TSRMLS_CC)) {
-   SET_STMT_ERROR(stmt, 
CR_UNKNOWN_ERROR, UNKNOWN_SQLSTATE, OOM);
+   
SET_OOM_ERROR(stmt-error_info);
goto end;
}
}
@@ -686,7 +686,7 @@
if (Z_TYPE_P(the_var) != IS_LONG) {
if (!copies || !copies[i]) {
if (PASS != 
mysqlnd_stmt_copy_it(copies, the_var, stmt-param_count, i TSRMLS_CC)) {
-   SET_STMT_ERROR(stmt, 
CR_UNKNOWN_ERROR, UNKNOWN_SQLSTATE, OOM);
+   
SET_OOM_ERROR(stmt-error_info);
goto end;
}
}
@@ -712,7 +712,7 @@
{
if (!copies || !copies[i]) {
if (PASS != 
mysqlnd_stmt_copy_it(copies, the_var, stmt-param_count, i TSRMLS_CC)) {
-   SET_STMT_ERROR(stmt, 
CR_UNKNOWN_ERROR, UNKNOWN_SQLSTATE, OOM);
+   
SET_OOM_ERROR(stmt-error_info);
goto end;
}
}
@@ -738,7 +738,7 @@
*buf_len = offset + data_size + 10; /* Allocate + 10 for safety 
*/
tmp_buf = mnd_emalloc(*buf_len);
if (!tmp_buf) {
-   SET_STMT_ERROR(stmt, CR_UNKNOWN_ERROR, 
UNKNOWN_SQLSTATE, OOM);
+   SET_OOM_ERROR(stmt-error_info);
goto end;
}
memcpy(tmp_buf, *buf, offset);

Modified: php/php-src/trunk/ext/mysqlnd/mysqlnd_ps_codec.c
===
--- php/php-src/trunk/ext/mysqlnd/mysqlnd_ps_codec.c2010-05-25 22:36:33 UTC 
(rev 299759)
+++ php/php-src/trunk/ext/mysqlnd/mysqlnd_ps_codec.c2010-05-25 22:38:11 UTC 
(rev 299760)
@@ -621,7 +621,7 @@
*buf_len = offset + stmt-param_count * 2 + 20;
tmp_buf = mnd_emalloc(*buf_len);
if (!tmp_buf) {
-   SET_STMT_ERROR(stmt, CR_UNKNOWN_ERROR, 
UNKNOWN_SQLSTATE, OOM);
+   SET_OOM_ERROR(stmt-error_info);
goto end;
}
memcpy(tmp_buf, *buf, offset);
@@ -655,7 +655,7 @@
if (stmt-param_bind[j].zv == the_var) {
/* 

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

2010-05-25 Thread Andrey Hristov
andrey   Tue, 25 May 2010 22:40:47 +

Revision: http://svn.php.net/viewvc?view=revisionrevision=299761

Log:
Init should return status value because initialization can fail.
In this case mysqlnd_init() should return NULL to the end-user.

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_structs.h
U   php/php-src/trunk/ext/mysqlnd/mysqlnd.c
U   php/php-src/trunk/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  2010-05-25 22:38:11 UTC 
(rev 299760)
+++ php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd.c  2010-05-25 22:40:47 UTC 
(rev 299761)
@@ -2140,7 +2140,7 @@


 MYSQLND_STMT * _mysqlnd_stmt_init(MYSQLND * const conn TSRMLS_DC);
-static void MYSQLND_METHOD(mysqlnd_conn, init)(MYSQLND * conn TSRMLS_DC);
+static enum_func_status MYSQLND_METHOD(mysqlnd_conn, init)(MYSQLND * conn 
TSRMLS_DC);

 static
 MYSQLND_CLASS_METHODS_START(mysqlnd_conn)
@@ -2217,17 +2217,17 @@


 /* {{{ mysqlnd_conn::init */
-static void
+static enum_func_status
 MYSQLND_METHOD(mysqlnd_conn, init)(MYSQLND * conn TSRMLS_DC)
 {
DBG_ENTER(mysqlnd_conn::init);
+   mysqlnd_stats_init(conn-stats, STAT_LAST);
+   SET_ERROR_AFF_ROWS(conn);
+
conn-net = mysqlnd_net_init(conn-persistent TSRMLS_CC);
conn-protocol = mysqlnd_protocol_init(conn-persistent TSRMLS_CC);
-   mysqlnd_stats_init(conn-stats, STAT_LAST);

-   SET_ERROR_AFF_ROWS(conn);
-
-   DBG_VOID_RETURN;
+   DBG_RETURN(conn-net  conn-protocol? PASS:FAIL);
 }
 /* }}} */

@@ -2249,7 +2249,10 @@
CONN_SET_STATE(ret, CONN_ALLOCED);
ret-m-get_reference(ret TSRMLS_CC);

-   ret-m-init(ret TSRMLS_CC);
+   if (PASS != ret-m-init(ret TSRMLS_CC)) {
+   ret-m-dtor(ret TSRMLS_CC);
+   ret = NULL;
+   }

DBG_RETURN(ret);
 }

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-05-25 
22:38:11 UTC (rev 299760)
+++ php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_structs.h  2010-05-25 
22:40:47 UTC (rev 299761)
@@ -334,7 +334,7 @@



-typedef void   (*func_mysqlnd_conn__init)(MYSQLND * 
conn TSRMLS_DC);
+typedef enum_func_status   (*func_mysqlnd_conn__init)(MYSQLND * conn 
TSRMLS_DC);
 typedef enum_func_status   (*func_mysqlnd_conn__connect)(MYSQLND *conn, 
const char *host, const char * user, const char * passwd, unsigned int 
passwd_len, const char * db, unsigned int db_len, unsigned int port, const char 
* socket, unsigned int mysql_flags TSRMLS_DC);
 typedef ulong  
(*func_mysqlnd_conn__escape_string)(const MYSQLND * const conn, char *newstr, 
const char *escapestr, size_t escapestr_len TSRMLS_DC);
 typedef enum_func_status   (*func_mysqlnd_conn__set_charset)(MYSQLND * 
const conn, const char * const charset TSRMLS_DC);

Modified: php/php-src/trunk/ext/mysqlnd/mysqlnd.c
===
--- php/php-src/trunk/ext/mysqlnd/mysqlnd.c 2010-05-25 22:38:11 UTC (rev 
299760)
+++ php/php-src/trunk/ext/mysqlnd/mysqlnd.c 2010-05-25 22:40:47 UTC (rev 
299761)
@@ -2140,7 +2140,7 @@


 MYSQLND_STMT * _mysqlnd_stmt_init(MYSQLND * const conn TSRMLS_DC);
-static void MYSQLND_METHOD(mysqlnd_conn, init)(MYSQLND * conn TSRMLS_DC);
+static enum_func_status MYSQLND_METHOD(mysqlnd_conn, init)(MYSQLND * conn 
TSRMLS_DC);

 static
 MYSQLND_CLASS_METHODS_START(mysqlnd_conn)
@@ -2217,17 +2217,17 @@


 /* {{{ mysqlnd_conn::init */
-static void
+static enum_func_status
 MYSQLND_METHOD(mysqlnd_conn, init)(MYSQLND * conn TSRMLS_DC)
 {
DBG_ENTER(mysqlnd_conn::init);
+   mysqlnd_stats_init(conn-stats, STAT_LAST);
+   SET_ERROR_AFF_ROWS(conn);
+
conn-net = mysqlnd_net_init(conn-persistent TSRMLS_CC);
conn-protocol = mysqlnd_protocol_init(conn-persistent TSRMLS_CC);
-   mysqlnd_stats_init(conn-stats, STAT_LAST);

-   SET_ERROR_AFF_ROWS(conn);
-
-   DBG_VOID_RETURN;
+   DBG_RETURN(conn-net  conn-protocol? PASS:FAIL);
 }
 /* }}} */

@@ -2249,7 +2249,10 @@
CONN_SET_STATE(ret, CONN_ALLOCED);
ret-m-get_reference(ret TSRMLS_CC);

-   ret-m-init(ret TSRMLS_CC);
+   if (PASS != ret-m-init(ret TSRMLS_CC)) {
+   ret-m-dtor(ret TSRMLS_CC);
+   ret = NULL;
+   }

DBG_RETURN(ret);
 }

Modified: php/php-src/trunk/ext/mysqlnd/mysqlnd_structs.h
===
--- php/php-src/trunk/ext/mysqlnd/mysqlnd_structs.h 2010-05-25 22:38:11 UTC 
(rev 299760)
+++ php/php-src/trunk/ext/mysqlnd/mysqlnd_structs.h 2010-05-25 22:40:47 UTC 

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

2010-05-25 Thread Andrey Hristov
andrey   Tue, 25 May 2010 22:42:25 +

Revision: http://svn.php.net/viewvc?view=revisionrevision=299762

Log:
Gracefully handle OOM in mysqlnd_stmt_init. Release the handle
and return NULL.

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   2010-05-25 
22:40:47 UTC (rev 299761)
+++ php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_ps.c   2010-05-25 
22:42:25 UTC (rev 299762)
@@ -2194,25 +2194,45 @@
 {
size_t alloc_size = sizeof(MYSQLND_STMT) + mysqlnd_plugin_count() * 
sizeof(void *);
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);
+   MYSQLND_STMT_DATA * stmt = NULL;

DBG_ENTER(_mysqlnd_stmt_init);
-   DBG_INF_FMT(stmt=%p, stmt);
+   do {
+   if (!ret) {
+   break;
+   }
+   ret-m = mysqlnd_stmt_methods;

-   ret-m = mysqlnd_stmt_methods;
-   stmt-persistent = conn-persistent;
-   stmt-state = MYSQLND_STMT_INITTED;
-   stmt-execute_cmd_buffer.length = 4096;
-   stmt-execute_cmd_buffer.buffer = 
mnd_pemalloc(stmt-execute_cmd_buffer.length, stmt-persistent);
+   stmt = ret-data = mnd_pecalloc(1, sizeof(MYSQLND_STMT_DATA), 
conn-persistent);
+   DBG_INF_FMT(stmt=%p, stmt);
+   if (!stmt) {
+   break;
+   }
+   stmt-persistent = conn-persistent;
+   stmt-state = MYSQLND_STMT_INITTED;
+   stmt-execute_cmd_buffer.length = 4096;
+   stmt-execute_cmd_buffer.buffer = 
mnd_pemalloc(stmt-execute_cmd_buffer.length, stmt-persistent);
+   if (!stmt-execute_cmd_buffer.buffer) {
+   break;
+   }

-   stmt-prefetch_rows = MYSQLND_DEFAULT_PREFETCH_ROWS;
-   /*
- Mark that we reference the connection, thus it won't be
- be destructed till there is open statements. The last statement
- or normal query result will close it then.
-   */
-   stmt-conn = conn-m-get_reference(conn TSRMLS_CC);
-   DBG_RETURN(ret);
+   stmt-prefetch_rows = MYSQLND_DEFAULT_PREFETCH_ROWS;
+   /*
+ Mark that we reference the connection, thus it won't be
+ be destructed till there is open statements. The last 
statement
+ or normal query result will close it then.
+   */
+   stmt-conn = conn-m-get_reference(conn TSRMLS_CC);
+
+   DBG_RETURN(ret);
+   } while (0);
+
+   SET_OOM_ERROR(conn-error_info);
+   if (ret) {
+   ret-m-dtor(ret, TRUE TSRMLS_CC);
+   ret = NULL;
+   }
+   DBG_RETURN(NULL);
 }
 /* }}} */


Modified: php/php-src/trunk/ext/mysqlnd/mysqlnd_ps.c
===
--- php/php-src/trunk/ext/mysqlnd/mysqlnd_ps.c  2010-05-25 22:40:47 UTC (rev 
299761)
+++ php/php-src/trunk/ext/mysqlnd/mysqlnd_ps.c  2010-05-25 22:42:25 UTC (rev 
299762)
@@ -2194,25 +2194,45 @@
 {
size_t alloc_size = sizeof(MYSQLND_STMT) + mysqlnd_plugin_count() * 
sizeof(void *);
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);
+   MYSQLND_STMT_DATA * stmt = NULL;

DBG_ENTER(_mysqlnd_stmt_init);
-   DBG_INF_FMT(stmt=%p, stmt);
+   do {
+   if (!ret) {
+   break;
+   }
+   ret-m = mysqlnd_stmt_methods;

-   ret-m = mysqlnd_stmt_methods;
-   stmt-persistent = conn-persistent;
-   stmt-state = MYSQLND_STMT_INITTED;
-   stmt-execute_cmd_buffer.length = 4096;
-   stmt-execute_cmd_buffer.buffer = 
mnd_pemalloc(stmt-execute_cmd_buffer.length, stmt-persistent);
+   stmt = ret-data = mnd_pecalloc(1, sizeof(MYSQLND_STMT_DATA), 
conn-persistent);
+   DBG_INF_FMT(stmt=%p, stmt);
+   if (!stmt) {
+   break;
+   }
+   stmt-persistent = conn-persistent;
+   stmt-state = MYSQLND_STMT_INITTED;
+   stmt-execute_cmd_buffer.length = 4096;
+   stmt-execute_cmd_buffer.buffer = 
mnd_pemalloc(stmt-execute_cmd_buffer.length, stmt-persistent);
+   if (!stmt-execute_cmd_buffer.buffer) {
+   break;
+   }

-   stmt-prefetch_rows = MYSQLND_DEFAULT_PREFETCH_ROWS;
-   /*
- Mark that we reference the connection, thus it won't be
- be destructed till 

[PHP-CVS] svn: /php/php-src/ branches/PHP_5_2/NEWS branches/PHP_5_2/ext/reflection/php_reflection.c branches/PHP_5_2/ext/reflection/tests/bug51911.phpt branches/PHP_5_3/NEWS branches/PHP_5_3/ext/refle

2010-05-25 Thread Felipe Pena
felipe   Tue, 25 May 2010 22:46:17 +

Revision: http://svn.php.net/viewvc?view=revisionrevision=299763

Log:
- Fixed bug #51911 (ReflectionParameter::getDefaultValue() memory leaks with 
constant array)

Bug: http://bugs.php.net/51911 (Closed) ReflectionParameter::getDefaultValue() 
memory leaks with constant array
  
Changed paths:
U   php/php-src/branches/PHP_5_2/NEWS
U   php/php-src/branches/PHP_5_2/ext/reflection/php_reflection.c
A   php/php-src/branches/PHP_5_2/ext/reflection/tests/bug51911.phpt
U   php/php-src/branches/PHP_5_3/NEWS
U   php/php-src/branches/PHP_5_3/ext/reflection/php_reflection.c
A   php/php-src/branches/PHP_5_3/ext/reflection/tests/bug51911.phpt
U   php/php-src/trunk/ext/reflection/php_reflection.c
A   php/php-src/trunk/ext/reflection/tests/bug51911.phpt

Modified: php/php-src/branches/PHP_5_2/NEWS
===
--- php/php-src/branches/PHP_5_2/NEWS   2010-05-25 22:42:25 UTC (rev 299762)
+++ php/php-src/branches/PHP_5_2/NEWS   2010-05-25 22:46:17 UTC (rev 299763)
@@ -18,6 +18,8 @@
 - Fixed a possible arbitrary memory access inside sqlite extension. Reported
   by Mateusz Kocielski. (Ilia)

+- Fixed bug #51911 (ReflectionParameter::getDefaultValue() memory leaks with
+  constant array). (Felipe)
 - Fixed bug #51671 (imagefill does not work correctly for small images).
   (Pierre)
 - Fixed bug #51670 (getColumnMeta causes segfault when re-executing query

Modified: php/php-src/branches/PHP_5_2/ext/reflection/php_reflection.c
===
--- php/php-src/branches/PHP_5_2/ext/reflection/php_reflection.c
2010-05-25 22:42:25 UTC (rev 299762)
+++ php/php-src/branches/PHP_5_2/ext/reflection/php_reflection.c
2010-05-25 22:46:17 UTC (rev 299763)
@@ -2170,7 +2170,7 @@

*return_value = precv-op2.u.constant;
INIT_PZVAL(return_value);
-   if (Z_TYPE_P(return_value) != IS_CONSTANT) {
+   if (Z_TYPE_P(return_value) != IS_CONSTANT  Z_TYPE_P(return_value) != 
IS_CONSTANT_ARRAY) {
zval_copy_ctor(return_value);
}
zval_update_constant_ex(return_value, (void*)0, 
param-fptr-common.scope TSRMLS_CC);

Added: php/php-src/branches/PHP_5_2/ext/reflection/tests/bug51911.phpt
===
--- php/php-src/branches/PHP_5_2/ext/reflection/tests/bug51911.phpt 
(rev 0)
+++ php/php-src/branches/PHP_5_2/ext/reflection/tests/bug51911.phpt 
2010-05-25 22:46:17 UTC (rev 299763)
@@ -0,0 +1,22 @@
+--TEST--
+Bug #51911 (ReflectionParameter::getDefaultValue() memory leaks with constant 
array)
+--FILE--
+?php
+
+class Foo {
+   const X = 1;
+   public function x($x = array(1)) {}
+}
+
+$clazz = new ReflectionClass('Foo');
+$method = $clazz-getMethod('x');
+foreach ($method-getParameters() as $param) {
+if ( $param-isDefaultValueAvailable())
+echo '$', $param-getName(), ' : ', 
var_export($param-getDefaultValue(), 1), \n;
+}
+
+?
+--EXPECT--
+$x : array (
+  0 = 1,
+)


Property changes on: 
php/php-src/branches/PHP_5_2/ext/reflection/tests/bug51911.phpt
___
Added: svn:keywords
   + Id Rev Revision
Added: svn:eol-style
   + native

Modified: php/php-src/branches/PHP_5_3/NEWS
===
--- php/php-src/branches/PHP_5_3/NEWS   2010-05-25 22:42:25 UTC (rev 299762)
+++ php/php-src/branches/PHP_5_3/NEWS   2010-05-25 22:46:17 UTC (rev 299763)
@@ -62,6 +62,8 @@
   requests (Fixes CVE-2010-0397, bug #51288). (Raphael Geissert)
 - Fixed 64-bit integer overflow in mhash_keygen_s2k(). (Clément LECIGNE, Stas)

+- Fixed bug #51911 (ReflectionParameter::getDefaultValue() memory leaks with
+  constant array). (Felipe)
 - Fixed bug #51844 (checkdnsrr does not support types other than MX). (Pierre)
 - Fixed bug #51827 (Bad warning when register_shutdown_function called with
   wrong num of parameters). (Felipe)

Modified: php/php-src/branches/PHP_5_3/ext/reflection/php_reflection.c
===
--- php/php-src/branches/PHP_5_3/ext/reflection/php_reflection.c
2010-05-25 22:42:25 UTC (rev 299762)
+++ php/php-src/branches/PHP_5_3/ext/reflection/php_reflection.c
2010-05-25 22:46:17 UTC (rev 299763)
@@ -2408,7 +2408,7 @@

*return_value = precv-op2.u.constant;
INIT_PZVAL(return_value);
-   if (Z_TYPE_P(return_value) != IS_CONSTANT) {
+   if (Z_TYPE_P(return_value) != IS_CONSTANT  Z_TYPE_P(return_value) != 
IS_CONSTANT_ARRAY) {
zval_copy_ctor(return_value);
}
zval_update_constant_ex(return_value, (void*)0, 
param-fptr-common.scope TSRMLS_CC);

Added: php/php-src/branches/PHP_5_3/ext/reflection/tests/bug51911.phpt

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

2010-05-25 Thread Andrey Hristov
andrey   Tue, 25 May 2010 22:55:10 +

Revision: http://svn.php.net/viewvc?view=revisionrevision=299764

Log:
Handle the situation when mysql_init()/mysqlnd_init()
return NULL. It is a rare case of OOM but PHP shouldn't crash, if possible.

Changed paths:
U   php/php-src/branches/PHP_5_3/ext/mysql/php_mysql.c
U   php/php-src/trunk/ext/mysql/php_mysql.c

Modified: php/php-src/branches/PHP_5_3/ext/mysql/php_mysql.c
===
--- php/php-src/branches/PHP_5_3/ext/mysql/php_mysql.c  2010-05-25 22:46:17 UTC 
(rev 299763)
+++ php/php-src/branches/PHP_5_3/ext/mysql/php_mysql.c  2010-05-25 22:55:10 UTC 
(rev 299764)
@@ -960,9 +960,17 @@
 #else
mysql-conn = mysql_init(persistent);
 #endif
+   if (!mysql-conn) {
+   MySG(connect_error) = estrdup(OOM);
+   php_error_docref(NULL TSRMLS_CC, E_WARNING, OOM);
+   efree(hashed_details);
+   efree(mysql);
+   MYSQL_DO_CONNECT_RETURN_FALSE();
+   }

-   if (connect_timeout != -1)
-   mysql_options(mysql-conn, 
MYSQL_OPT_CONNECT_TIMEOUT, (const char *)connect_timeout);
+   if (connect_timeout != -1) {
+   mysql_options(mysql-conn, MYSQL_OPT_CONNECT_TIMEOUT, 
(const char *)connect_timeout);
+   }

 #ifndef MYSQL_USE_MYSQLND
if (mysql_real_connect(mysql-conn, host, user, passwd, NULL, 
port, socket, client_flags)==NULL)

Modified: php/php-src/trunk/ext/mysql/php_mysql.c
===
--- php/php-src/trunk/ext/mysql/php_mysql.c 2010-05-25 22:46:17 UTC (rev 
299763)
+++ php/php-src/trunk/ext/mysql/php_mysql.c 2010-05-25 22:55:10 UTC (rev 
299764)
@@ -960,9 +960,17 @@
 #else
mysql-conn = mysql_init(persistent);
 #endif
+   if (!mysql-conn) {
+   MySG(connect_error) = estrdup(OOM);
+   php_error_docref(NULL TSRMLS_CC, E_WARNING, OOM);
+   efree(hashed_details);
+   efree(mysql);
+   MYSQL_DO_CONNECT_RETURN_FALSE();
+   }

-   if (connect_timeout != -1)
-   mysql_options(mysql-conn, 
MYSQL_OPT_CONNECT_TIMEOUT, (const char *)connect_timeout);
+   if (connect_timeout != -1) {
+   mysql_options(mysql-conn, MYSQL_OPT_CONNECT_TIMEOUT, 
(const char *)connect_timeout);
+   }

 #ifndef MYSQL_USE_MYSQLND
if (mysql_real_connect(mysql-conn, host, user, passwd, NULL, 
port, socket, client_flags)==NULL)

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

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

2010-05-25 Thread Andrey Hristov
andrey   Tue, 25 May 2010 23:18:13 +

Revision: http://svn.php.net/viewvc?view=revisionrevision=299765

Log:
Handle the situation when MYSQLND_PROTOCOL's methods return NULL.
mysqlnd should not crash but gracefully return with an error.

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_ps.c
U   php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_result.c
U   php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_result_meta.c
U   php/php-src/trunk/ext/mysqlnd/mysqlnd.c
U   php/php-src/trunk/ext/mysqlnd/mysqlnd_ps.c
U   php/php-src/trunk/ext/mysqlnd/mysqlnd_result.c
U   php/php-src/trunk/ext/mysqlnd/mysqlnd_result_meta.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-25 22:55:10 UTC (rev 299764)
+++ php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd.c	2010-05-25 23:18:13 UTC (rev 299765)
@@ -225,7 +225,7 @@
 			 zend_bool silent, enum php_mysqlnd_server_command command,
 			 zend_bool ignore_upsert_status TSRMLS_DC)
 {
-	enum_func_status ret;
+	enum_func_status ret = FAIL;

 	DBG_ENTER(mysqlnd_conn::simple_command_handle_response);
 	DBG_INF_FMT(silent=%d packet=%d command=%s, silent, ok_packet, mysqlnd_command_to_text[command]);
@@ -233,6 +233,10 @@
 	switch (ok_packet) {
 		case PROT_OK_PACKET:{
 			MYSQLND_PACKET_OK * ok_response = conn-protocol-m.get_ok_packet(conn-protocol, FALSE TSRMLS_CC);
+			if (!ok_response) {
+SET_OOM_ERROR(conn-error_info);
+break;
+			}
 			if (FAIL == (ret = PACKET_READ(ok_response, conn))) {
 if (!silent) {
 	DBG_ERR_FMT(Error while reading %s's OK packet, mysqlnd_command_to_text[command]);
@@ -274,6 +278,10 @@
 		}
 		case PROT_EOF_PACKET:{
 			MYSQLND_PACKET_EOF * ok_response = conn-protocol-m.get_eof_packet(conn-protocol, FALSE TSRMLS_CC);
+			if (!ok_response) {
+SET_OOM_ERROR(conn-error_info);
+break;
+			}
 			if (FAIL == (ret = PACKET_READ(ok_response, conn))) {
 SET_CLIENT_ERROR(conn-error_info, CR_MALFORMED_PACKET, UNKNOWN_SQLSTATE,
  Malformed packet);
@@ -300,7 +308,6 @@
 			break;
 		}
 		default:
-			ret = FAIL;
 			SET_CLIENT_ERROR(conn-error_info, CR_MALFORMED_PACKET, UNKNOWN_SQLSTATE, Malformed packet);
 			php_error_docref(NULL TSRMLS_CC, E_ERROR, Wrong response packet %d passed to the function, ok_packet);
 			break;
@@ -344,6 +351,11 @@
 	SET_EMPTY_ERROR(conn-error_info);

 	cmd_packet = conn-protocol-m.get_command_packet(conn-protocol, FALSE TSRMLS_CC);
+	if (!cmd_packet) {
+		SET_OOM_ERROR(conn-error_info);
+		DBG_RETURN(FAIL);
+	}
+
 	cmd_packet-command = command;
 	if (arg  arg_len) {
 		cmd_packet-argument = arg;
@@ -526,6 +538,7 @@
 			transport_len = spprintf(transport, 0, tcp://%s:%d, host, port);
 		}
 		if (!transport) {
+			SET_OOM_ERROR(conn-error_info);
 			goto err; /* OOM */
 		}
 		DBG_INF_FMT(transport=%s, transport);
@@ -542,6 +555,7 @@
 	auth_packet = conn-protocol-m.get_auth_packet(conn-protocol, FALSE TSRMLS_CC);
 	ok_packet = conn-protocol-m.get_ok_packet(conn-protocol, FALSE TSRMLS_CC);
 	if (!greet_packet || !auth_packet || !ok_packet) {
+		SET_OOM_ERROR(conn-error_info);
 		goto err; /* OOM */
 	}

@@ -613,6 +627,7 @@

 	conn-scramble = auth_packet-server_scramble_buf = mnd_pemalloc(SCRAMBLE_LENGTH, conn-persistent);
 	if (!conn-scramble) {
+		SET_OOM_ERROR(conn-error_info);
 		goto err; /* OOM */
 	}
 	memcpy(auth_packet-server_scramble_buf, greet_packet-scramble_buf, SCRAMBLE_LENGTH);
@@ -682,12 +697,14 @@
 		conn-connect_or_select_db_len = db_len;

 		if (!conn-user || !conn-passwd || !conn-connect_or_select_db) {
+			SET_OOM_ERROR(conn-error_info);
 			goto err; /* OOM */
 		}

 		if (!unix_socket) {
 			conn-host = mnd_pestrdup(host, conn-persistent);
 			if (!conn-host) {
+SET_OOM_ERROR(conn-error_info);
 goto err; /* OOM */
 			}
 			conn-host_len = strlen(conn-host);
@@ -695,11 +712,13 @@
 char *p;
 spprintf(p, 0, %s via TCP/IP, conn-host);
 if (!p) {
+	SET_OOM_ERROR(conn-error_info);
 	goto err; /* OOM */
 }
 conn-host_info =  mnd_pestrdup(p, conn-persistent);
 efree(p); /* allocated by spprintf */
 if (!conn-host_info) {
+	SET_OOM_ERROR(conn-error_info);
 	goto err; /* OOM */
 }
 			}
@@ -707,6 +726,7 @@
 			conn-unix_socket	= mnd_pestrdup(socket, conn-persistent);
 			conn-host_info		= mnd_pestrdup(Localhost via UNIX socket, conn-persistent);
 			if (!conn-unix_socket || !conn-host_info) {
+SET_OOM_ERROR(conn-error_info);
 goto err; /* OOM */
 			}
 			conn-unix_socket_len = strlen(conn-unix_socket);
@@ -1333,6 +1353,11 @@
 		DBG_RETURN(FAIL);
 	}
 	stats_header = conn-protocol-m.get_stats_packet(conn-protocol, FALSE TSRMLS_CC);
+	if (!stats_header) {
+		SET_OOM_ERROR(conn-error_info);
+		DBG_RETURN(FAIL);
+	}
+
 	if (FAIL == 

[PHP-CVS] svn: /php/php-src/ branches/PHP_5_2/NEWS branches/PHP_5_2/Zend/zend_execute.h branches/PHP_5_2/Zend/zend_execute_API.c branches/PHP_5_2/ext/reflection/tests/bug51905.phpt branches/PHP_5_3/NE

2010-05-25 Thread Felipe Pena
felipe   Wed, 26 May 2010 00:00:58 +

Revision: http://svn.php.net/viewvc?view=revisionrevision=299766

Log:
- Fixed bug #51905 (ReflectionParameter fails if default value is an array with 
an access to self::)

Bug: http://bugs.php.net/51905 (Open) ReflectionParameter fails if default 
value is an array with an access to self::
  
Changed paths:
U   php/php-src/branches/PHP_5_2/NEWS
U   php/php-src/branches/PHP_5_2/Zend/zend_execute.h
U   php/php-src/branches/PHP_5_2/Zend/zend_execute_API.c
A   php/php-src/branches/PHP_5_2/ext/reflection/tests/bug51905.phpt
U   php/php-src/branches/PHP_5_3/NEWS
U   php/php-src/branches/PHP_5_3/Zend/zend_execute.h
U   php/php-src/branches/PHP_5_3/Zend/zend_execute_API.c
A   php/php-src/branches/PHP_5_3/ext/reflection/tests/bug51905.phpt
U   php/php-src/trunk/Zend/zend_execute.h
U   php/php-src/trunk/Zend/zend_execute_API.c
A   php/php-src/trunk/ext/reflection/tests/bug51905.phpt

Modified: php/php-src/branches/PHP_5_2/NEWS
===
--- php/php-src/branches/PHP_5_2/NEWS	2010-05-25 23:18:13 UTC (rev 299765)
+++ php/php-src/branches/PHP_5_2/NEWS	2010-05-26 00:00:58 UTC (rev 299766)
@@ -19,6 +19,8 @@
   by Mateusz Kocielski. (Ilia)

 - Fixed bug #51911 (ReflectionParameter::getDefaultValue() memory leaks with
+- Fixed bug #51905 (ReflectionParameter fails if default value is an array
+  with an access to self::). (Felipe)
   constant array). (Felipe)
 - Fixed bug #51671 (imagefill does not work correctly for small images).
   (Pierre)

Modified: php/php-src/branches/PHP_5_2/Zend/zend_execute.h
===
--- php/php-src/branches/PHP_5_2/Zend/zend_execute.h	2010-05-25 23:18:13 UTC (rev 299765)
+++ php/php-src/branches/PHP_5_2/Zend/zend_execute.h	2010-05-26 00:00:58 UTC (rev 299766)
@@ -140,6 +140,8 @@
 }

 ZEND_API int zval_update_constant(zval **pp, void *arg TSRMLS_DC);
+ZEND_API int zval_update_constant_inline_change(zval **pp, void *arg TSRMLS_DC);
+ZEND_API int zval_update_constant_no_inline_change(zval **pp, void *arg TSRMLS_DC);
 ZEND_API int zval_update_constant_ex(zval **pp, void *arg, zend_class_entry *scope TSRMLS_DC);

 /* dedicated Zend executor functions - do not use! */

Modified: php/php-src/branches/PHP_5_2/Zend/zend_execute_API.c
===
--- php/php-src/branches/PHP_5_2/Zend/zend_execute_API.c	2010-05-25 23:18:13 UTC (rev 299765)
+++ php/php-src/branches/PHP_5_2/Zend/zend_execute_API.c	2010-05-26 00:00:58 UTC (rev 299766)
@@ -584,12 +584,22 @@
 			zend_hash_move_forward(Z_ARRVAL_P(p));
 			zval_dtor(const_value);
 		}
-		zend_hash_apply_with_argument(Z_ARRVAL_P(p), (apply_func_arg_t) zval_update_constant, (void *) 1 TSRMLS_CC);
+		zend_hash_apply_with_argument(Z_ARRVAL_P(p), (apply_func_arg_t) zval_update_constant_inline_change, (void *) scope TSRMLS_CC);
 		zend_hash_internal_pointer_reset(Z_ARRVAL_P(p));
 	}
 	return 0;
 }

+ZEND_API int zval_update_constant_inline_change(zval **pp, void *scope TSRMLS_DC)
+{
+	return zval_update_constant_ex(pp, (void*)1, scope TSRMLS_CC);
+}
+
+ZEND_API int zval_update_constant_no_inline_change(zval **pp, void *scope TSRMLS_DC)
+{
+	return zval_update_constant_ex(pp, (void*)0, scope TSRMLS_CC);
+}
+
 ZEND_API int zval_update_constant(zval **pp, void *arg TSRMLS_DC)
 {
 	return zval_update_constant_ex(pp, arg, NULL TSRMLS_CC);

Added: php/php-src/branches/PHP_5_2/ext/reflection/tests/bug51905.phpt
===
--- php/php-src/branches/PHP_5_2/ext/reflection/tests/bug51905.phpt	(rev 0)
+++ php/php-src/branches/PHP_5_2/ext/reflection/tests/bug51905.phpt	2010-05-26 00:00:58 UTC (rev 299766)
@@ -0,0 +1,28 @@
+--TEST--
+Bug #51905 (ReflectionParameter fails if default value is an array with an access to self::)
+--FILE--
+?php
+
+class Bar {
+	const Y = 20;
+}
+
+class Foo extends Bar {
+	const X = 12;
+	public function x($x = 1, $y = array(self::X), $z = parent::Y) {}
+}
+
+$clazz = new ReflectionClass('Foo');
+$method = $clazz-getMethod('x');
+foreach ($method-getParameters() as $param) {
+if ( $param-isDefaultValueAvailable())
+echo '$', $param-getName(), ' : ', var_export($param-getDefaultValue(), 1), \n;
+}
+
+?
+--EXPECT--
+$x : 1
+$y : array (
+  0 = 12,
+)
+$z : 20


Property changes on: php/php-src/branches/PHP_5_2/ext/reflection/tests/bug51905.phpt
___
Added: svn:keywords
   + Id Rev Revision
Added: svn:eol-style
   + native

Modified: php/php-src/branches/PHP_5_3/NEWS
===
--- php/php-src/branches/PHP_5_3/NEWS	2010-05-25 23:18:13 UTC (rev 299765)
+++ php/php-src/branches/PHP_5_3/NEWS	2010-05-26 00:00:58 UTC (rev 299766)
@@ -64,6 +64,8 @@

 - Fixed 

[PHP-CVS] svn: /php/php-src/ branches/PHP_5_3/NEWS branches/PHP_5_3/Zend/zend_ini_scanner.c branches/PHP_5_3/Zend/zend_ini_scanner.l branches/PHP_5_3/Zend/zend_ini_scanner_defs.h branches/PHP_5_3/ext/

2010-05-25 Thread Felipe Pena
felipe   Wed, 26 May 2010 02:18:17 +

Revision: http://svn.php.net/viewvc?view=revisionrevision=299767

Log:
- Fixed bug #51899 (Parse error in parse_ini_file() function when empy value 
followed by no newline)

Bug: http://bugs.php.net/51899 (Closed) Parse error in parse_ini_file() 
function when empy value followed by no newline
  
Changed paths:
U   php/php-src/branches/PHP_5_3/NEWS
U   php/php-src/branches/PHP_5_3/Zend/zend_ini_scanner.c
U   php/php-src/branches/PHP_5_3/Zend/zend_ini_scanner.l
U   php/php-src/branches/PHP_5_3/Zend/zend_ini_scanner_defs.h
A   php/php-src/branches/PHP_5_3/ext/standard/tests/strings/bug51899.phpt
U   php/php-src/trunk/Zend/zend_ini_scanner.c
U   php/php-src/trunk/Zend/zend_ini_scanner.l
U   php/php-src/trunk/Zend/zend_ini_scanner_defs.h
A   php/php-src/trunk/ext/standard/tests/strings/bug51899.phpt

Modified: php/php-src/branches/PHP_5_3/NEWS
===
--- php/php-src/branches/PHP_5_3/NEWS   2010-05-26 00:00:58 UTC (rev 299766)
+++ php/php-src/branches/PHP_5_3/NEWS   2010-05-26 02:18:17 UTC (rev 299767)
@@ -66,6 +66,8 @@
   constant array). (Felipe)
 - Fixed bug #51905 (ReflectionParameter fails if default value is an array
   with an access to self::). (Felipe)
+- Fixed bug #51899 (Parse error in parse_ini_file() function when empy value
+  followed by no newline). (Felipe)
 - Fixed bug #51844 (checkdnsrr does not support types other than MX). (Pierre)
 - Fixed bug #51827 (Bad warning when register_shutdown_function called with
   wrong num of parameters). (Felipe)

Modified: php/php-src/branches/PHP_5_3/Zend/zend_ini_scanner.c
===
--- php/php-src/branches/PHP_5_3/Zend/zend_ini_scanner.c2010-05-26 
00:00:58 UTC (rev 299766)
+++ php/php-src/branches/PHP_5_3/Zend/zend_ini_scanner.c2010-05-26 
02:18:17 UTC (rev 299767)
@@ -1,4 +1,4 @@
-/* Generated by re2c 0.13.5 on Sun Feb  7 13:25:37 2010 */
+/* Generated by re2c 0.13.5 on Tue May 25 22:53:58 2010 */
 #line 1 Zend/zend_ini_scanner.l
 /*
+--+
@@ -317,7 +317,7 @@
if (YYCURSOR = YYLIMIT) {
if (YYSTATE == STATE(ST_VALUE) || YYSTATE == STATE(ST_RAW)) {
BEGIN(INITIAL);
-   return 0;
+   return END_OF_LINE;
}
return 0;
}

Modified: php/php-src/branches/PHP_5_3/Zend/zend_ini_scanner.l
===
--- php/php-src/branches/PHP_5_3/Zend/zend_ini_scanner.l2010-05-26 
00:00:58 UTC (rev 299766)
+++ php/php-src/branches/PHP_5_3/Zend/zend_ini_scanner.l2010-05-26 
02:18:17 UTC (rev 299767)
@@ -315,7 +315,7 @@
if (YYCURSOR = YYLIMIT) {
if (YYSTATE == STATE(ST_VALUE) || YYSTATE == STATE(ST_RAW)) {
BEGIN(INITIAL);
-   return 0;
+   return END_OF_LINE;
}
return 0;
}

Modified: php/php-src/branches/PHP_5_3/Zend/zend_ini_scanner_defs.h
===
--- php/php-src/branches/PHP_5_3/Zend/zend_ini_scanner_defs.h   2010-05-26 
00:00:58 UTC (rev 299766)
+++ php/php-src/branches/PHP_5_3/Zend/zend_ini_scanner_defs.h   2010-05-26 
02:18:17 UTC (rev 299767)
@@ -1,4 +1,4 @@
-/* Generated by re2c 0.13.5 on Sun Feb  7 13:25:37 2010 */
+/* Generated by re2c 0.13.5 on Tue May 25 22:53:58 2010 */
 #line 3 Zend/zend_ini_scanner_defs.h

 enum YYCONDTYPE {

Added: php/php-src/branches/PHP_5_3/ext/standard/tests/strings/bug51899.phpt
===
--- php/php-src/branches/PHP_5_3/ext/standard/tests/strings/bug51899.phpt   
(rev 0)
+++ php/php-src/branches/PHP_5_3/ext/standard/tests/strings/bug51899.phpt   
2010-05-26 02:18:17 UTC (rev 299767)
@@ -0,0 +1,37 @@
+--TEST--
+Bug #51899 (Parse error in parse_ini_file() function when empy value followed 
by no newline)
+--FILE--
+?php
+
+var_dump(parse_ini_string('a='));
+var_dump(parse_ini_string('a= '));
+var_dump(parse_ini_string('a='.PHP_EOL));
+var_dump(parse_ini_string('a=b '));
+var_dump(parse_ini_string(''));
+var_dump(parse_ini_string(NULL));
+var_dump(parse_ini_string(\0));
+
+?
+--EXPECT--
+array(1) {
+  [a]=
+  string(0) 
+}
+array(1) {
+  [a]=
+  string(0) 
+}
+array(1) {
+  [a]=
+  string(0) 
+}
+array(1) {
+  [a]=
+  string(2) b 
+}
+array(0) {
+}
+array(0) {
+}
+array(0) {
+}


Property changes on: 
php/php-src/branches/PHP_5_3/ext/standard/tests/strings/bug51899.phpt
___
Added: svn:keywords
   + Id Rev Revision
Added: svn:eol-style
   + native

Modified: php/php-src/trunk/Zend/zend_ini_scanner.c