[PHP-CVS] cvs: php-src(PHP_5_2) /ext/standard array.c

2009-05-15 Thread Moriyoshi Koizumi
moriyoshi   Fri May 15 17:03:43 2009 UTC

  Modified files:  (Branch: PHP_5_2)
/php-src/ext/standard   array.c 
  Log:
  - MFH: Roll it back.
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/array.c?r1=1.308.2.21.2.66r2=1.308.2.21.2.67diff_format=u
Index: php-src/ext/standard/array.c
diff -u php-src/ext/standard/array.c:1.308.2.21.2.66 
php-src/ext/standard/array.c:1.308.2.21.2.67
--- php-src/ext/standard/array.c:1.308.2.21.2.66Sun May 10 16:45:01 2009
+++ php-src/ext/standard/array.cFri May 15 17:03:43 2009
@@ -21,7 +21,7 @@
+--+
 */
 
-/* $Id: array.c,v 1.308.2.21.2.66 2009/05/10 16:45:01 colder Exp $ */
+/* $Id: array.c,v 1.308.2.21.2.67 2009/05/15 17:03:43 moriyoshi Exp $ */
 
 #include php.h
 #include php_ini.h
@@ -2839,7 +2839,7 @@
};
struct bucketindex *arTmp, *cmpdata, *lastkept;
unsigned int i;
-   long sort_type = SORT_REGULAR;
+   long sort_type = SORT_STRING;
 
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, Z|l, array, 
sort_type) == FAILURE) {
return;



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



[PHP-CVS] cvs: php-src(PHP_5_2) /ext/standard array.c

2009-02-12 Thread Moriyoshi Koizumi
moriyoshi   Thu Feb 12 18:30:32 2009 UTC

  Modified files:  (Branch: PHP_5_2)
/php-src/ext/standard   array.c 
  Log:
  * MFH: Fix bug #47370 (BC breakage of array_unique())
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/array.c?r1=1.308.2.21.2.63r2=1.308.2.21.2.64diff_format=u
Index: php-src/ext/standard/array.c
diff -u php-src/ext/standard/array.c:1.308.2.21.2.63 
php-src/ext/standard/array.c:1.308.2.21.2.64
--- php-src/ext/standard/array.c:1.308.2.21.2.63Wed Dec 31 11:17:44 2008
+++ php-src/ext/standard/array.cThu Feb 12 18:30:31 2009
@@ -21,7 +21,7 @@
+--+
 */
 
-/* $Id: array.c,v 1.308.2.21.2.63 2008/12/31 11:17:44 sebastian Exp $ */
+/* $Id: array.c,v 1.308.2.21.2.64 2009/02/12 18:30:31 moriyoshi Exp $ */
 
 #include php.h
 #include php_ini.h
@@ -2839,7 +2839,7 @@
};
struct bucketindex *arTmp, *cmpdata, *lastkept;
unsigned int i;
-   long sort_type = SORT_REGULAR;
+   long sort_type = SORT_STRING;
 
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, Z|l, array, 
sort_type) == FAILURE) {
return;



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



[PHP-CVS] cvs: php-src(PHP_5_2) /ext/standard array.c

2008-12-25 Thread Felipe Pena
felipe  Thu Dec 25 11:05:20 2008 UTC

  Modified files:  (Branch: PHP_5_2)
/php-src/ext/standard   array.c 
  Log:
  - Fixed BC in array_unique (HASH_OF stuff), warning and CS in another part
  
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/array.c?r1=1.308.2.21.2.60r2=1.308.2.21.2.61diff_format=u
Index: php-src/ext/standard/array.c
diff -u php-src/ext/standard/array.c:1.308.2.21.2.60 
php-src/ext/standard/array.c:1.308.2.21.2.61
--- php-src/ext/standard/array.c:1.308.2.21.2.60Sat Dec 13 00:38:29 2008
+++ php-src/ext/standard/array.cThu Dec 25 11:05:19 2008
@@ -21,7 +21,7 @@
+--+
 */
 
-/* $Id: array.c,v 1.308.2.21.2.60 2008/12/13 00:38:29 andrei Exp $ */
+/* $Id: array.c,v 1.308.2.21.2.61 2008/12/25 11:05:19 felipe Exp $ */
 
 #include php.h
 #include php_ini.h
@@ -1998,7 +1998,7 @@
zval **stack,   /* Input stack */
 **val; /* Value to be popped */
char *key = NULL;
-   int key_len = 0;
+   uint key_len = 0;
ulong index;

/* Get the arguments and do error-checking */
@@ -2016,10 +2016,11 @@
}

/* Get the first or last value and copy it into the return value */
-   if (off_the_end)
+   if (off_the_end) {
zend_hash_internal_pointer_end(Z_ARRVAL_PP(stack));
-   else
+   } else {
zend_hash_internal_pointer_reset(Z_ARRVAL_PP(stack));
+   }
zend_hash_get_current_data(Z_ARRVAL_PP(stack), (void **)val);
RETVAL_ZVAL(*val, 1, 0);

@@ -2817,7 +2818,8 @@
Removes duplicate values from array */
 PHP_FUNCTION(array_unique)
 {
-   zval *array, *tmp;
+   zval **array, *tmp;
+   HashTable *target_hash;
Bucket *p;
struct bucketindex {
Bucket *b;
@@ -2827,25 +2829,30 @@
unsigned int i;
long sort_type = SORT_REGULAR;
 
-   if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, a|l, array, 
sort_type) == FAILURE) {
+   if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, Z|l, array, 
sort_type) == FAILURE) {
return;
}
+   target_hash = HASH_OF(*array);
+   if (!target_hash) {
+   php_error_docref(NULL TSRMLS_CC, E_WARNING, The argument 
should be an array);
+   RETURN_FALSE;
+   }
 
set_compare_func(sort_type TSRMLS_CC);
 
array_init(return_value);
-   zend_hash_copy(Z_ARRVAL_P(return_value), Z_ARRVAL_P(array), 
(copy_ctor_func_t) zval_add_ref, (void *)tmp, sizeof(zval*));
+   zend_hash_copy(Z_ARRVAL_P(return_value), target_hash, 
(copy_ctor_func_t) zval_add_ref, (void *)tmp, sizeof(zval*));
 
-   if (Z_ARRVAL_P(array)-nNumOfElements = 1) {   /* nothing to do */
+   if (target_hash-nNumOfElements = 1) { /* nothing to do */
return;
}
 
/* create and sort array with pointers to the target_hash buckets */
-   arTmp = (struct bucketindex *) 
pemalloc((Z_ARRVAL_P(array)-nNumOfElements + 1) * sizeof(struct bucketindex), 
Z_ARRVAL_P(array)-persistent);
+   arTmp = (struct bucketindex *) pemalloc((target_hash-nNumOfElements + 
1) * sizeof(struct bucketindex), target_hash-persistent);
if (!arTmp) {
RETURN_FALSE;
}
-   for (i = 0, p = Z_ARRVAL_P(array)-pListHead; p; i++, p = p-pListNext) 
{
+   for (i = 0, p = target_hash-pListHead; p; i++, p = p-pListNext) {
arTmp[i].b = p;
arTmp[i].i = i;
}
@@ -2875,7 +2882,7 @@
}
}
}
-   pefree(arTmp, Z_ARRVAL_P(array)-persistent);
+   pefree(arTmp, target_hash-persistent);
 }
 /* }}} */
 



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



[PHP-CVS] cvs: php-src(PHP_5_2) /ext/standard array.c

2008-05-30 Thread Matt Wilmas
mattwil Fri May 30 10:55:44 2008 UTC

  Modified files:  (Branch: PHP_5_2)
/php-src/ext/standard   array.c 
  Log:
  MFH: Only check args once in php_array_diff_key/intersect_key, not on each 
iteration. This also makes sure ALL args are checked (pre-5.2.5 behavior)
  
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/array.c?r1=1.308.2.21.2.56r2=1.308.2.21.2.57diff_format=u
Index: php-src/ext/standard/array.c
diff -u php-src/ext/standard/array.c:1.308.2.21.2.56 
php-src/ext/standard/array.c:1.308.2.21.2.57
--- php-src/ext/standard/array.c:1.308.2.21.2.56Sun May 18 21:50:58 2008
+++ php-src/ext/standard/array.cFri May 30 10:55:44 2008
@@ -21,7 +21,7 @@
+--+
 */
 
-/* $Id: array.c,v 1.308.2.21.2.56 2008/05/18 21:50:58 felipe Exp $ */
+/* $Id: array.c,v 1.308.2.21.2.57 2008/05/30 10:55:44 mattwil Exp $ */
 
 #include php.h
 #include php_ini.h
@@ -2992,10 +2992,12 @@
intersect_data_compare_func = zval_compare;
}
 
-   if (Z_TYPE_PP(args[0]) != IS_ARRAY) {
-   php_error_docref(NULL TSRMLS_CC, E_WARNING, Argument #1 is not 
an array);
-   RETVAL_NULL();
-   goto out;
+   for (i = 0; i  argc; i++) {
+   if (Z_TYPE_PP(args[i]) != IS_ARRAY) {
+   php_error_docref(NULL TSRMLS_CC, E_WARNING, Argument 
#%d is not an array, i + 1);
+   RETVAL_NULL();
+   goto out;
+   }
}
 
array_init(return_value);
@@ -3004,12 +3006,7 @@
if (p-nKeyLength == 0) {
ok = 1;
for (i = 1; i  argc; i++) {
-   if (Z_TYPE_PP(args[i]) != IS_ARRAY) {
-   php_error_docref(NULL TSRMLS_CC, 
E_WARNING, Argument #%d is not an array, i + 1);
-   zval_dtor(return_value);
-   RETVAL_NULL();
-   goto out;
-   } else if 
(zend_hash_index_find(Z_ARRVAL_PP(args[i]), p-h, (void**)data) == FAILURE ||
+   if (zend_hash_index_find(Z_ARRVAL_PP(args[i]), 
p-h, (void**)data) == FAILURE ||
(intersect_data_compare_func 
 
intersect_data_compare_func((zval**)p-pData, data TSRMLS_CC) != 0)) {
ok = 0;
@@ -3023,12 +3020,7 @@
} else {
ok = 1;
for (i = 1; i  argc; i++) {
-   if (Z_TYPE_PP(args[i]) != IS_ARRAY) {
-   php_error_docref(NULL TSRMLS_CC, 
E_WARNING, Argument #%d is not an array, i + 1);
-   zval_dtor(return_value);
-   RETVAL_NULL();
-   goto out;
-   } else if 
(zend_hash_quick_find(Z_ARRVAL_PP(args[i]), p-arKey, p-nKeyLength, p-h, 
(void**)data) == FAILURE ||
+   if (zend_hash_quick_find(Z_ARRVAL_PP(args[i]), 
p-arKey, p-nKeyLength, p-h, (void**)data) == FAILURE ||
(intersect_data_compare_func 
 
intersect_data_compare_func((zval**)p-pData, data TSRMLS_CC) != 0)) {
ok = 0;
@@ -3470,10 +3462,12 @@
diff_data_compare_func = zval_compare;
}
 
-   if (Z_TYPE_PP(args[0]) != IS_ARRAY) {
-   php_error_docref(NULL TSRMLS_CC, E_WARNING, Argument #1 is not 
an array);
-   RETVAL_NULL();
-   goto out;
+   for (i = 0; i  argc; i++) {
+   if (Z_TYPE_PP(args[i]) != IS_ARRAY) {
+   php_error_docref(NULL TSRMLS_CC, E_WARNING, Argument 
#%d is not an array, i + 1);
+   RETVAL_NULL();
+   goto out;
+   }
}

array_init(return_value);
@@ -3482,12 +3476,7 @@
if (p-nKeyLength == 0) {
ok = 1;
for (i = 1; i  argc; i++) {
-   if (Z_TYPE_PP(args[i]) != IS_ARRAY) {
-   php_error_docref(NULL TSRMLS_CC, 
E_WARNING, Argument #%d is not an array, i + 1);
-   zval_dtor(return_value);
-   RETVAL_NULL();
-   goto out;
-   } else if 
(zend_hash_index_find(Z_ARRVAL_PP(args[i]), p-h, (void**)data) == SUCCESS 
+   if (zend_hash_index_find(Z_ARRVAL_PP(args[i]), 
p-h, (void**)data) == SUCCESS 
(!diff_data_compare_func ||

[PHP-CVS] cvs: php-src(PHP_5_2) /ext/standard array.c basic_functions.c

2008-05-18 Thread Felipe Pena
felipe  Sun May 18 21:50:58 2008 UTC

  Modified files:  (Branch: PHP_5_2)
/php-src/ext/standard   array.c basic_functions.c 
  Log:
  - MFB: Making compatible with 64bit platform
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/array.c?r1=1.308.2.21.2.55r2=1.308.2.21.2.56diff_format=u
Index: php-src/ext/standard/array.c
diff -u php-src/ext/standard/array.c:1.308.2.21.2.55 
php-src/ext/standard/array.c:1.308.2.21.2.56
--- php-src/ext/standard/array.c:1.308.2.21.2.55Wed Mar 12 19:13:00 2008
+++ php-src/ext/standard/array.cSun May 18 21:50:58 2008
@@ -21,7 +21,7 @@
+--+
 */
 
-/* $Id: array.c,v 1.308.2.21.2.55 2008/03/12 19:13:00 felipe Exp $ */
+/* $Id: array.c,v 1.308.2.21.2.56 2008/05/18 21:50:58 felipe Exp $ */
 
 #include php.h
 #include php_ini.h
@@ -2250,7 +2250,7 @@
/* ..and the length */
if (length  0) {
length = num_in - offset + length;
-   } else if (((unsigned) offset + (unsigned) length)  (unsigned) num_in) 
{
+   } else if (((unsigned long) offset + (unsigned long) length)  
(unsigned) num_in) {
length = num_in - offset;
}
 
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/basic_functions.c?r1=1.725.2.31.2.71r2=1.725.2.31.2.72diff_format=u
Index: php-src/ext/standard/basic_functions.c
diff -u php-src/ext/standard/basic_functions.c:1.725.2.31.2.71 
php-src/ext/standard/basic_functions.c:1.725.2.31.2.72
--- php-src/ext/standard/basic_functions.c:1.725.2.31.2.71  Mon May 12 
08:47:29 2008
+++ php-src/ext/standard/basic_functions.c  Sun May 18 21:50:58 2008
@@ -17,7 +17,7 @@
+--+
  */
 
-/* $Id: basic_functions.c,v 1.725.2.31.2.71 2008/05/12 08:47:29 tony2001 Exp $ 
*/
+/* $Id: basic_functions.c,v 1.725.2.31.2.72 2008/05/18 21:50:58 felipe Exp $ */
 
 #include php.h
 #include php_streams.h
@@ -3859,9 +3859,17 @@
SetEnvironmentVariable(pe-key, bugbug);
 #endif
putenv(pe-previous_value);
+ basic_functions.c
+#if defined(PHP_WIN32) || (defined (__FreeBSD__)  (__FreeBSD__  7))
+===
 # if defined(PHP_WIN32)
+ 1.725.2.31.2.71
efree(pe-previous_value);
+ basic_functions.c
+#endif
+===
 # endif
+ 1.725.2.31.2.71
} else {
 # if HAVE_UNSETENV
unsetenv(pe-key);
@@ -4461,8 +4469,13 @@
pe.previous_value = NULL;
for (env = environ; env != NULL  *env != NULL; env++) {
if (!strncmp(*env, pe.key, pe.key_len)  
(*env)[pe.key_len] == '=') {  /* found it */
+ basic_functions.c
+#if defined(PHP_WIN32) || (defined (__FreeBSD__)  (__FreeBSD__  7))
+   /* must copy previous value because putenv can 
free the string without notice */
+===
 #if defined(PHP_WIN32)
/* must copy previous value because MSVCRT's 
putenv can free the string without notice */
+ 1.725.2.31.2.71
pe.previous_value = estrdup(*env);
 #else
pe.previous_value = *env;



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



Re: [PHP-CVS] cvs: php-src(PHP_5_2) /ext/standard array.c basic_functions.c

2008-05-18 Thread Hannes Magnusson
On Sun, May 18, 2008 at 11:50 PM, Felipe Pena [EMAIL PROTECTED] wrote:
 felipe  Sun May 18 21:50:58 2008 UTC

  Modified files:  (Branch: PHP_5_2)
/php-src/ext/standard   array.c basic_functions.c
  Log:
  - MFB: Making compatible with 64bit platform
 http://cvs.php.net/viewvc.cgi/php-src/ext/standard/basic_functions.c?r1=1.725.2.31.2.71r2=1.725.2.31.2.72diff_format=u
 Index: php-src/ext/standard/basic_functions.c
 diff -u php-src/ext/standard/basic_functions.c:1.725.2.31.2.71 
 php-src/ext/standard/basic_functions.c:1.725.2.31.2.72
 --- php-src/ext/standard/basic_functions.c:1.725.2.31.2.71  Mon May 12 
 08:47:29 2008
 +++ php-src/ext/standard/basic_functions.c  Sun May 18 21:50:58 2008
 @@ -17,7 +17,7 @@
+--+
  */

 -/* $Id: basic_functions.c,v 1.725.2.31.2.71 2008/05/12 08:47:29 tony2001 Exp 
 $ */
 +/* $Id: basic_functions.c,v 1.725.2.31.2.72 2008/05/18 21:50:58 felipe Exp $ 
 */

  #include php.h
  #include php_streams.h
 @@ -3859,9 +3859,17 @@
SetEnvironmentVariable(pe-key, bugbug);
  #endif
putenv(pe-previous_value);
 + basic_functions.c
 +#if defined(PHP_WIN32) || (defined (__FreeBSD__)  (__FreeBSD__  7))
 +===
  # if defined(PHP_WIN32)
 + 1.725.2.31.2.71
efree(pe-previous_value);
 + basic_functions.c
 +#endif
 +===
  # endif
 + 1.725.2.31.2.71
} else {
  # if HAVE_UNSETENV
unsetenv(pe-key);
 @@ -4461,8 +4469,13 @@
pe.previous_value = NULL;
for (env = environ; env != NULL  *env != NULL; env++) {
if (!strncmp(*env, pe.key, pe.key_len)  
 (*env)[pe.key_len] == '=') {  /* found it */
 + basic_functions.c
 +#if defined(PHP_WIN32) || (defined (__FreeBSD__)  (__FreeBSD__  7))
 +   /* must copy previous value because putenv 
 can free the string without notice */
 +===
  #if defined(PHP_WIN32)
/* must copy previous value because MSVCRT's 
 putenv can free the string without notice */
 + 1.725.2.31.2.71

Multiple cvs conflict alert..

-Hannes

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



Re: [PHP-CVS] cvs: php-src(PHP_5_2) /ext/standard array.c basic_functions.c

2008-05-18 Thread Felipe Pena
Em Seg, 2008-05-19 às 00:16 +0200, Hannes Magnusson escreveu:
 On Sun, May 18, 2008 at 11:50 PM, Felipe Pena [EMAIL PROTECTED] wrote:
  felipe  Sun May 18 21:50:58 2008 UTC
 
   Modified files:  (Branch: PHP_5_2)
 /php-src/ext/standard   array.c basic_functions.c
   Log:
   - MFB: Making compatible with 64bit platform
  http://cvs.php.net/viewvc.cgi/php-src/ext/standard/basic_functions.c?r1=1.725.2.31.2.71r2=1.725.2.31.2.72diff_format=u
  Index: php-src/ext/standard/basic_functions.c
  diff -u php-src/ext/standard/basic_functions.c:1.725.2.31.2.71 
  php-src/ext/standard/basic_functions.c:1.725.2.31.2.72
  --- php-src/ext/standard/basic_functions.c:1.725.2.31.2.71  Mon May 12 
  08:47:29 2008
  +++ php-src/ext/standard/basic_functions.c  Sun May 18 21:50:58 2008
  @@ -17,7 +17,7 @@
 +--+
   */
 
  -/* $Id: basic_functions.c,v 1.725.2.31.2.71 2008/05/12 08:47:29 tony2001 
  Exp $ */
  +/* $Id: basic_functions.c,v 1.725.2.31.2.72 2008/05/18 21:50:58 felipe Exp 
  $ */
 
   #include php.h
   #include php_streams.h
  @@ -3859,9 +3859,17 @@
 SetEnvironmentVariable(pe-key, bugbug);
   #endif
 putenv(pe-previous_value);
  + basic_functions.c
  +#if defined(PHP_WIN32) || (defined (__FreeBSD__)  (__FreeBSD__  7))
  +===
   # if defined(PHP_WIN32)
  + 1.725.2.31.2.71
 efree(pe-previous_value);
  + basic_functions.c
  +#endif
  +===
   # endif
  + 1.725.2.31.2.71
 } else {
   # if HAVE_UNSETENV
 unsetenv(pe-key);
  @@ -4461,8 +4469,13 @@
 pe.previous_value = NULL;
 for (env = environ; env != NULL  *env != NULL; env++) {
 if (!strncmp(*env, pe.key, pe.key_len)  
  (*env)[pe.key_len] == '=') {  /* found it */
  + basic_functions.c
  +#if defined(PHP_WIN32) || (defined (__FreeBSD__)  (__FreeBSD__  7))
  +   /* must copy previous value because putenv 
  can free the string without notice */
  +===
   #if defined(PHP_WIN32)
 /* must copy previous value because MSVCRT's 
  putenv can free the string without notice */
  + 1.725.2.31.2.71
 
 Multiple cvs conflict alert..

Ops, the 'basic_functions.c' was accidentally.

Thanks.

 
 -Hannes
-- 
Regards,
Felipe Pena.


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



[PHP-CVS] cvs: php-src(PHP_5_2) /ext/standard array.c

2008-02-15 Thread Antony Dovgal
tony2001Fri Feb 15 09:33:26 2008 UTC

  Modified files:  (Branch: PHP_5_2)
/php-src/ext/standard   array.c 
  Log:
  MFH: recursion protection in count()
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/array.c?r1=1.308.2.21.2.52r2=1.308.2.21.2.53diff_format=u
Index: php-src/ext/standard/array.c
diff -u php-src/ext/standard/array.c:1.308.2.21.2.52 
php-src/ext/standard/array.c:1.308.2.21.2.53
--- php-src/ext/standard/array.c:1.308.2.21.2.52Thu Feb 14 14:02:02 2008
+++ php-src/ext/standard/array.cFri Feb 15 09:33:26 2008
@@ -21,7 +21,7 @@
+--+
 */
 
-/* $Id: array.c,v 1.308.2.21.2.52 2008/02/14 14:02:02 felipe Exp $ */
+/* $Id: array.c,v 1.308.2.21.2.53 2008/02/15 09:33:26 tony2001 Exp $ */
 
 #include php.h
 #include php_ini.h
@@ -283,6 +283,11 @@
zval **element;
 
if (Z_TYPE_P(array) == IS_ARRAY) {
+   if (Z_ARRVAL_P(array)-nApplyCount  1) {
+   php_error_docref(NULL TSRMLS_CC, E_WARNING, recursion 
detected);
+   return 0;
+   }
+
cnt = zend_hash_num_elements(Z_ARRVAL_P(array));
if (mode == COUNT_RECURSIVE) {
HashPosition pos;
@@ -290,7 +295,9 @@
for 
(zend_hash_internal_pointer_reset_ex(Z_ARRVAL_P(array), pos);
 
zend_hash_get_current_data_ex(Z_ARRVAL_P(array), (void **) element, pos) == 
SUCCESS;
 zend_hash_move_forward_ex(Z_ARRVAL_P(array), 
pos)) {
+   Z_ARRVAL_P(array)-nApplyCount++;
cnt += php_count_recursive(*element, 
COUNT_RECURSIVE TSRMLS_CC);
+   Z_ARRVAL_P(array)-nApplyCount--;
}
}
}

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



[PHP-CVS] cvs: php-src(PHP_5_2) /ext/standard array.c /ext/standard/tests/array array_push_variation4.phpt

2008-02-14 Thread Dmitry Stogov
dmitry  Thu Feb 14 08:46:08 2008 UTC

  Modified files:  (Branch: PHP_5_2)
/php-src/ext/standard   array.c 
/php-src/ext/standard/tests/array   array_push_variation4.phpt 
  Log:
  Fixed memory leak
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/array.c?r1=1.308.2.21.2.50r2=1.308.2.21.2.51diff_format=u
Index: php-src/ext/standard/array.c
diff -u php-src/ext/standard/array.c:1.308.2.21.2.50 
php-src/ext/standard/array.c:1.308.2.21.2.51
--- php-src/ext/standard/array.c:1.308.2.21.2.50Tue Feb 12 12:47:30 2008
+++ php-src/ext/standard/array.cThu Feb 14 08:46:08 2008
@@ -21,7 +21,7 @@
+--+
 */
 
-/* $Id: array.c,v 1.308.2.21.2.50 2008/02/12 12:47:30 felipe Exp $ */
+/* $Id: array.c,v 1.308.2.21.2.51 2008/02/14 08:46:08 dmitry Exp $ */
 
 #include php.h
 #include php_ini.h
@@ -1975,6 +1975,7 @@
new_var-refcount++;

if (zend_hash_next_index_insert(Z_ARRVAL_P(stack), new_var, 
sizeof(zval *), NULL) == FAILURE) {
+   new_var-refcount--;
php_error_docref(NULL TSRMLS_CC, E_WARNING, Cannot add 
element to the array as the next element is already occupied);
efree(args);
RETURN_FALSE;
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/array/array_push_variation4.phpt?r1=1.1.2.1r2=1.1.2.2diff_format=u
Index: php-src/ext/standard/tests/array/array_push_variation4.phpt
diff -u php-src/ext/standard/tests/array/array_push_variation4.phpt:1.1.2.1 
php-src/ext/standard/tests/array/array_push_variation4.phpt:1.1.2.2
--- php-src/ext/standard/tests/array/array_push_variation4.phpt:1.1.2.1 Wed Feb 
13 16:10:42 2008
+++ php-src/ext/standard/tests/array/array_push_variation4.phpt Thu Feb 14 
08:46:08 2008
@@ -32,6 +32,9 @@
 var_dump(array_push($array, $array));
 var_dump($array);
 
+/* break cycle */
+$array[9] = null;
+
 echo Done;
 ?
 --EXPECTF--

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



[PHP-CVS] cvs: php-src(PHP_5_2) /ext/standard array.c

2008-02-12 Thread Felipe Pena
felipe  Tue Feb 12 12:47:30 2008 UTC

  Modified files:  (Branch: PHP_5_2)
/php-src/ext/standard   array.c 
  Log:
  MFB: array_slice() - Fixed behavior when NULL is given in third parameter (BC)
  
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/array.c?r1=1.308.2.21.2.49r2=1.308.2.21.2.50diff_format=u
Index: php-src/ext/standard/array.c
diff -u php-src/ext/standard/array.c:1.308.2.21.2.49 
php-src/ext/standard/array.c:1.308.2.21.2.50
--- php-src/ext/standard/array.c:1.308.2.21.2.49Tue Feb  5 16:01:21 2008
+++ php-src/ext/standard/array.cTue Feb 12 12:47:30 2008
@@ -21,7 +21,7 @@
+--+
 */
 
-/* $Id: array.c,v 1.308.2.21.2.49 2008/02/05 16:01:21 iliaa Exp $ */
+/* $Id: array.c,v 1.308.2.21.2.50 2008/02/12 12:47:30 felipe Exp $ */
 
 #include php.h
 #include php_ini.h
@@ -2202,9 +2202,10 @@
 PHP_FUNCTION(array_slice)
 {
zval *input,/* Input array */
+   **z_length, /* How many elements to get */
**entry;/* An array entry */
long offset,/* Offset to get elements from */
-length = NULL; /* How many elements to get */
+length = 0;
zend_bool preserve_keys = 0; /* Whether to preserve keys while copying 
to the new array or not */
int  num_in,/* Number of elements in the 
input array */
 pos;   /* Current position in the 
array */
@@ -2213,7 +2214,7 @@
ulong num_key;
HashPosition hpos;
 
-   if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, al|lb, input, 
offset, length, preserve_keys) == FAILURE) {
+   if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, al|Zb, input, 
offset, z_length, preserve_keys) == FAILURE) {
return;
}
 
@@ -2221,8 +,11 @@
num_in = zend_hash_num_elements(Z_ARRVAL_P(input));
 
/* We want all entries from offset to the end if length is not passed 
or is null */
-   if (length == NULL) {
+   if (ZEND_NUM_ARGS()  3 || Z_TYPE_PP(z_length) == IS_NULL) {
length = num_in;
+   } else {
+   convert_to_long_ex(z_length);
+   length = Z_LVAL_PP(z_length);
}
 
/* Initialize returned array */

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



[PHP-CVS] cvs: php-src(PHP_5_2) /ext/standard array.c /ext/standard/tests/array bug42850.phpt

2008-01-14 Thread Brian Shire
shire   Mon Jan 14 22:10:09 2008 UTC

  Added files: (Branch: PHP_5_2)
/php-src/ext/standard/tests/array   bug42850.phpt 

  Modified files:  
/php-src/ext/standard   array.c 
  Log:
  MFH: Fix bug #42850 array_walk_recursive() leaves references, refix bug #34982
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/array.c?r1=1.308.2.21.2.46r2=1.308.2.21.2.47diff_format=u
Index: php-src/ext/standard/array.c
diff -u php-src/ext/standard/array.c:1.308.2.21.2.46 
php-src/ext/standard/array.c:1.308.2.21.2.47
--- php-src/ext/standard/array.c:1.308.2.21.2.46Mon Dec 31 07:20:12 2007
+++ php-src/ext/standard/array.cMon Jan 14 22:10:08 2008
@@ -21,7 +21,7 @@
+--+
 */
 
-/* $Id: array.c,v 1.308.2.21.2.46 2007/12/31 07:20:12 sebastian Exp $ */
+/* $Id: array.c,v 1.308.2.21.2.47 2008/01/14 22:10:08 shire Exp $ */
 
 #include php.h
 #include php_ini.h
@@ -1077,7 +1077,7 @@
if (recursive  Z_TYPE_PP(args[0]) == IS_ARRAY) {
HashTable *thash;

-   SEPARATE_ZVAL_TO_MAKE_IS_REF(args[0]);
+   SEPARATE_ZVAL_IF_NOT_REF(args[0]);
thash = HASH_OF(*(args[0]));
if (thash-nApplyCount  1) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, 
recursion detected);

http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/array/bug42850.phpt?view=markuprev=1.1
Index: php-src/ext/standard/tests/array/bug42850.phpt
+++ php-src/ext/standard/tests/array/bug42850.phpt
--TEST--
Bug #42850 array_walk_recursive() leaves references, #34982 
array_walk_recursive() modifies elements outside function scope 
--FILE--
?php

// Bug #42850
$data = array ('key1' = 'val1', array('key2' = 'val2'));
function apply_dumb($item, $key) {}; 
var_dump($data);
array_walk_recursive($data, 'apply_dumb');
$data2 = $data;
$data2[0] = 'altered';
var_dump($data);
var_dump($data2);

// Bug #34982
function myfunc($data) {
array_walk_recursive($data, 'apply_changed');
}
function apply_changed($input, $key) {
$input = 'changed';
}
myfunc($data);
var_dump($data);

--EXPECT--
array(2) {
  [key1]=
  string(4) val1
  [0]=
  array(1) {
[key2]=
string(4) val2
  }
}
array(2) {
  [key1]=
  string(4) val1
  [0]=
  array(1) {
[key2]=
string(4) val2
  }
}
array(2) {
  [key1]=
  string(4) val1
  [0]=
  string(7) altered
}
array(2) {
  [key1]=
  string(4) val1
  [0]=
  array(1) {
[key2]=
string(4) val2
  }
}
--UEXPECT--
array(2) {
  [ukey1]=
  unicode(4) val1
  [0]=
  array(1) {
[ukey2]=
unicode(4) val2
  }
}
array(2) {
  [ukey1]=
  unicode(4) val1
  [0]=
  array(1) {
[ukey2]=
unicode(4) val2
  }
}
array(2) {
  [ukey1]=
  unicode(4) val1
  [0]=
  unicode(7) altered
}
array(2) {
  [ukey1]=
  unicode(4) val1
  [0]=
  array(1) {
[ukey2]=
unicode(4) val2
  }
}

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



[PHP-CVS] cvs: php-src(PHP_5_2) /ext/standard array.c /ext/standard/tests/array max.phpt min.phpt /ext/standard/tests/file fgetc_basic.phpt fgetc_variation4.phpt

2007-10-31 Thread Jani Taskinen
janiWed Oct 31 13:39:15 2007 UTC

  Modified files:  (Branch: PHP_5_2)
/php-src/ext/standard   array.c 
/php-src/ext/standard/tests/array   max.phpt min.phpt 
/php-src/ext/standard/tests/filefgetc_basic.phpt 
fgetc_variation4.phpt 
  Log:
  MFH: fix typo
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/array.c?r1=1.308.2.21.2.40r2=1.308.2.21.2.41diff_format=u
Index: php-src/ext/standard/array.c
diff -u php-src/ext/standard/array.c:1.308.2.21.2.40 
php-src/ext/standard/array.c:1.308.2.21.2.41
--- php-src/ext/standard/array.c:1.308.2.21.2.40Thu Oct 18 14:39:08 2007
+++ php-src/ext/standard/array.cWed Oct 31 13:39:14 2007
@@ -21,7 +21,7 @@
+--+
 */
 
-/* $Id: array.c,v 1.308.2.21.2.40 2007/10/18 14:39:08 scottmac Exp $ */
+/* $Id: array.c,v 1.308.2.21.2.41 2007/10/31 13:39:14 jani Exp $ */
 
 #include php.h
 #include php_ini.h
@@ -964,7 +964,7 @@
zval **result;
 
if (argc=0) {
-   php_error_docref(NULL TSRMLS_CC, E_WARNING, Atleast one value 
should be passed);
+   php_error_docref(NULL TSRMLS_CC, E_WARNING, At least one value 
should be passed);
RETURN_NULL();
}
set_compare_func(SORT_REGULAR TSRMLS_CC);
@@ -977,7 +977,7 @@
if (zend_hash_minmax(Z_ARRVAL_PP(arr), array_data_compare, 0, 
(void **) result TSRMLS_CC) == SUCCESS) {
RETVAL_ZVAL(*result, 1, 0);
} else {
-   php_error_docref(NULL TSRMLS_CC, E_WARNING, Array must 
contain atleast one element);
+   php_error_docref(NULL TSRMLS_CC, E_WARNING, Array must 
contain at least one element);
RETURN_FALSE;
}
} else {
@@ -1014,7 +1014,7 @@
zval **result;
 
if (argc=0) {
-   php_error_docref(NULL TSRMLS_CC, E_WARNING, Atleast one value 
should be passed);
+   php_error_docref(NULL TSRMLS_CC, E_WARNING, At least one value 
should be passed);
RETURN_NULL();
}
set_compare_func(SORT_REGULAR TSRMLS_CC);
@@ -1027,7 +1027,7 @@
if (zend_hash_minmax(Z_ARRVAL_PP(arr), array_data_compare, 1, 
(void **) result TSRMLS_CC) == SUCCESS) {
RETVAL_ZVAL(*result, 1, 0);
} else {
-   php_error_docref(NULL TSRMLS_CC, E_WARNING, Array must 
contain atleast one element);
+   php_error_docref(NULL TSRMLS_CC, E_WARNING, Array must 
contain at least one element);
RETURN_FALSE;
}
} else {
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/array/max.phpt?r1=1.1.2.3r2=1.1.2.4diff_format=u
Index: php-src/ext/standard/tests/array/max.phpt
diff -u php-src/ext/standard/tests/array/max.phpt:1.1.2.3 
php-src/ext/standard/tests/array/max.phpt:1.1.2.4
--- php-src/ext/standard/tests/array/max.phpt:1.1.2.3   Mon May  7 22:30:16 2007
+++ php-src/ext/standard/tests/array/max.phpt   Wed Oct 31 13:39:14 2007
@@ -20,13 +20,13 @@
 echo Done\n;
 ?
 --EXPECTF--
-Warning: max(): Atleast one value should be passed in %s on line %d
+Warning: max(): At least one value should be passed in %s on line %d
 NULL
 
 Warning: Wrong parameter count for max() in %s on line %d
 NULL
 
-Warning: max(): Array must contain atleast one element in %s on line %d
+Warning: max(): Array must contain at least one element in %s on line %d
 bool(false)
 
 Warning: Wrong parameter count for max() in %s on line %d
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/array/min.phpt?r1=1.1.2.3r2=1.1.2.4diff_format=u
Index: php-src/ext/standard/tests/array/min.phpt
diff -u php-src/ext/standard/tests/array/min.phpt:1.1.2.3 
php-src/ext/standard/tests/array/min.phpt:1.1.2.4
--- php-src/ext/standard/tests/array/min.phpt:1.1.2.3   Mon May  7 22:30:16 2007
+++ php-src/ext/standard/tests/array/min.phpt   Wed Oct 31 13:39:14 2007
@@ -20,13 +20,13 @@
 echo Done\n;
 ?
 --EXPECTF--
-Warning: min(): Atleast one value should be passed in %s on line %d
+Warning: min(): At least one value should be passed in %s on line %d
 NULL
 
 Warning: Wrong parameter count for min() in %s on line %d
 NULL
 
-Warning: min(): Array must contain atleast one element in %s on line %d
+Warning: min(): Array must contain at least one element in %s on line %d
 bool(false)
 
 Warning: Wrong parameter count for min() in %s on line %d
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/file/fgetc_basic.phpt?r1=1.1.2.2r2=1.1.2.3diff_format=u
Index: php-src/ext/standard/tests/file/fgetc_basic.phpt
diff -u php-src/ext/standard/tests/file/fgetc_basic.phpt:1.1.2.2 
php-src/ext/standard/tests/file/fgetc_basic.phpt:1.1.2.3
--- php-src/ext/standard/tests/file/fgetc_basic.phpt:1.1.2.2Thu Oct 11 
11:53:16 2007
+++ 

[PHP-CVS] cvs: php-src(PHP_5_2) /ext/standard array.c

2007-10-02 Thread Antony Dovgal
tony2001Tue Oct  2 10:04:13 2007 UTC

  Modified files:  (Branch: PHP_5_2)
/php-src/ext/standard   array.c 
  Log:
  improved recursion detection in array_walk()
  fixes #42752, though the leaks are still there
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/array.c?r1=1.308.2.21.2.37r2=1.308.2.21.2.38diff_format=u
Index: php-src/ext/standard/array.c
diff -u php-src/ext/standard/array.c:1.308.2.21.2.37 
php-src/ext/standard/array.c:1.308.2.21.2.38
--- php-src/ext/standard/array.c:1.308.2.21.2.37Sat Sep 22 15:38:00 2007
+++ php-src/ext/standard/array.cTue Oct  2 10:04:13 2007
@@ -21,7 +21,7 @@
+--+
 */
 
-/* $Id: array.c,v 1.308.2.21.2.37 2007/09/22 15:38:00 iliaa Exp $ */
+/* $Id: array.c,v 1.308.2.21.2.38 2007/10/02 10:04:13 tony2001 Exp $ */
 
 #include php.h
 #include php_ini.h
@@ -1079,11 +1079,13 @@

SEPARATE_ZVAL_TO_MAKE_IS_REF(args[0]);
thash = HASH_OF(*(args[0]));
-   if (thash == target_hash) {
+   if (thash-nApplyCount  1) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, 
recursion detected);
return 0;
}
+   thash-nApplyCount++;
php_array_walk(thash, userdata, recursive TSRMLS_CC);
+   thash-nApplyCount--;
} else {
zend_fcall_info fci;
 

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



[PHP-CVS] cvs: php-src(PHP_5_2) /ext/standard array.c

2007-09-22 Thread Ilia Alshanetsky
iliaa   Sat Sep 22 15:32:11 2007 UTC

  Modified files:  (Branch: PHP_5_2)
/php-src/ext/standard   array.c 
  Log:
  Fixed memory leak inside array_diff() (coverity issues #401,#402)
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/array.c?r1=1.308.2.21.2.35r2=1.308.2.21.2.36diff_format=u
Index: php-src/ext/standard/array.c
diff -u php-src/ext/standard/array.c:1.308.2.21.2.35 
php-src/ext/standard/array.c:1.308.2.21.2.36
--- php-src/ext/standard/array.c:1.308.2.21.2.35Fri Sep 21 13:51:49 2007
+++ php-src/ext/standard/array.cSat Sep 22 15:32:11 2007
@@ -21,7 +21,7 @@
+--+
 */
 
-/* $Id: array.c,v 1.308.2.21.2.35 2007/09/21 13:51:49 tony2001 Exp $ */
+/* $Id: array.c,v 1.308.2.21.2.36 2007/09/22 15:32:11 iliaa Exp $ */
 
 #include php.h
 #include php_ini.h
@@ -3634,6 +3634,8 @@
hash = HASH_OF(*args[i]);
list = (Bucket **) pemalloc((hash-nNumOfElements + 1) * 
sizeof(Bucket *), hash-persistent);
if (!list) {
+   efree(ptrs);
+   efree(lists);
RETURN_FALSE;
}
lists[i] = list;

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



[PHP-CVS] cvs: php-src(PHP_5_2) /ext/standard array.c

2007-09-22 Thread Ilia Alshanetsky
iliaa   Sat Sep 22 15:38:00 2007 UTC

  Modified files:  (Branch: PHP_5_2)
/php-src/ext/standard   array.c 
  Log:
  Fixed memory leak inside array_intersec (coverity issues #403,#404)
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/array.c?r1=1.308.2.21.2.36r2=1.308.2.21.2.37diff_format=u
Index: php-src/ext/standard/array.c
diff -u php-src/ext/standard/array.c:1.308.2.21.2.36 
php-src/ext/standard/array.c:1.308.2.21.2.37
--- php-src/ext/standard/array.c:1.308.2.21.2.36Sat Sep 22 15:32:11 2007
+++ php-src/ext/standard/array.cSat Sep 22 15:38:00 2007
@@ -21,7 +21,7 @@
+--+
 */
 
-/* $Id: array.c,v 1.308.2.21.2.36 2007/09/22 15:32:11 iliaa Exp $ */
+/* $Id: array.c,v 1.308.2.21.2.37 2007/09/22 15:38:00 iliaa Exp $ */
 
 #include php.h
 #include php_ini.h
@@ -3156,10 +3156,12 @@
intersect_data_compare_func = 
array_user_compare;
BG(user_compare_func_name) = args[arr_argc + 
1];/* data - key */
} else {
+   efree(args);
php_error_docref(NULL TSRMLS_CC, E_WARNING, 
data_compare_type is %d. key_compare_type is %d. This should never happen. 
Please report as a bug., data_compare_type, key_compare_type);
return;
}   
} else {
+   efree(args);
php_error_docref(NULL TSRMLS_CC, E_WARNING, behavior is %d. 
This should never happen. Please report as a bug, behavior);
return;
}
@@ -3178,6 +3180,9 @@
hash = HASH_OF(*args[i]);
list = (Bucket **) pemalloc((hash-nNumOfElements + 1) * 
sizeof(Bucket *), hash-persistent);
if (!list) {
+   efree(args);
+   efree(lists);
+   efree(ptrs);
RETURN_FALSE;
}
lists[i] = list;
@@ -3612,10 +3617,12 @@
diff_data_compare_func = array_user_compare;
BG(user_compare_func_name) = args[arr_argc + 1];/* data 
- key*/
} else {
+   efree(args);
php_error_docref(NULL TSRMLS_CC, E_WARNING, 
data_compare_type is %d. key_compare_type is %d. This should never happen. 
Please report as a bug, data_compare_type, key_compare_type);
return; 
}   
} else {
+   efree(args);
php_error_docref(NULL TSRMLS_CC, E_WARNING, behavior is %d. 
This should never happen. Please report as a bug, behavior);
return; 
}
@@ -3634,6 +3641,7 @@
hash = HASH_OF(*args[i]);
list = (Bucket **) pemalloc((hash-nNumOfElements + 1) * 
sizeof(Bucket *), hash-persistent);
if (!list) {
+   efree(args);
efree(ptrs);
efree(lists);
RETURN_FALSE;

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



[PHP-CVS] cvs: php-src(PHP_5_2) /ext/standard array.c /ext/standard/tests/array array_map_001.phpt

2007-09-21 Thread Antony Dovgal
tony2001Fri Sep 21 13:51:49 2007 UTC

  Added files: (Branch: PHP_5_2)
/php-src/ext/standard/tests/array   array_map_001.phpt 

  Modified files:  
/php-src/ext/standard   array.c 
  Log:
  MFH: plug leak on error (coverity issue #405)
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/array.c?r1=1.308.2.21.2.34r2=1.308.2.21.2.35diff_format=u
Index: php-src/ext/standard/array.c
diff -u php-src/ext/standard/array.c:1.308.2.21.2.34 
php-src/ext/standard/array.c:1.308.2.21.2.35
--- php-src/ext/standard/array.c:1.308.2.21.2.34Fri Sep 21 13:10:59 2007
+++ php-src/ext/standard/array.cFri Sep 21 13:51:49 2007
@@ -21,7 +21,7 @@
+--+
 */
 
-/* $Id: array.c,v 1.308.2.21.2.34 2007/09/21 13:10:59 dmitry Exp $ */
+/* $Id: array.c,v 1.308.2.21.2.35 2007/09/21 13:51:49 tony2001 Exp $ */
 
 #include php.h
 #include php_ini.h
@@ -4555,6 +4555,8 @@
efree(args);
efree(array_pos);
zval_dtor(return_value);
+   zval_ptr_dtor(null);
+   efree(params);
RETURN_NULL();
}
}

http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/array/array_map_001.phpt?view=markuprev=1.1
Index: php-src/ext/standard/tests/array/array_map_001.phpt
+++ php-src/ext/standard/tests/array/array_map_001.phpt
--TEST--
array_map() and exceptions in the callback
--FILE--
?php

$a = array(1,2,3);

function foo() { 
throw new exception(1); 
} 

try { 
array_map(foo, $a, array(2,3)); 
} catch (Exception $e) {
var_dump(exception caught!);
}

echo Done\n;
?
--EXPECTF-- 
Warning: array_map(): An error occurred while invoking the map callback in %s 
on line %d
string(17) exception caught!
Done
--UEXPECTF--
Warning: array_map(): An error occurred while invoking the map callback in %s 
on line %d
unicode(17) exception caught!
Done

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



[PHP-CVS] cvs: php-src(PHP_5_2) /ext/standard array.c /ext/standard/tests/array bug42233.phpt

2007-08-10 Thread Jani Taskinen
janiFri Aug 10 12:17:26 2007 UTC

  Added files: (Branch: PHP_5_2)
/php-src/ext/standard/tests/array   bug42233.phpt 

  Modified files:  
/php-src/ext/standard   array.c 
  Log:
  - Fix the fix for bug #42233
  
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/array.c?r1=1.308.2.21.2.31r2=1.308.2.21.2.32diff_format=u
Index: php-src/ext/standard/array.c
diff -u php-src/ext/standard/array.c:1.308.2.21.2.31 
php-src/ext/standard/array.c:1.308.2.21.2.32
--- php-src/ext/standard/array.c:1.308.2.21.2.31Wed Aug  8 07:41:09 2007
+++ php-src/ext/standard/array.cFri Aug 10 12:17:26 2007
@@ -21,7 +21,7 @@
+--+
 */
 
-/* $Id: array.c,v 1.308.2.21.2.31 2007/08/08 07:41:09 jani Exp $ */
+/* $Id: array.c,v 1.308.2.21.2.32 2007/08/10 12:17:26 jani Exp $ */
 
 #include php.h
 #include php_ini.h
@@ -1282,32 +1282,34 @@
 
 static int php_valid_var_name(char *var_name, int len) /* {{{ */
 {
-   int i;
+   int i, ch;

if (!var_name)
return 0;
 
/* These are allowed as first char: [a-zA-Z_\x7f-\xff] */
-   if (var_name[0] == '_' ||
-   (((int)((unsigned char *)var_name)[0]) = 65  /* A*/  /* 
Z*/ 90  = ((int)((unsigned char *)var_name)[0])) ||
-   (((int)((unsigned char *)var_name)[0]) = 97  /* a*/  /* 
z*/ 122 = ((int)((unsigned char *)var_name)[0])) ||
-   (((int)((unsigned char *)var_name)[0]) = 127 /* 0x7f */  /* 
0xff */ 255 = ((int)((unsigned char *)var_name)[0]))
+   ch = (int)((unsigned char *)var_name)[0];
+   if (var_name[0] != '_' 
+   (ch  65  /* A*/ || /* Z*/ ch  90)  
+   (ch  97  /* a*/ || /* z*/ ch  122) 
+   (ch  127 /* 0x7f */ || /* 0xff */ ch  255)
) {
-   /* And these as the rest: [a-zA-Z0-9_\x7f-\xff] */
-   if (len  1) {
-   for (i = 1; i  len; i++) {
-   if (var_name[i] == '_' ||
-   (((int)((unsigned char *)var_name)[i]) 
= 48  /* 0*/  /* 9*/ 57  = ((int)((unsigned char *)var_name)[i])) ||
-   (((int)((unsigned char *)var_name)[i]) 
= 65  /* A*/  /* Z*/ 90  = ((int)((unsigned char *)var_name)[i])) ||
-   (((int)((unsigned char *)var_name)[i]) 
= 97  /* a*/  /* z*/ 122 = ((int)((unsigned char *)var_name)[i])) ||
-   (((int)((unsigned char *)var_name)[i]) 
= 127 /* 0x7f */  /* 0xff */ 255 = ((int)((unsigned char *)var_name)[i]))
-   ) { } else {
-   return 0;
-   }
+   return 0;
+   }
+
+   /* And these as the rest: [a-zA-Z0-9_\x7f-\xff] */
+   if (len  1) {
+   for (i = 1; i  len; i++) {
+   ch = (int)((unsigned char *)var_name)[i];
+   if (var_name[i] != '_' 
+   (ch  48  /* 0*/ || /* 9*/ ch  57)  
+   (ch  65  /* A*/ || /* Z*/ ch  90)  
+   (ch  97  /* a*/ || /* z*/ ch  122) 
+   (ch  127 /* 0x7f */ || /* 0xff */ ch  255)
+   ) { 
+   return 0;
}
}
-   } else {
-   return 0;
}
return 1;
 }

http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/array/bug42233.phpt?view=markuprev=1.1
Index: php-src/ext/standard/tests/array/bug42233.phpt
+++ php-src/ext/standard/tests/array/bug42233.phpt

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



[PHP-CVS] cvs: php-src(PHP_5_2) /ext/standard array.c

2007-06-05 Thread Antony Dovgal
tony2001Tue Jun  5 12:12:55 2007 UTC

  Modified files:  (Branch: PHP_5_2)
/php-src/ext/standard   array.c 
  Log:
  fix folding
  
  http://cvs.php.net/viewvc.cgi/php-src/ext/standard/array.c?r1=1.308.2.21.2.27r2=1.308.2.21.2.28diff_format=u
Index: php-src/ext/standard/array.c
diff -u php-src/ext/standard/array.c:1.308.2.21.2.27 
php-src/ext/standard/array.c:1.308.2.21.2.28
--- php-src/ext/standard/array.c:1.308.2.21.2.27Thu Apr 19 23:21:21 2007
+++ php-src/ext/standard/array.cTue Jun  5 12:12:55 2007
@@ -21,7 +21,7 @@
+--+
 */
 
-/* $Id: array.c,v 1.308.2.21.2.27 2007/04/19 23:21:21 iliaa Exp $ */
+/* $Id: array.c,v 1.308.2.21.2.28 2007/06/05 12:12:55 tony2001 Exp $ */
 
 #include php.h
 #include php_ini.h
@@ -50,6 +50,7 @@
 #include ext/spl/spl_array.h
 #endif
 
+/* {{{ defines */
 #define EXTR_OVERWRITE 0
 #define EXTR_SKIP  1
 #define EXTR_PREFIX_SAME   2
@@ -91,6 +92,7 @@
 #define INTERSECT_COMP_KEY_USER  1
 
 #define DOUBLE_DRIFT_FIX   0.001
+/* }}} */
 
 ZEND_DECLARE_MODULE_GLOBALS(array)
 
@@ -102,7 +104,7 @@
 }
 /* }}} */
 
-PHP_MINIT_FUNCTION(array)
+PHP_MINIT_FUNCTION(array) /* {{{ */
 {
ZEND_INIT_MODULE_GLOBALS(array, php_array_init_globals, NULL); 
 
@@ -131,8 +133,9 @@

return SUCCESS;
 }
+/* }}} */
 
-PHP_MSHUTDOWN_FUNCTION(array)
+PHP_MSHUTDOWN_FUNCTION(array) /* {{{ */
 {
 #ifdef ZTS
ts_free_id(array_globals_id);
@@ -140,8 +143,9 @@
 
return SUCCESS;
 }
+/* }}} */
 
-static void set_compare_func(int sort_type TSRMLS_DC)
+static void set_compare_func(int sort_type TSRMLS_DC) /* {{{ */
 {
switch (sort_type) {
case SORT_NUMERIC:
@@ -164,8 +168,9 @@
break;
}
 }
+/* }}} */
 
-static int array_key_compare(const void *a, const void *b TSRMLS_DC)
+static int array_key_compare(const void *a, const void *b TSRMLS_DC) /* {{{ */
 {
Bucket *f;
Bucket *s;
@@ -218,11 +223,13 @@
 
return 0;
 }
+/* }}} */
 
-static int array_reverse_key_compare(const void *a, const void *b TSRMLS_DC)
+static int array_reverse_key_compare(const void *a, const void *b TSRMLS_DC) 
/* {{{ */
 {
return array_key_compare(a, b TSRMLS_CC) * -1;
 }
+/* }}} */
 
 /* {{{ proto bool krsort(array array_arg [, int sort_flags])
Sort an array by key value in reverse order */
@@ -268,8 +275,7 @@
 }
 /* }}} */
 
-
-static int php_count_recursive(zval *array, long mode TSRMLS_DC)
+static int php_count_recursive(zval *array, long mode TSRMLS_DC) /* {{{ */
 {
long cnt = 0;
zval **element;
@@ -289,6 +295,7 @@
 
return cnt;
 }
+/* }}} */
 
 /* {{{ proto int count(mixed var [, int mode])
Count the number of elements in a variable (usually an array) */
@@ -343,7 +350,7 @@
  *
  * This is not correct any more, depends on what compare_func is set to.
  */
-static int array_data_compare(const void *a, const void *b TSRMLS_DC)
+static int array_data_compare(const void *a, const void *b TSRMLS_DC) /* {{{ */
 {
Bucket *f;
Bucket *s;
@@ -381,13 +388,15 @@
 
return 0;
 }
+/* }}} */
 
-static int array_reverse_data_compare(const void *a, const void *b TSRMLS_DC)
+static int array_reverse_data_compare(const void *a, const void *b TSRMLS_DC) 
/* {{{ */
 {
return array_data_compare(a, b TSRMLS_CC)*-1;
 }
+/* }}} */
 
-static int array_natural_general_compare(const void *a, const void *b, int 
fold_case)
+static int array_natural_general_compare(const void *a, const void *b, int 
fold_case) /* {{{ */
 {
Bucket *f, *s;
zval *fval, *sval;
@@ -419,18 +428,21 @@

return result;
 }
+/* }}} */
 
-static int array_natural_compare(const void *a, const void *b TSRMLS_DC)
+static int array_natural_compare(const void *a, const void *b TSRMLS_DC) /* 
{{{ */
 {
return array_natural_general_compare(a, b, 0);
 }
+/* }}} */
 
-static int array_natural_case_compare(const void *a, const void *b TSRMLS_DC)
+static int array_natural_case_compare(const void *a, const void *b TSRMLS_DC) 
/* {{{ */
 {
return array_natural_general_compare(a, b, 1);
 }
+/* }}} */
 
-static void php_natsort(INTERNAL_FUNCTION_PARAMETERS, int fold_case)
+static void php_natsort(INTERNAL_FUNCTION_PARAMETERS, int fold_case) /* {{{ */
 {
zval **array;
HashTable *target_hash;
@@ -457,7 +469,7 @@
 
RETURN_TRUE;
 }
-
+/* }}} */
 
 /* {{{ proto void natsort(array array_arg)
Sort an array using natural sort */
@@ -467,7 +479,6 @@
 }
 /* }}} */
 
-
 /* {{{ proto void natcasesort(array array_arg)
Sort an array using case-insensitive natural sort */
 PHP_FUNCTION(natcasesort)
@@ -476,7 +487,6 @@
 }
 /* }}} */
 
-
 /* {{{ proto bool asort(array array_arg [, int sort_flags])
Sort an array and maintain index association */
 PHP_FUNCTION(asort)
@@ 

Re: [PHP-CVS] cvs: php-src(PHP_5_2) /ext/standard array.c

2007-03-19 Thread Antony Dovgal

On 03/18/2007 11:20 PM, Wez Furlong wrote:

wez Sun Mar 18 20:20:23 2007 UTC

  Modified files:  (Branch: PHP_5_2)
/php-src/ext/standard	array.c 
  Log:

  fixes #40848


Is there any test case?

--
Wbr, 
Antony Dovgal


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



Re: [PHP-CVS] cvs: php-src(PHP_5_2) /ext/standard array.c

2007-03-19 Thread Wez Furlong

I'm surprised that we don't have one for this already.

You can observe that the patch is correct because this list:
http://omniti.com/people
is sorted alphabetically by last name when running on amd64 solaris,  
and without the patch, it was not.


--Wez.



On Mar 19, 2007, at 3:59 AM, Antony Dovgal wrote:


On 03/18/2007 11:20 PM, Wez Furlong wrote:

wez Sun Mar 18 20:20:23 2007 UTC
  Modified files:  (Branch: PHP_5_2)
/php-src/ext/standard   array.c   Log:
  fixes #40848


Is there any test case?

--
Wbr, Antony Dovgal


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



Re: [PHP-CVS] cvs: php-src(PHP_5_2) /ext/standard array.c

2007-03-19 Thread Antony Dovgal

On 03/19/2007 05:40 PM, Wez Furlong wrote:

I'm surprised that we don't have one for this already.

You can observe that the patch is correct because this list:
http://omniti.com/people
is sorted alphabetically by last name when running on amd64 solaris,  
and without the patch, it was not.


Well, then how about creating one?
I don't think I can find an AMD64 Solaris machine for tests.

--
Wbr, 
Antony Dovgal


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



Re: [PHP-CVS] cvs: php-src(PHP_5_2) /ext/standard array.c

2007-03-19 Thread Wez Furlong

On 3/19/07, Antony Dovgal [EMAIL PROTECTED] wrote:

On 03/19/2007 05:40 PM, Wez Furlong wrote:
 I'm surprised that we don't have one for this already.

 You can observe that the patch is correct because this list:
 http://omniti.com/people
 is sorted alphabetically by last name when running on amd64 solaris,
 and without the patch, it was not.

Well, then how about creating one?
I don't think I can find an AMD64 Solaris machine for tests.


You don't need an AMD64 Solaris machine to write a test, you need time.

--Wez.

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



[PHP-CVS] cvs: php-src(PHP_5_2) /ext/standard array.c

2007-03-18 Thread Wez Furlong
wez Sun Mar 18 20:20:23 2007 UTC

  Modified files:  (Branch: PHP_5_2)
/php-src/ext/standard   array.c 
  Log:
  fixes #40848
  
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/array.c?r1=1.308.2.21.2.25r2=1.308.2.21.2.26diff_format=u
Index: php-src/ext/standard/array.c
diff -u php-src/ext/standard/array.c:1.308.2.21.2.25 
php-src/ext/standard/array.c:1.308.2.21.2.26
--- php-src/ext/standard/array.c:1.308.2.21.2.25Fri Mar 16 19:38:58 2007
+++ php-src/ext/standard/array.cSun Mar 18 20:20:23 2007
@@ -21,7 +21,7 @@
+--+
 */
 
-/* $Id: array.c,v 1.308.2.21.2.25 2007/03/16 19:38:58 stas Exp $ */
+/* $Id: array.c,v 1.308.2.21.2.26 2007/03/18 20:20:23 wez Exp $ */
 
 #include php.h
 #include php_ini.h
@@ -596,7 +596,7 @@
convert_to_long_ex(retval_ptr);
retval = Z_LVAL_P(retval_ptr);
zval_ptr_dtor(retval_ptr);
-   return retval;
+   return retval  0 ? -1 : retval  0 ? 1 : 0;;
} else {
return 0;
}

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



[PHP-CVS] cvs: php-src(PHP_5_2) /ext/standard array.c /ext/standard/tests/array bug30074.phpt

2006-12-17 Thread Brian Shire
shire   Sun Dec 17 20:09:48 2006 UTC

  Added files: (Branch: PHP_5_2)
/php-src/ext/standard/tests/array   bug30074.phpt 

  Modified files:  
/php-src/ext/standard   array.c 
  Log:
  Fixed bug #30074
extract with EXTR_REFS was setting EG(unitialized_zval_ptr)-is_ref=1, 
affecting subsequent usage
Added test
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/array.c?r1=1.308.2.21.2.20r2=1.308.2.21.2.21diff_format=u
Index: php-src/ext/standard/array.c
diff -u php-src/ext/standard/array.c:1.308.2.21.2.20 
php-src/ext/standard/array.c:1.308.2.21.2.21
--- php-src/ext/standard/array.c:1.308.2.21.2.20Sun Dec 10 19:43:03 2006
+++ php-src/ext/standard/array.cSun Dec 17 20:09:48 2006
@@ -21,7 +21,7 @@
+--+
 */
 
-/* $Id: array.c,v 1.308.2.21.2.20 2006/12/10 19:43:03 iliaa Exp $ */
+/* $Id: array.c,v 1.308.2.21.2.21 2006/12/17 20:09:48 shire Exp $ */
 
 #include php.h
 #include php_ini.h
@@ -1436,7 +1436,7 @@
 
*orig_var = *entry;
} else {
-   if ((*var_array)-refcount  1) 
{
+   if ((*var_array)-refcount  1 
|| *entry == EG(uninitialized_zval_ptr)) {

SEPARATE_ZVAL_TO_MAKE_IS_REF(entry);
} else {
(*entry)-is_ref = 1;

http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/array/bug30074.phpt?view=markuprev=1.1
Index: php-src/ext/standard/tests/array/bug30074.phpt
+++ php-src/ext/standard/tests/array/bug30074.phpt

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



[PHP-CVS] cvs: php-src(PHP_5_2) /ext/standard array.c /ext/standard/tests/array array_pad.phpt

2006-11-15 Thread Antony Dovgal
tony2001Wed Nov 15 22:10:20 2006 UTC

  Added files: (Branch: PHP_5_2)
/php-src/ext/standard/tests/array   array_pad.phpt 

  Modified files:  
/php-src/ext/standard   array.c 
  Log:
  fix leak, add test
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/array.c?r1=1.308.2.21.2.17r2=1.308.2.21.2.18diff_format=u
Index: php-src/ext/standard/array.c
diff -u php-src/ext/standard/array.c:1.308.2.21.2.17 
php-src/ext/standard/array.c:1.308.2.21.2.18
--- php-src/ext/standard/array.c:1.308.2.21.2.17Sun Nov 12 17:23:01 2006
+++ php-src/ext/standard/array.cWed Nov 15 22:10:19 2006
@@ -21,7 +21,7 @@
+--+
 */
 
-/* $Id: array.c,v 1.308.2.21.2.17 2006/11/12 17:23:01 iliaa Exp $ */
+/* $Id: array.c,v 1.308.2.21.2.18 2006/11/15 22:10:19 tony2001 Exp $ */
 
 #include php.h
 #include php_ini.h
@@ -2656,6 +2656,7 @@
num_pads = pad_size_abs - input_size;
if(num_pads  1048576) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, You may only pad 
up to 1048576 elements at a time);
+   zval_dtor(return_value);
RETURN_FALSE;
}
pads = (zval ***)safe_emalloc(num_pads, sizeof(zval **), 0);

http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/array/array_pad.phpt?view=markuprev=1.1
Index: php-src/ext/standard/tests/array/array_pad.phpt
+++ php-src/ext/standard/tests/array/array_pad.phpt
--TEST--
array_pad() tests
--FILE--
?php

var_dump(array_pad());
var_dump(array_pad(array()));
var_dump(array_pad(array(), 1));
var_dump(array_pad(array(), 1, 0));

var_dump(array_pad(array(), 0, 0));
var_dump(array_pad(array(), -1, 0));
var_dump(array_pad(array(, -1, 2.0), 5, 0));
var_dump(array_pad(array(, -1, 2.0), 5, array()));
var_dump(array_pad(array(, -1, 2.0), 2, array()));
var_dump(array_pad(array(, -1, 2.0), -3, array()));
var_dump(array_pad(array(, -1, 2.0), -4, array()));
var_dump(array_pad(array(, -1, 2.0), 200, 0));

echo Done\n;
?
--EXPECTF-- 
Warning: array_pad() expects exactly 3 parameters, 0 given in %s on line %d
NULL

Warning: array_pad() expects exactly 3 parameters, 1 given in %s on line %d
NULL

Warning: array_pad() expects exactly 3 parameters, 2 given in %s on line %d
NULL
array(1) {
  [0]=
  int(0)
}
array(0) {
}
array(1) {
  [0]=
  int(0)
}
array(5) {
  [0]=
  string(0) 
  [1]=
  int(-1)
  [2]=
  float(2)
  [3]=
  int(0)
  [4]=
  int(0)
}
array(5) {
  [0]=
  string(0) 
  [1]=
  int(-1)
  [2]=
  float(2)
  [3]=
  array(0) {
  }
  [4]=
  array(0) {
  }
}
array(3) {
  [0]=
  string(0) 
  [1]=
  int(-1)
  [2]=
  float(2)
}
array(3) {
  [0]=
  string(0) 
  [1]=
  int(-1)
  [2]=
  float(2)
}
array(4) {
  [0]=
  array(0) {
  }
  [1]=
  string(0) 
  [2]=
  int(-1)
  [3]=
  float(2)
}

Warning: array_pad(): You may only pad up to 1048576 elements at a time in %s 
on line %d
bool(false)
Done
--UEXPECTF--
Warning: array_pad() expects exactly 3 parameters, 0 given in %s on line %d
NULL

Warning: array_pad() expects exactly 3 parameters, 1 given in %s on line %d
NULL

Warning: array_pad() expects exactly 3 parameters, 2 given in %s on line %d
NULL
array(1) {
  [0]=
  int(0)
}
array(0) {
}
array(1) {
  [0]=
  int(0)
}
array(5) {
  [0]=
  unicode(0) 
  [1]=
  int(-1)
  [2]=
  float(2)
  [3]=
  int(0)
  [4]=
  int(0)
}
array(5) {
  [0]=
  unicode(0) 
  [1]=
  int(-1)
  [2]=
  float(2)
  [3]=
  array(0) {
  }
  [4]=
  array(0) {
  }
}
array(3) {
  [0]=
  unicode(0) 
  [1]=
  int(-1)
  [2]=
  float(2)
}
array(3) {
  [0]=
  unicode(0) 
  [1]=
  int(-1)
  [2]=
  float(2)
}
array(4) {
  [0]=
  array(0) {
  }
  [1]=
  unicode(0) 
  [2]=
  int(-1)
  [3]=
  float(2)
}

Warning: array_pad(): You may only pad up to 1048576 elements at a time in %s 
on line %d
bool(false)
Done

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



[PHP-CVS] cvs: php-src(PHP_5_2) /ext/standard array.c

2006-11-12 Thread Ilia Alshanetsky
iliaa   Sun Nov 12 17:23:01 2006 UTC

  Modified files:  (Branch: PHP_5_2)
/php-src/ext/standard   array.c 
  Log:
  removed bogus char
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/array.c?r1=1.308.2.21.2.16r2=1.308.2.21.2.17diff_format=u
Index: php-src/ext/standard/array.c
diff -u php-src/ext/standard/array.c:1.308.2.21.2.16 
php-src/ext/standard/array.c:1.308.2.21.2.17
--- php-src/ext/standard/array.c:1.308.2.21.2.16Sun Nov 12 17:13:22 2006
+++ php-src/ext/standard/array.cSun Nov 12 17:23:01 2006
@@ -21,7 +21,7 @@
+--+
 */
 
-/* $Id: array.c,v 1.308.2.21.2.16 2006/11/12 17:13:22 iliaa Exp $ */
+/* $Id: array.c,v 1.308.2.21.2.17 2006/11/12 17:23:01 iliaa Exp $ */
 
 #include php.h
 #include php_ini.h
@@ -2202,7 +2202,7 @@
/* Get the arguments and do error-checking */   
argc = ZEND_NUM_ARGS();
if (argc  2 || argc  4 || zend_get_parameters_ex(argc, input, 
offset, length, z_preserve_keys)) {
-   WRONG_PARA¬M_COUNT;
+   WRONG_PARAM_COUNT;
}

if (Z_TYPE_PP(input) != IS_ARRAY) {

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



[PHP-CVS] cvs: php-src(PHP_5_2) /ext/standard array.c

2006-10-03 Thread Hannes Magnusson
bjori   Tue Oct  3 16:37:51 2006 UTC

  Modified files:  (Branch: PHP_5_2)
/php-src/ext/standard   array.c 
  Log:
  MFH: compact() doesnt throw wrong param count
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/array.c?r1=1.308.2.21.2.12r2=1.308.2.21.2.13diff_format=u
Index: php-src/ext/standard/array.c
diff -u php-src/ext/standard/array.c:1.308.2.21.2.12 
php-src/ext/standard/array.c:1.308.2.21.2.13
--- php-src/ext/standard/array.c:1.308.2.21.2.12Tue Sep 19 09:35:27 2006
+++ php-src/ext/standard/array.cTue Oct  3 16:37:51 2006
@@ -21,7 +21,7 @@
+--+
 */
 
-/* $Id: array.c,v 1.308.2.21.2.12 2006/09/19 09:35:27 tony2001 Exp $ */
+/* $Id: array.c,v 1.308.2.21.2.13 2006/10/03 16:37:51 bjori Exp $ */
 
 #include php.h
 #include php_ini.h
@@ -1507,6 +1507,9 @@
zval ***args;   /* function arguments array */
int i;

+   if (ZEND_NUM_ARGS()  1) {
+   WRONG_PARAM_COUNT;
+   }
args = (zval ***)safe_emalloc(ZEND_NUM_ARGS(), sizeof(zval **), 0);

if (zend_get_parameters_array_ex(ZEND_NUM_ARGS(), args) == FAILURE) {

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



[PHP-CVS] cvs: php-src(PHP_5_2) /ext/standard array.c streamsfuncs.c string.c

2006-10-03 Thread Ilia Alshanetsky
iliaa   Tue Oct  3 17:41:48 2006 UTC

  Modified files:  (Branch: PHP_5_2)
/php-src/ext/standard   array.c streamsfuncs.c string.c 
  Log:
  optimize zend_hash_init() with known hash table sizes.
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/array.c?r1=1.308.2.21.2.13r2=1.308.2.21.2.14diff_format=u
Index: php-src/ext/standard/array.c
diff -u php-src/ext/standard/array.c:1.308.2.21.2.13 
php-src/ext/standard/array.c:1.308.2.21.2.14
--- php-src/ext/standard/array.c:1.308.2.21.2.13Tue Oct  3 16:37:51 2006
+++ php-src/ext/standard/array.cTue Oct  3 17:41:47 2006
@@ -21,7 +21,7 @@
+--+
 */
 
-/* $Id: array.c,v 1.308.2.21.2.13 2006/10/03 16:37:51 bjori Exp $ */
+/* $Id: array.c,v 1.308.2.21.2.14 2006/10/03 17:41:47 iliaa Exp $ */
 
 #include php.h
 #include php_ini.h
@@ -3055,7 +3055,7 @@
zval *tmp;
 
ALLOC_HASHTABLE(ht);
-   zend_hash_init(ht, 0, NULL, ZVAL_PTR_DTOR, 0);
+   zend_hash_init(ht, 
zend_hash_num_elements(return_value-value.ht), NULL, ZVAL_PTR_DTOR, 0);
zend_hash_copy(ht, return_value-value.ht, (copy_ctor_func_t) 
zval_add_ref, (void *) tmp, sizeof(zval *));
return_value-value.ht = ht;
}
@@ -3441,7 +3441,7 @@
zval *tmp;
 
ALLOC_HASHTABLE(ht);
-   zend_hash_init(ht, 0, NULL, ZVAL_PTR_DTOR, 0);
+   zend_hash_init(ht, 
zend_hash_num_elements(return_value-value.ht), NULL, ZVAL_PTR_DTOR, 0);
zend_hash_copy(ht, return_value-value.ht, (copy_ctor_func_t) 
zval_add_ref, (void *) tmp, sizeof(zval *));
return_value-value.ht = ht;
}
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/streamsfuncs.c?r1=1.58.2.6.2.7r2=1.58.2.6.2.8diff_format=u
Index: php-src/ext/standard/streamsfuncs.c
diff -u php-src/ext/standard/streamsfuncs.c:1.58.2.6.2.7 
php-src/ext/standard/streamsfuncs.c:1.58.2.6.2.8
--- php-src/ext/standard/streamsfuncs.c:1.58.2.6.2.7Fri Sep 29 13:11:27 2006
+++ php-src/ext/standard/streamsfuncs.c Tue Oct  3 17:41:47 2006
@@ -17,7 +17,7 @@
   +--+
 */
 
-/* $Id: streamsfuncs.c,v 1.58.2.6.2.7 2006/09/29 13:11:27 bjori Exp $ */
+/* $Id: streamsfuncs.c,v 1.58.2.6.2.8 2006/10/03 17:41:47 iliaa Exp $ */
 
 #include php.h
 #include php_globals.h
@@ -614,7 +614,7 @@
return 0;
}
ALLOC_HASHTABLE(new_hash);
-   zend_hash_init(new_hash, 0, NULL, ZVAL_PTR_DTOR, 0);
+   zend_hash_init(new_hash, 
zend_hash_num_elements(Z_ARRVAL_P(stream_array)), NULL, ZVAL_PTR_DTOR, 0);

for (zend_hash_internal_pointer_reset(Z_ARRVAL_P(stream_array));
 zend_hash_get_current_data(Z_ARRVAL_P(stream_array), (void **) 
elem) == SUCCESS;
@@ -662,7 +662,7 @@
return 0;
}
ALLOC_HASHTABLE(new_hash);
-   zend_hash_init(new_hash, 0, NULL, ZVAL_PTR_DTOR, 0);
+   zend_hash_init(new_hash, 
zend_hash_num_elements(Z_ARRVAL_P(stream_array)), NULL, ZVAL_PTR_DTOR, 0);

for (zend_hash_internal_pointer_reset(Z_ARRVAL_P(stream_array));
 zend_hash_get_current_data(Z_ARRVAL_P(stream_array), (void **) 
elem) == SUCCESS;
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/string.c?r1=1.445.2.14.2.22r2=1.445.2.14.2.23diff_format=u
Index: php-src/ext/standard/string.c
diff -u php-src/ext/standard/string.c:1.445.2.14.2.22 
php-src/ext/standard/string.c:1.445.2.14.2.23
--- php-src/ext/standard/string.c:1.445.2.14.2.22   Mon Oct  2 20:07:14 2006
+++ php-src/ext/standard/string.c   Tue Oct  3 17:41:47 2006
@@ -18,7 +18,7 @@
+--+
  */
 
-/* $Id: string.c,v 1.445.2.14.2.22 2006/10/02 20:07:14 andrei Exp $ */
+/* $Id: string.c,v 1.445.2.14.2.23 2006/10/03 17:41:47 iliaa Exp $ */
 
 /* Synced with php 3.0 revision 1.193 1999-06-16 [ssb] */
 
@@ -2496,7 +2496,7 @@
smart_str result = {0};
HashTable tmp_hash;

-   zend_hash_init(tmp_hash, 0, NULL, NULL, 0);
+   zend_hash_init(tmp_hash, zend_hash_num_elements(hash), NULL, NULL, 0);
zend_hash_internal_pointer_reset_ex(hash, hpos);
while (zend_hash_get_current_data_ex(hash, (void **)entry, hpos) == 
SUCCESS) {
switch (zend_hash_get_current_key_ex(hash, string_key, 
string_key_len, num_key, 0, hpos)) {

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



[PHP-CVS] cvs: php-src(PHP_5_2) /ext/standard array.c /ext/standard/tests/array array_walk.phpt array_walk_objects.phpt array_walk_rec_objects.phpt array_walk_recursive1.phpt

2006-09-19 Thread Antony Dovgal
tony2001Tue Sep 19 09:35:28 2006 UTC

  Added files: (Branch: PHP_5_2)
/php-src/ext/standard/tests/array   array_walk_objects.phpt 
array_walk_rec_objects.phpt 

  Modified files:  
/php-src/ext/standard   array.c 
/php-src/ext/standard/tests/array   array_walk.phpt 
array_walk_recursive1.phpt 
  Log:
  support objects in array_walk*()
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/array.c?r1=1.308.2.21.2.11r2=1.308.2.21.2.12diff_format=u
Index: php-src/ext/standard/array.c
diff -u php-src/ext/standard/array.c:1.308.2.21.2.11 
php-src/ext/standard/array.c:1.308.2.21.2.12
--- php-src/ext/standard/array.c:1.308.2.21.2.11Tue Sep 19 09:04:15 2006
+++ php-src/ext/standard/array.cTue Sep 19 09:35:27 2006
@@ -21,7 +21,7 @@
+--+
 */
 
-/* $Id: array.c,v 1.308.2.21.2.11 2006/09/19 09:04:15 tony2001 Exp $ */
+/* $Id: array.c,v 1.308.2.21.2.12 2006/09/19 09:35:27 tony2001 Exp $ */
 
 #include php.h
 #include php_ini.h
@@ -1138,7 +1138,7 @@
HashTable *target_hash;
 
old_walk_func_name = BG(array_walk_func_name);
-   if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, az|z, array, 
tmp, userdata) == FAILURE) {
+   if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, zz|z, array, 
tmp, userdata) == FAILURE) {
return;
}
target_hash = HASH_OF(array);
@@ -1169,7 +1169,7 @@
HashTable *target_hash;
 
old_walk_func_name = BG(array_walk_func_name);
-   if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, az|z, array, 
tmp, userdata) == FAILURE) {
+   if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, zz|z, array, 
tmp, userdata) == FAILURE) {
return;
}
target_hash = HASH_OF(array);
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/array/array_walk.phpt?r1=1.1.2.3r2=1.1.2.4diff_format=u
Index: php-src/ext/standard/tests/array/array_walk.phpt
diff -u php-src/ext/standard/tests/array/array_walk.phpt:1.1.2.3 
php-src/ext/standard/tests/array/array_walk.phpt:1.1.2.4
--- php-src/ext/standard/tests/array/array_walk.phpt:1.1.2.3Tue Sep 19 
09:07:56 2006
+++ php-src/ext/standard/tests/array/array_walk.phptTue Sep 19 09:35:27 2006
@@ -34,8 +34,8 @@
 Warning: array_walk() expects at least 2 parameters, 0 given in %s on line %d
 NULL
 
-Warning: array_walk() expects parameter 1 to be array, integer given in %s on 
line %d
-NULL
+Warning: array_walk(): The argument should be an array in %s on line %d
+bool(false)
 bool(true)
 int(1)
 int(0)
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/array/array_walk_recursive1.phpt?r1=1.1.2.3r2=1.1.2.4diff_format=u
Index: php-src/ext/standard/tests/array/array_walk_recursive1.phpt
diff -u php-src/ext/standard/tests/array/array_walk_recursive1.phpt:1.1.2.3 
php-src/ext/standard/tests/array/array_walk_recursive1.phpt:1.1.2.4
--- php-src/ext/standard/tests/array/array_walk_recursive1.phpt:1.1.2.3 Tue Sep 
19 09:07:56 2006
+++ php-src/ext/standard/tests/array/array_walk_recursive1.phpt Tue Sep 19 
09:35:27 2006
@@ -34,8 +34,8 @@
 Warning: array_walk_recursive() expects at least 2 parameters, 0 given in %s 
on line %d
 NULL
 
-Warning: array_walk_recursive() expects parameter 1 to be array, integer given 
in %s on line %d
-NULL
+Warning: array_walk_recursive(): The argument should be an array in %s on line 
%d
+bool(false)
 bool(true)
 int(1)
 int(0)

http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/array/array_walk_objects.phpt?view=markuprev=1.1
Index: php-src/ext/standard/tests/array/array_walk_objects.phpt
+++ php-src/ext/standard/tests/array/array_walk_objects.phpt
--TEST--
array_walk() and objects
--FILE--
?php

function walk($key, $value) { 
var_dump($value, $key); 
}

class test {
private $var_pri = test_private;
protected $var_pro = test_protected;
public $var_pub = test_public;
}

$stdclass = new stdclass;
$stdclass-foo = foo;
$stdclass-bar = bar;
array_walk($stdclass, walk);

$t = new test;
array_walk($t, walk);

$var = array();
array_walk($var, walk);
$var = ;
array_walk($var, walk);

echo Done\n;
?
--EXPECTF-- 
string(3) foo
string(3) foo
string(3) bar
string(3) bar
string(13) 
string(12) test_private
string(10) 
string(14) test_protected
string(7) var_pub
string(11) test_public

Warning: array_walk(): The argument should be an array in %s on line %d
Done
--UEXPECTF--
unicode(3) foo
unicode(3) foo
unicode(3) bar
unicode(3) bar
unicode(13) 
unicode(12) test_private
unicode(10) 
unicode(14) test_protected
unicode(7) var_pub
unicode(11) test_public

Warning: array_walk(): The argument should be an array in %s on line %d
Done

http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/array/array_walk_rec_objects.phpt?view=markuprev=1.1
Index: 

[PHP-CVS] cvs: php-src(PHP_5_2) /ext/standard array.c

2006-07-29 Thread Andrei Zmievski
andrei  Sun Jul 30 03:31:18 2006 UTC

  Modified files:  (Branch: PHP_5_2)
/php-src/ext/standard   array.c 
  Log:
  Make array_merge(_recursive) handle binary keys safely. (Patch by Matt W)
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/array.c?r1=1.308.2.21.2.8r2=1.308.2.21.2.9diff_format=u
Index: php-src/ext/standard/array.c
diff -u php-src/ext/standard/array.c:1.308.2.21.2.8 
php-src/ext/standard/array.c:1.308.2.21.2.9
--- php-src/ext/standard/array.c:1.308.2.21.2.8 Mon Jul 24 18:18:33 2006
+++ php-src/ext/standard/array.cSun Jul 30 03:31:18 2006
@@ -21,7 +21,7 @@
+--+
 */
 
-/* $Id: array.c,v 1.308.2.21.2.8 2006/07/24 18:18:33 andrei Exp $ */
+/* $Id: array.c,v 1.308.2.21.2.9 2006/07/30 03:31:18 andrei Exp $ */
 
 #include php.h
 #include php_ini.h
@@ -2328,7 +2328,7 @@
} else {
(*src_entry)-refcount++;
 
-   zend_hash_update(dest, string_key, 
strlen(string_key)+1,
+   zend_hash_update(dest, string_key, 
string_key_len,
 
src_entry, sizeof(zval *), NULL);
}
break;

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



[PHP-CVS] cvs: php-src(PHP_5_2) /ext/standard array.c

2006-07-24 Thread Andrei Zmievski
andrei  Mon Jul 24 18:18:33 2006 UTC

  Modified files:  (Branch: PHP_5_2)
/php-src/ext/standard   array.c 
  Log:
  +1 for keys
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/array.c?r1=1.308.2.21.2.7r2=1.308.2.21.2.8diff_format=u
Index: php-src/ext/standard/array.c
diff -u php-src/ext/standard/array.c:1.308.2.21.2.7 
php-src/ext/standard/array.c:1.308.2.21.2.8
--- php-src/ext/standard/array.c:1.308.2.21.2.7 Sat Jul 22 16:58:39 2006
+++ php-src/ext/standard/array.cMon Jul 24 18:18:33 2006
@@ -21,7 +21,7 @@
+--+
 */
 
-/* $Id: array.c,v 1.308.2.21.2.7 2006/07/22 16:58:39 andrei Exp $ */
+/* $Id: array.c,v 1.308.2.21.2.8 2006/07/24 18:18:33 andrei Exp $ */
 
 #include php.h
 #include php_ini.h
@@ -4551,7 +4551,7 @@
 zend_hash_get_current_data_ex(Z_ARRVAL_P(values), (void 
**)entry_values, pos_values) == SUCCESS) {
if (Z_TYPE_PP(entry_keys) == IS_STRING) {
zval_add_ref(entry_values);
-   add_assoc_zval_ex(return_value, 
Z_STRVAL_PP(entry_keys), Z_STRLEN_PP(entry_keys), *entry_values);
+   add_assoc_zval_ex(return_value, 
Z_STRVAL_PP(entry_keys), Z_STRLEN_PP(entry_keys)+1, *entry_values);
} else if (Z_TYPE_PP(entry_keys) == IS_LONG) {
zval_add_ref(entry_values);
add_index_zval(return_value, Z_LVAL_PP(entry_keys), 
*entry_values);

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



[PHP-CVS] cvs: php-src(PHP_5_2) /ext/standard array.c

2006-07-22 Thread Andrei Zmievski
andrei  Sat Jul 22 16:58:07 2006 UTC

  Modified files:  (Branch: PHP_5_2)
/php-src/ext/standard   array.c 
  Log:
  Matt should be happy now.
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/array.c?r1=1.308.2.21.2.5r2=1.308.2.21.2.6diff_format=u
Index: php-src/ext/standard/array.c
diff -u php-src/ext/standard/array.c:1.308.2.21.2.5 
php-src/ext/standard/array.c:1.308.2.21.2.6
--- php-src/ext/standard/array.c:1.308.2.21.2.5 Fri Jul 21 23:54:19 2006
+++ php-src/ext/standard/array.cSat Jul 22 16:58:06 2006
@@ -21,7 +21,7 @@
+--+
 */
 
-/* $Id: array.c,v 1.308.2.21.2.5 2006/07/21 23:54:19 andrei Exp $ */
+/* $Id: array.c,v 1.308.2.21.2.6 2006/07/22 16:58:06 andrei Exp $ */
 
 #include php.h
 #include php_ini.h
@@ -4522,7 +4522,7 @@
 /* }}} */
 
 /* {{{ proto array array_combine(array keys, array values)
-   Creates an array by using the elements of the first parameter as keys and 
the elements of the second as corresponding keys */
+   Creates an array by using the elements of the first parameter as keys and 
the elements of the second as the corresponding keys */
 PHP_FUNCTION(array_combine)
 {
zval *values, *keys;
@@ -4551,7 +4551,7 @@
 zend_hash_get_current_data_ex(Z_ARRVAL_P(values), (void 
**)entry_values, pos_values) == SUCCESS) {
if (Z_TYPE_PP(entry_keys) == IS_STRING) {
zval_add_ref(entry_values);
-   add_assoc_zval(return_value, Z_STRVAL_PP(entry_keys), 
*entry_values);
+   add_assoc_zval_ex(return_value, 
Z_STRVAL_PP(entry_keys), Z_STRLEN_PP(entry_keys), *entry_values);
} else if (Z_TYPE_PP(entry_keys) == IS_LONG) {
zval_add_ref(entry_values);
add_index_zval(return_value, Z_LVAL_PP(entry_keys), 
*entry_values);

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



[PHP-CVS] cvs: php-src(PHP_5_2) /ext/standard array.c

2006-07-21 Thread Andrei Zmievski
andrei  Fri Jul 21 23:54:19 2006 UTC

  Modified files:  (Branch: PHP_5_2)
/php-src/ext/standard   array.c 
  Log:
  MFH
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/array.c?r1=1.308.2.21.2.4r2=1.308.2.21.2.5diff_format=u
Index: php-src/ext/standard/array.c
diff -u php-src/ext/standard/array.c:1.308.2.21.2.4 
php-src/ext/standard/array.c:1.308.2.21.2.5
--- php-src/ext/standard/array.c:1.308.2.21.2.4 Sat Jul 15 12:14:07 2006
+++ php-src/ext/standard/array.cFri Jul 21 23:54:19 2006
@@ -21,7 +21,7 @@
+--+
 */
 
-/* $Id: array.c,v 1.308.2.21.2.4 2006/07/15 12:14:07 helly Exp $ */
+/* $Id: array.c,v 1.308.2.21.2.5 2006/07/21 23:54:19 andrei Exp $ */
 
 #include php.h
 #include php_ini.h
@@ -4522,7 +4522,7 @@
 /* }}} */
 
 /* {{{ proto array array_combine(array keys, array values)
-   Creates an array by using the elements of the first parameter as keys and 
the elements of the second as correspoding keys */
+   Creates an array by using the elements of the first parameter as keys and 
the elements of the second as corresponding keys */
 PHP_FUNCTION(array_combine)
 {
zval *values, *keys;
@@ -4534,7 +4534,7 @@
}
 
if (zend_hash_num_elements(Z_ARRVAL_P(keys)) != 
zend_hash_num_elements(Z_ARRVAL_P(values))) {
-   php_error_docref(NULL TSRMLS_CC, E_WARNING, Both parameters 
should have equal number of elements);
+   php_error_docref(NULL TSRMLS_CC, E_WARNING, Both parameters 
should have an equal number of elements);
RETURN_FALSE;
}
 
@@ -4563,7 +4563,7 @@
convert_to_string(key);
 
zval_add_ref(entry_values);
-   add_assoc_zval(return_value, Z_STRVAL(key), 
*entry_values);
+   add_assoc_zval_ex(return_value, Z_STRVAL(key), 
Z_STRLEN(key)+1, *entry_values);
 
zval_dtor(key);
}

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



[PHP-CVS] cvs: php-src(PHP_5_2) /ext/standard array.c formatted_print.c levenshtein.c metaphone.c streamsfuncs.c string.c url.c uuencode.c versioning.c

2006-06-26 Thread Hannes Magnusson
bjori   Mon Jun 26 18:48:56 2006 UTC

  Modified files:  (Branch: PHP_5_2)
/php-src/ext/standard   array.c formatted_print.c levenshtein.c 
metaphone.c streamsfuncs.c string.c url.c 
uuencode.c versioning.c 
  Log:
  Updated protos  vim folding
  
  http://cvs.php.net/viewvc.cgi/php-src/ext/standard/array.c?r1=1.308.2.21.2.1r2=1.308.2.21.2.2diff_format=u
Index: php-src/ext/standard/array.c
diff -u php-src/ext/standard/array.c:1.308.2.21.2.1 
php-src/ext/standard/array.c:1.308.2.21.2.2
--- php-src/ext/standard/array.c:1.308.2.21.2.1 Sat Jun  3 18:56:44 2006
+++ php-src/ext/standard/array.cMon Jun 26 18:48:56 2006
@@ -21,7 +21,7 @@
+--+
 */
 
-/* $Id: array.c,v 1.308.2.21.2.1 2006/06/03 18:56:44 andrei Exp $ */
+/* $Id: array.c,v 1.308.2.21.2.2 2006/06/26 18:48:56 bjori Exp $ */
 
 #include php.h
 #include php_ini.h
@@ -224,7 +224,7 @@
return array_key_compare(a, b TSRMLS_CC) * -1;
 }
 
-/* {{{ proto bool krsort(array array_arg [, int sort_flags])
+/* {{{ proto bool krsort(array array_arg [, int sort_flags])
Sort an array by key value in reverse order */
 PHP_FUNCTION(krsort)
 {
@@ -246,7 +246,7 @@
 }
 /* }}} */
 
-/* {{{ proto bool ksort(array array_arg [, int sort_flags])
+/* {{{ proto bool ksort(array array_arg [, int sort_flags])
Sort an array by key */
 PHP_FUNCTION(ksort)
 {
@@ -459,7 +459,7 @@
 }
 
 
-/* {{{ proto void natsort(array array_arg)
+/* {{{ proto void natsort(array array_arg)
Sort an array using natural sort */
 PHP_FUNCTION(natsort)
 {
@@ -468,7 +468,7 @@
 /* }}} */
 
 
-/* {{{ proto void natcasesort(array array_arg)
+/* {{{ proto void natcasesort(array array_arg)
Sort an array using case-insensitive natural sort */
 PHP_FUNCTION(natcasesort)
 {
@@ -477,7 +477,7 @@
 /* }}} */
 
 
-/* {{{ proto bool asort(array array_arg [, int sort_flags])
+/* {{{ proto bool asort(array array_arg [, int sort_flags])
Sort an array and maintain index association */
 PHP_FUNCTION(asort)
 {
@@ -499,7 +499,7 @@
 }
 /* }}} */
 
-/* {{{ proto bool arsort(array array_arg [, int sort_flags])
+/* {{{ proto bool arsort(array array_arg [, int sort_flags])
Sort an array in reverse order and maintain index association */
 PHP_FUNCTION(arsort)
 {
@@ -521,7 +521,7 @@
 }
 /* }}} */
 
-/* {{{ proto bool sort(array array_arg [, int sort_flags])
+/* {{{ proto bool sort(array array_arg [, int sort_flags])
Sort an array */
 PHP_FUNCTION(sort)
 {
@@ -543,7 +543,7 @@
 }
 /* }}} */
 
-/* {{{ proto bool rsort(array array_arg [, int sort_flags])
+/* {{{ proto bool rsort(array array_arg [, int sort_flags])
Sort an array in reverse order */
 PHP_FUNCTION(rsort)
 {
@@ -2151,7 +2151,7 @@
 /* }}} */
 
 
-/* {{{ proto array array_slice(array input, int offset [, int length])
+/* {{{ proto array array_slice(array input, int offset [, int length [, bool 
preserve_keys]])
Returns elements specified by offset and length */
 PHP_FUNCTION(array_slice)
 {
@@ -3179,6 +3179,7 @@
php_array_intersect(INTERNAL_FUNCTION_PARAM_PASSTHRU, INTERSECT_KEY,
INTERSECT_COMP_DATA_INTERNAL, 
INTERSECT_COMP_KEY_INTERNAL);
 }
+/* }}} */
 
 /* {{{ proto array array_intersect_ukey(array arr1, array arr2 [, array ...], 
callback key_compare_func)
Returns the entries of arr1 that have keys which are present in all the 
other arguments. Kind of equivalent to array_diff(array_keys($arr1), 
array_keys($arr2)[,array_keys(...)]). The comparison of the keys is performed 
by a user supplied function. Equivalent of array_intersect_uassoc() but does 
not do compare of the data. */
@@ -3187,7 +3188,7 @@
php_array_intersect(INTERNAL_FUNCTION_PARAM_PASSTHRU, INTERSECT_KEY,
INTERSECT_COMP_DATA_INTERNAL, 
INTERSECT_COMP_KEY_USER);
 }
-
+/* }}} */
 
 /* {{{ proto array array_intersect(array arr1, array arr2 [, array ...])
Returns the entries of arr1 that have values which are present in all the 
other arguments */
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/formatted_print.c?r1=1.82.2.1r2=1.82.2.1.2.1diff_format=u
Index: php-src/ext/standard/formatted_print.c
diff -u php-src/ext/standard/formatted_print.c:1.82.2.1 
php-src/ext/standard/formatted_print.c:1.82.2.1.2.1
--- php-src/ext/standard/formatted_print.c:1.82.2.1 Sun Jan  1 12:50:14 2006
+++ php-src/ext/standard/formatted_print.c  Mon Jun 26 18:48:56 2006
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: formatted_print.c,v 1.82.2.1 2006/01/01 12:50:14 sniper Exp $ */
+/* $Id: formatted_print.c,v 1.82.2.1.2.1 2006/06/26 18:48:56 bjori Exp $ */
 
 #include math.h  /* modf() */
 #include php.h
@@ -853,6 +853,7 @@
 
RETURN_LONG(len);
 }
+/* }}} */
 
 /* {{{ proto int vfprintf(resource stream, string format, array args)

[PHP-CVS] cvs: php-src(PHP_5_2) /ext/standard array.c php_array.h

2006-06-03 Thread Andrei Zmievski
andrei  Sat Jun  3 18:56:44 2006 UTC

  Modified files:  (Branch: PHP_5_2)
/php-src/ext/standard   array.c php_array.h 
  Log:
  I swear it wasn't me.
  
  
http://cvs.php.net/viewcvs.cgi/php-src/ext/standard/array.c?r1=1.308.2.21r2=1.308.2.21.2.1diff_format=u
Index: php-src/ext/standard/array.c
diff -u php-src/ext/standard/array.c:1.308.2.21 
php-src/ext/standard/array.c:1.308.2.21.2.1
--- php-src/ext/standard/array.c:1.308.2.21 Wed Apr 12 19:30:52 2006
+++ php-src/ext/standard/array.cSat Jun  3 18:56:44 2006
@@ -21,7 +21,7 @@
+--+
 */
 
-/* $Id: array.c,v 1.308.2.21 2006/04/12 19:30:52 johannes Exp $ */
+/* $Id: array.c,v 1.308.2.21.2.1 2006/06/03 18:56:44 andrei Exp $ */
 
 #include php.h
 #include php_ini.h
@@ -92,6 +92,8 @@
 
 #define DOUBLE_DRIFT_FIX   0.001
 
+ZEND_DECLARE_MODULE_GLOBALS(array)
+
 /* {{{ php_array_init_globals
  */
 static void php_array_init_globals(zend_array_globals *array_globals)
http://cvs.php.net/viewcvs.cgi/php-src/ext/standard/php_array.h?r1=1.50.2.2r2=1.50.2.2.2.1diff_format=u
Index: php-src/ext/standard/php_array.h
diff -u php-src/ext/standard/php_array.h:1.50.2.2 
php-src/ext/standard/php_array.h:1.50.2.2.2.1
--- php-src/ext/standard/php_array.h:1.50.2.2   Tue Feb  7 17:54:24 2006
+++ php-src/ext/standard/php_array.hSat Jun  3 18:56:44 2006
@@ -19,7 +19,7 @@
+--+
 */
 
-/* $Id: php_array.h,v 1.50.2.2 2006/02/07 17:54:24 andrei Exp $ */
+/* $Id: php_array.h,v 1.50.2.2.2.1 2006/06/03 18:56:44 andrei Exp $ */
 
 #ifndef PHP_ARRAY_H
 #define PHP_ARRAY_H
@@ -108,8 +108,6 @@
int (*compare_func)(zval *result, zval *op1, zval *op2 TSRMLS_DC);
 ZEND_END_MODULE_GLOBALS(array) 
 
-ZEND_DECLARE_MODULE_GLOBALS(array)
-
 #ifdef ZTS
 #define ARRAYG(v) TSRMG(array_globals_id, zend_array_globals *, v)
 #else

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