[PHP-CVS] svn: /php/php-src/trunk/ NEWS ext/spl/spl_array.c ext/spl/spl_observer.c ext/spl/tests/bug49263.phpt ext/standard/basic_functions.h ext/standard/php_var.h ext/standard/tests/serialize/bug364

2010-05-26 Thread Michael Wallner
mike Wed, 26 May 2010 07:24:37 +

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

Log:
Added support for object references in recursive serialize() calls. FR #36424

Bug: http://bugs.php.net/36424 (Assigned) Keeping reference info through 
recursive calls to serialize()
  
Changed paths:
U   php/php-src/trunk/NEWS
U   php/php-src/trunk/ext/spl/spl_array.c
U   php/php-src/trunk/ext/spl/spl_observer.c
U   php/php-src/trunk/ext/spl/tests/bug49263.phpt
U   php/php-src/trunk/ext/standard/basic_functions.h
U   php/php-src/trunk/ext/standard/php_var.h
A   php/php-src/trunk/ext/standard/tests/serialize/bug36424.phpt
U   php/php-src/trunk/ext/standard/var.c
U   php/php-src/trunk/ext/standard/var_unserializer.c
U   php/php-src/trunk/ext/standard/var_unserializer.re

Modified: php/php-src/trunk/NEWS
===
--- php/php-src/trunk/NEWS	2010-05-26 06:35:07 UTC (rev 299769)
+++ php/php-src/trunk/NEWS	2010-05-26 07:24:37 UTC (rev 299770)
@@ -42,6 +42,8 @@
 - Added scalar typehinting. (Ilia, Derick)
 - Added support for JSON_NUMERIC_CHECK option in json_encode() that converts
   numeric strings to integers. (Ilia)
+- Added support for object references in recursive serialize() calls. FR #36424.
+  (Mike)

 - default_charset if not specified is now UTF-8 instead of ISO-8859-1. (Rasmus)


Modified: php/php-src/trunk/ext/spl/spl_array.c
===
--- php/php-src/trunk/ext/spl/spl_array.c	2010-05-26 06:35:07 UTC (rev 299769)
+++ php/php-src/trunk/ext/spl/spl_array.c	2010-05-26 07:24:37 UTC (rev 299770)
@@ -59,23 +59,19 @@
 #define SPL_ARRAY_CLONE_MASK 0x0300

 typedef struct _spl_array_object {
-	zend_objectstd;
-	zval   *array;
-	zval   *retval;
-	HashPosition   pos;
-	ulong  pos_h;
-	intar_flags;
-	intis_self;
-	zend_function  *fptr_offset_get;
-	zend_function  *fptr_offset_set;
-	zend_function  *fptr_offset_has;
-	zend_function  *fptr_offset_del;
-	zend_function  *fptr_count;
-	zend_function  *fptr_serialize;
-	zend_function  *fptr_unserialize;
-	zend_class_entry   *ce_get_iterator;
-	php_serialize_data_t   *serialize_data;
-	php_unserialize_data_t *unserialize_data;
+	zend_object   std;
+	zval  *array;
+	zval  *retval;
+	HashPosition  pos;
+	ulong pos_h;
+	int   ar_flags;
+	int   is_self;
+	zend_function *fptr_offset_get;
+	zend_function *fptr_offset_set;
+	zend_function *fptr_offset_has;
+	zend_function *fptr_offset_del;
+	zend_function *fptr_count;
+	zend_class_entry* ce_get_iterator;
 	HashTable  *debug_info;
 } spl_array_object;

@@ -161,8 +157,6 @@
 /* }}} */

 zend_object_iterator *spl_array_get_iterator(zend_class_entry *ce, zval *object, int by_ref TSRMLS_DC);
-int spl_array_serialize(zval *object, unsigned char **buffer, zend_uint *buf_len, zend_serialize_data *data TSRMLS_DC);
-int spl_array_unserialize(zval **object, zend_class_entry *ce, const unsigned char *buf, zend_uint buf_len, zend_unserialize_data *data TSRMLS_DC);

 /* {{{ spl_array_object_new_ex */
 static zend_object_value spl_array_object_new_ex(zend_class_entry *class_type, spl_array_object **obj, zval *orig, int clone_orig TSRMLS_DC)
@@ -182,8 +176,6 @@
 	object_properties_init(intern-std, class_type);

 	intern-ar_flags = 0;
-	intern-serialize_data   = NULL;
-	intern-unserialize_data = NULL;
 	intern-debug_info   = NULL;
 	intern-ce_get_iterator = spl_ce_ArrayIterator;
 	if (orig) {
@@ -250,14 +242,6 @@
 		if (intern-fptr_count-common.scope == parent) {
 			intern-fptr_count = NULL;
 		}
-		zend_hash_find(class_type-function_table, serialize,sizeof(serialize),(void **) intern-fptr_serialize);
-		if (intern-fptr_serialize-common.scope == parent) {
-			intern-fptr_serialize = NULL;
-		}
-		zend_hash_find(class_type-function_table, unserialize,  sizeof(unserialize),  (void **) intern-fptr_unserialize);
-		if (intern-fptr_unserialize-common.scope == parent) {
-			intern-fptr_unserialize = NULL;
-		}
 	}
 	/* Cache iterator functions if ArrayIterator or derived. Check current's */
 	/* cache since only current is always required */
@@ -1567,27 +1551,35 @@
 }
 /* }}} */

-smart_str spl_array_serialize_helper(spl_array_object *intern, php_serialize_data_t *var_hash_p TSRMLS_DC) { /* {{{ */
+/* {{{ proto string ArrayObject::serialize()
+   Serialize the object */
+SPL_METHOD(Array, serialize)
+{
+	zval *object = getThis();
+	spl_array_object *intern = (spl_array_object*)zend_object_store_get_object(object TSRMLS_CC);
 	HashTable *aht = spl_array_get_hash_table(intern, 0 TSRMLS_CC);
 	zval members, *pmembers;
+	php_serialize_data_t var_hash;
 	smart_str 

[PHP-CVS] svn: /php/php-src/trunk/tests/classes/ type_hinting_003.phpt

2010-05-26 Thread Ilia Alshanetsky
iliaaWed, 26 May 2010 11:00:05 +

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

Log:
Fixed test

Changed paths:
U   php/php-src/trunk/tests/classes/type_hinting_003.phpt

Modified: php/php-src/trunk/tests/classes/type_hinting_003.phpt
===
--- php/php-src/trunk/tests/classes/type_hinting_003.phpt   2010-05-26 
10:30:03 UTC (rev 299778)
+++ php/php-src/trunk/tests/classes/type_hinting_003.phpt   2010-05-26 
11:00:05 UTC (rev 299779)
@@ -57,4 +57,4 @@
   int(25)
 }

-Catchable fatal error: Argument 1 passed to Test::f1() must be an array, 
integer given, called in %stype_hinting_003.php on line %d and defined in 
%stype_hinting_003.php on line %d
+Catchable fatal error: Argument 1 passed to Test::f1() must be of the type 
array, integer given, called in %s on line %d and defined in %s on line %d

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

[PHP-CVS] svn: /php/php-src/trunk/ext/mysqli/ mysqli_fe.c mysqli_nonapi.c php_mysqli_structs.h tests/mysqli_class_mysqli_interface.phpt tests/mysqli_get_cache_stats_off.phpt

2010-05-26 Thread Andrey Hristov
andrey   Wed, 26 May 2010 13:30:19 +

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

Log:
Remove a function that has no usage. The zval cache was disabled/removed
in 5.3.0-RC3.

Changed paths:
U   php/php-src/trunk/ext/mysqli/mysqli_fe.c
U   php/php-src/trunk/ext/mysqli/mysqli_nonapi.c
U   php/php-src/trunk/ext/mysqli/php_mysqli_structs.h
U   php/php-src/trunk/ext/mysqli/tests/mysqli_class_mysqli_interface.phpt
D   php/php-src/trunk/ext/mysqli/tests/mysqli_get_cache_stats_off.phpt

Modified: php/php-src/trunk/ext/mysqli/mysqli_fe.c
===
--- php/php-src/trunk/ext/mysqli/mysqli_fe.c2010-05-26 12:08:34 UTC (rev 
299781)
+++ php/php-src/trunk/ext/mysqli/mysqli_fe.c2010-05-26 13:30:19 UTC (rev 
299782)
@@ -91,7 +91,6 @@
PHP_FE(mysqli_field_tell,   
NULL)
PHP_FE(mysqli_free_result,  
NULL)
 #if defined(MYSQLI_USE_MYSQLND)
-   PHP_FE(mysqli_get_cache_stats,  
NULL)
PHP_FE(mysqli_get_connection_stats, 
NULL)
PHP_FE(mysqli_get_client_stats, 
NULL)
 #endif

Modified: php/php-src/trunk/ext/mysqli/mysqli_nonapi.c
===
--- php/php-src/trunk/ext/mysqli/mysqli_nonapi.c2010-05-26 12:08:34 UTC 
(rev 299781)
+++ php/php-src/trunk/ext/mysqli/mysqli_nonapi.c2010-05-26 13:30:19 UTC 
(rev 299782)
@@ -383,18 +383,6 @@
 /* }}} */


-/* {{{ proto array mysqli_cache_stats(void) U
-   Returns statistics about the zval cache */
-PHP_FUNCTION(mysqli_get_cache_stats)
-{
-   if (zend_parse_parameters_none() == FAILURE) {
-   return;
-   }
-   array_init(return_value);
-}
-/* }}} */
-
-
 /* {{{ proto array mysqli_get_client_stats(void)
Returns statistics about the zval cache */
 PHP_FUNCTION(mysqli_get_client_stats)

Modified: php/php-src/trunk/ext/mysqli/php_mysqli_structs.h
===
--- php/php-src/trunk/ext/mysqli/php_mysqli_structs.h   2010-05-26 12:08:34 UTC 
(rev 299781)
+++ php/php-src/trunk/ext/mysqli/php_mysqli_structs.h   2010-05-26 13:30:19 UTC 
(rev 299782)
@@ -391,7 +391,6 @@
longnum_inactive_persistent;
longmax_persistent;
longallow_persistent;
-   longcache_size;
unsigned long   default_port;
char*default_host;
char*default_user;
@@ -456,7 +455,6 @@
 PHP_FUNCTION(mysqli_field_seek);
 PHP_FUNCTION(mysqli_field_tell);
 PHP_FUNCTION(mysqli_free_result);
-PHP_FUNCTION(mysqli_get_cache_stats);
 PHP_FUNCTION(mysqli_get_client_stats);
 PHP_FUNCTION(mysqli_get_connection_stats);
 PHP_FUNCTION(mysqli_get_charset);

Modified: php/php-src/trunk/ext/mysqli/tests/mysqli_class_mysqli_interface.phpt
===
--- php/php-src/trunk/ext/mysqli/tests/mysqli_class_mysqli_interface.phpt   
2010-05-26 12:08:34 UTC (rev 299781)
+++ php/php-src/trunk/ext/mysqli/tests/mysqli_class_mysqli_interface.phpt   
2010-05-26 13:30:19 UTC (rev 299782)
@@ -59,7 +59,6 @@
);
if ($IS_MYSQLND) {
// mysqlnd only
-   /* $expected_methods['get_cache_stats'] = true; */
/* $expected_methods['get_client_stats']= true; */
$expected_methods['get_connection_stats']   = true;
$expected_methods['poll']   = true;

Deleted: php/php-src/trunk/ext/mysqli/tests/mysqli_get_cache_stats_off.phpt
===
--- php/php-src/trunk/ext/mysqli/tests/mysqli_get_cache_stats_off.phpt  
2010-05-26 12:08:34 UTC (rev 299781)
+++ php/php-src/trunk/ext/mysqli/tests/mysqli_get_cache_stats_off.phpt  
2010-05-26 13:30:19 UTC (rev 299782)
@@ -1,64 +0,0 @@
---TEST--
-mysqli_get_cache_stats() - disabled via php.ini
---INI--
-mysqlnd.collect_statistics=0
-mysqlnd.collect_memory_statistics=0
---SKIPIF--
-?PHP
-require_once('skipif.inc');
-require_once('skipifemb.inc');
-require_once('skipifconnectfailure.inc');
-if (!function_exists('mysqli_get_cache_stats')) {
-   die(skip only available with mysqlnd);
-}
-?
---FILE--
-?php
-   $before = mysqli_get_cache_stats();
-   if (!is_array($before) || empty($before)) {
-   printf([001] Expecting non-empty array, got %s.\n, 
gettype($before));
-   var_dump($before);
-   }
-
-   require_once('table.inc');
-   if (!$res = mysqli_query($link, SELECT id, label FROM test)) {
-   printf([002] [%d] %s\n, mysqli_errno($link), 

[PHP-CVS] svn: /php/php-src/ branches/PHP_5_3/ext/mysqli/tests/mysqli_get_client_stats.phpt trunk/ext/mysqli/tests/mysqli_get_client_stats.phpt

2010-05-26 Thread Andrey Hristov
andrey   Wed, 26 May 2010 13:36:49 +

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

Log:
Fix test

Changed paths:
U   
php/php-src/branches/PHP_5_3/ext/mysqli/tests/mysqli_get_client_stats.phpt
U   php/php-src/trunk/ext/mysqli/tests/mysqli_get_client_stats.phpt

Modified: 
php/php-src/branches/PHP_5_3/ext/mysqli/tests/mysqli_get_client_stats.phpt
===
--- php/php-src/branches/PHP_5_3/ext/mysqli/tests/mysqli_get_client_stats.phpt  
2010-05-26 13:30:19 UTC (rev 299782)
+++ php/php-src/branches/PHP_5_3/ext/mysqli/tests/mysqli_get_client_stats.phpt  
2010-05-26 13:36:49 UTC (rev 299783)
@@ -887,7 +887,7 @@
 mysqli_close($link);
 ?
 --EXPECTF--
-array(156) {
+array(158) {
   [%u|b%bytes_sent]=
   %unicode|string%(1) 0
   [%u|b%bytes_received]=
@@ -1020,32 +1020,36 @@
   %unicode|string%(1) 0
   [%u|b%mem_emalloc_count]=
   %unicode|string%(1) 0
-  [%u|b%mem_emalloc_ammount]=
+  [%u|b%mem_emalloc_amount]=
   %unicode|string%(1) 0
   [%u|b%mem_ecalloc_count]=
   %unicode|string%(1) 0
-  [%u|b%mem_ecalloc_ammount]=
+  [%u|b%mem_ecalloc_amount]=
   %unicode|string%(1) 0
   [%u|b%mem_erealloc_count]=
   %unicode|string%(1) 0
-  [%u|b%mem_erealloc_ammount]=
+  [%u|b%mem_erealloc_amount]=
   %unicode|string%(1) 0
   [%u|b%mem_efree_count]=
   %unicode|string%(1) 0
+  [%u|b%mem_efree_amount]=
+  %unicode|string%(1) 0
   [%u|b%mem_malloc_count]=
   %unicode|string%(1) 0
-  [%u|b%mem_malloc_ammount]=
+  [%u|b%mem_malloc_amount]=
   %unicode|string%(1) 0
   [%u|b%mem_calloc_count]=
   %unicode|string%(%d) %d
-  [%u|b%mem_calloc_ammount]=
+  [%u|b%mem_calloc_amount]=
   %unicode|string%(%d) %d
   [%u|b%mem_realloc_count]=
   %unicode|string%(1) 0
-  [%u|b%mem_realloc_ammount]=
+  [%u|b%mem_realloc_amount]=
   %unicode|string%(1) 0
   [%u|b%mem_free_count]=
   %unicode|string%(1) 0
+  [%u|b%mem_free_amount]=
+  %unicode|string%(1) 0
   [%u|b%mem_estrndup_count]=
   %unicode|string%(1) 0
   [%u|b%mem_strndup_count]=

Modified: php/php-src/trunk/ext/mysqli/tests/mysqli_get_client_stats.phpt
===
--- php/php-src/trunk/ext/mysqli/tests/mysqli_get_client_stats.phpt 
2010-05-26 13:30:19 UTC (rev 299782)
+++ php/php-src/trunk/ext/mysqli/tests/mysqli_get_client_stats.phpt 
2010-05-26 13:36:49 UTC (rev 299783)
@@ -887,7 +887,7 @@
 mysqli_close($link);
 ?
 --EXPECTF--
-array(156) {
+array(158) {
   [%u|b%bytes_sent]=
   %unicode|string%(1) 0
   [%u|b%bytes_received]=
@@ -1020,32 +1020,36 @@
   %unicode|string%(1) 0
   [%u|b%mem_emalloc_count]=
   %unicode|string%(1) 0
-  [%u|b%mem_emalloc_ammount]=
+  [%u|b%mem_emalloc_amount]=
   %unicode|string%(1) 0
   [%u|b%mem_ecalloc_count]=
   %unicode|string%(1) 0
-  [%u|b%mem_ecalloc_ammount]=
+  [%u|b%mem_ecalloc_amount]=
   %unicode|string%(1) 0
   [%u|b%mem_erealloc_count]=
   %unicode|string%(1) 0
-  [%u|b%mem_erealloc_ammount]=
+  [%u|b%mem_erealloc_amount]=
   %unicode|string%(1) 0
   [%u|b%mem_efree_count]=
   %unicode|string%(1) 0
+  [%u|b%mem_efree_amount]=
+  %unicode|string%(1) 0
   [%u|b%mem_malloc_count]=
   %unicode|string%(1) 0
-  [%u|b%mem_malloc_ammount]=
+  [%u|b%mem_malloc_amount]=
   %unicode|string%(1) 0
   [%u|b%mem_calloc_count]=
   %unicode|string%(%d) %d
-  [%u|b%mem_calloc_ammount]=
+  [%u|b%mem_calloc_amount]=
   %unicode|string%(%d) %d
   [%u|b%mem_realloc_count]=
   %unicode|string%(1) 0
-  [%u|b%mem_realloc_ammount]=
+  [%u|b%mem_realloc_amount]=
   %unicode|string%(1) 0
   [%u|b%mem_free_count]=
   %unicode|string%(1) 0
+  [%u|b%mem_free_amount]=
+  %unicode|string%(1) 0
   [%u|b%mem_estrndup_count]=
   %unicode|string%(1) 0
   [%u|b%mem_strndup_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.c trunk/ext/mysqlnd/mysqlnd.c

2010-05-26 Thread Andrey Hristov
andrey   Wed, 26 May 2010 13:47:43 +

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

Log:
Don't use conn-net without checking if it is NULL, because
it can be NULL in OOM conditions. This would cause a crash.

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

Modified: php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd.c
===
--- php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd.c  2010-05-26 13:38:05 UTC 
(rev 299784)
+++ php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd.c  2010-05-26 13:47:43 UTC 
(rev 299785)
@@ -125,7 +125,9 @@
conn-current_result = NULL;
}

-   conn-net-m.free_contents(conn-net TSRMLS_CC);
+   if (conn-net) {
+   conn-net-m.free_contents(conn-net TSRMLS_CC);
+   }

DBG_INF(Freeing memory of members);


Modified: php/php-src/trunk/ext/mysqlnd/mysqlnd.c
===
--- php/php-src/trunk/ext/mysqlnd/mysqlnd.c 2010-05-26 13:38:05 UTC (rev 
299784)
+++ php/php-src/trunk/ext/mysqlnd/mysqlnd.c 2010-05-26 13:47:43 UTC (rev 
299785)
@@ -125,7 +125,9 @@
conn-current_result = NULL;
}

-   conn-net-m.free_contents(conn-net TSRMLS_CC);
+   if (conn-net) {
+   conn-net-m.free_contents(conn-net TSRMLS_CC);
+   }

DBG_INF(Freeing memory of members);


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

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

2010-05-26 Thread Antony Dovgal
tony2001 Wed, 26 May 2010 15:14:43 +

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

Log:
merge FPM SAPI from trunk (as agreed with Johannes)

Changed paths:
U   php/php-src/branches/PHP_5_3/NEWS
A + php/php-src/branches/PHP_5_3/sapi/fpm/
(from php/php-src/trunk/sapi/fpm/:r299792)

Modified: php/php-src/branches/PHP_5_3/NEWS
===
--- php/php-src/branches/PHP_5_3/NEWS   2010-05-26 15:10:43 UTC (rev 299793)
+++ php/php-src/branches/PHP_5_3/NEWS   2010-05-26 15:14:43 UTC (rev 299794)
@@ -16,6 +16,7 @@
   (string $iv) to use non-NULL IV.
   Made implicit use of NULL IV a warning. (Sara)
 - Added openssl_cipher_iv_length(). (Sara)
+- Merged FPM SAPI from trunk. (Tony)

 - Changed namespaced classes so that the ctor can only be named
   __construct now. (Stas)

-- 
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-26 Thread Dmitry Stogov
dmitry   Wed, 26 May 2010 15:42:59 +

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

Log:
Conditional compilation is replaced by macro

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-26 15:26:10 UTC (rev 299795)
+++ php/php-src/trunk/Zend/zend_API.c   2010-05-26 15:42:59 UTC (rev 299796)
@@ -1043,11 +1043,7 @@
) {
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
+   CE_STATIC_MEMBERS(class_type)[i] = *p;
} else {
zval *r;

@@ -1055,11 +1051,7 @@
*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
+   CE_STATIC_MEMBERS(class_type)[i] = r;
}
}
}

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

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

2010-05-26 Thread Pierrick Charron
pierrick Wed, 26 May 2010 16:17:15 +

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

Log:
Remove unused variable

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

Modified: php/php-src/trunk/ext/reflection/php_reflection.c
===
--- php/php-src/trunk/ext/reflection/php_reflection.c   2010-05-26 15:42:59 UTC 
(rev 299796)
+++ php/php-src/trunk/ext/reflection/php_reflection.c   2010-05-26 16:17:15 UTC 
(rev 299797)
@@ -4735,7 +4735,6 @@
zval **variable_ptr;
zval *object, name;
zval *value;
-   int setter_done = 0;
zval *tmp;

METHOD_NOTSTATIC(reflection_property_ptr);

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