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

2009-05-10 Thread Johannes Schlüter
On Sun, 2009-05-10 at 16:45 +, Etienne Kneuss wrote:
 colderSun May 10 16:45:21 2009 UTC
 
   Modified files:  (Branch: PHP_5_3)
 /php-src/ext/standard array.c 
   Log:
   MFB: Fix #48224 (Remove incorrect shuffle)

Any chance to cover this in a test? - I know it involves randomness.

Maybe multiple calls to array_rand() and check if it's always in right
order or something?

johannes



-- 
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_3) /ext/standard array.c

2009-05-10 Thread Etienne Kneuss
2009/5/10 Johannes Schlüter johan...@php.net:
 On Sun, 2009-05-10 at 16:45 +, Etienne Kneuss wrote:
 colder                Sun May 10 16:45:21 2009 UTC

   Modified files:              (Branch: PHP_5_3)
     /php-src/ext/standard     array.c
   Log:
   MFB: Fix #48224 (Remove incorrect shuffle)

 Any chance to cover this in a test? - I know it involves randomness.

 Maybe multiple calls to array_rand() and check if it's always in right
 order or something?

Yeah, I added a === check which should have a low probability of
passing with shuffles


 johannes






-- 
Etienne Kneuss
http://www.colder.ch

Men never do evil so completely and cheerfully as
when they do it from a religious conviction.
-- Pascal

--
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_3) /ext/standard array.c

2008-12-12 Thread Hannes Magnusson
Could you maybe fix the at-least-four-tests that broke, and maybe add
a new test for this feature? :)
And NEWS entry, [DOC], update the wiki...

-Hannes

On Fri, Dec 12, 2008 at 20:20, Andrei Zmievski and...@php.net wrote:
 andrei  Fri Dec 12 19:20:49 2008 UTC

  Modified files:  (Branch: PHP_5_3)
/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.37.2.47r2=1.308.2.21.2.37.2.48diff_format=u
 Index: php-src/ext/standard/array.c
 diff -u php-src/ext/standard/array.c:1.308.2.21.2.37.2.47 
 php-src/ext/standard/array.c:1.308.2.21.2.37.2.48
 --- php-src/ext/standard/array.c:1.308.2.21.2.37.2.47   Wed Nov 26 00:59:41 
 2008
 +++ php-src/ext/standard/array.cFri Dec 12 19:20:49 2008
 @@ -21,7 +21,7 @@
+--+
  */

 -/* $Id: array.c,v 1.308.2.21.2.37.2.47 2008/11/26 00:59:41 lbarnaud Exp $ */
 +/* $Id: array.c,v 1.308.2.21.2.37.2.48 2008/12/12 19:20:49 andrei Exp $ */

  #include php.h
  #include php_ini.h
 @@ -2668,7 +2668,7 @@
  }
  /* }}} */

 -/* {{{ proto array array_unique(array input)
 +/* {{{ proto array array_unique(array input [, int sort_flags])
Removes duplicate values from array */
  PHP_FUNCTION(array_unique)
  {
 @@ -2680,11 +2680,14 @@
};
struct bucketindex *arTmp, *cmpdata, *lastkept;
unsigned int i;
 +   long sort_type = PHP_SORT_REGULAR;

 -   if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, a, array) == 
 FAILURE) {
 +   if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, a|l, array, 
 sort_type) == FAILURE) {
return;
}

 +   php_set_compare_func(sort_type TSRMLS_CC);
 +
array_init_size(return_value, 
 zend_hash_num_elements(Z_ARRVAL_P(array)));
zend_hash_copy(Z_ARRVAL_P(return_value), Z_ARRVAL_P(array), 
 (copy_ctor_func_t) zval_add_ref, (void *)tmp, sizeof(zval*));

 @@ -2703,7 +2706,6 @@
arTmp[i].i = i;
}
arTmp[i].b = NULL;
 -   php_set_compare_func(PHP_SORT_STRING TSRMLS_CC);
zend_qsort((void *) arTmp, i, sizeof(struct bucketindex), 
 php_array_data_compare TSRMLS_CC);

/* go through the sorted array and delete duplicates from the copy */



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



-- 
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_3) /ext/standard array.c

2008-12-12 Thread Andrei Zmievski
Easy, there. I realized that there were 4 tests that broke after committing it. The issue 
is that I made SORT_REGULAR to be the default, which is not what the tests were expecting. 
 The easiest way to fix the tests is to make them pass SORT_STRING to array_unique(), I 
guess.


The rest is coming.

-Andrei

Hannes Magnusson wrote:

Could you maybe fix the at-least-four-tests that broke, and maybe add
a new test for this feature? :)
And NEWS entry, [DOC], update the wiki...



--
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_3) /ext/standard array.c basic_functions.c

2008-11-25 Thread Antony Dovgal
On 24.11.2008 21:12, Stanislav Malyshev wrote:
 stas  Mon Nov 24 18:12:17 2008 UTC
 
   Modified files:  (Branch: PHP_5_3)
 /php-src/ext/standard array.c basic_functions.c 
   Log:
   restore BC for arrays
   [DOC] natsort, natcasesort, usort, uasort, uksort, array_flip, array_unique 
   still won't work with objects

All these tests fail after your patch:

/local/qa/5_3.zts/ext/standard/tests/array/array_key_exists.phpt
/local/qa/5_3.zts/ext/standard/tests/array/array_key_exists_object1.phpt
/local/qa/5_3.zts/ext/standard/tests/array/array_key_exists_object2.phpt
/local/qa/5_3.zts/ext/standard/tests/array/array_key_exists_variation2.phpt
/local/qa/5_3.zts/ext/standard/tests/array/array_walk_object1.phpt
/local/qa/5_3.zts/ext/standard/tests/array/array_walk_objects.phpt
/local/qa/5_3.zts/ext/standard/tests/array/array_walk_rec_objects.phpt
/local/qa/5_3.zts/ext/standard/tests/array/array_walk_recursive_object1.phpt
/local/qa/5_3.zts/ext/standard/tests/array/current_variation1.phpt
/local/qa/5_3.zts/ext/standard/tests/array/end_variation1.phpt
/local/qa/5_3.zts/ext/standard/tests/array/key_variation1.phpt
/local/qa/5_3.zts/ext/standard/tests/array/next_variation1.phpt
/local/qa/5_3.zts/ext/standard/tests/array/prev_variation1.phpt
/local/qa/5_3.zts/ext/standard/tests/array/reset_variation1.phpt

-- 
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_3) /ext/standard array.c basic_functions.c

2008-11-25 Thread Stanislav Malyshev

Hi!


All these tests fail after your patch:

/local/qa/5_3.zts/ext/standard/tests/array/array_key_exists.phpt
/local/qa/5_3.zts/ext/standard/tests/array/array_key_exists_object1.phpt
/local/qa/5_3.zts/ext/standard/tests/array/array_key_exists_object2.phpt
/local/qa/5_3.zts/ext/standard/tests/array/array_key_exists_variation2.phpt
/local/qa/5_3.zts/ext/standard/tests/array/array_walk_object1.phpt
/local/qa/5_3.zts/ext/standard/tests/array/array_walk_objects.phpt
/local/qa/5_3.zts/ext/standard/tests/array/array_walk_rec_objects.phpt
/local/qa/5_3.zts/ext/standard/tests/array/array_walk_recursive_object1.phpt
/local/qa/5_3.zts/ext/standard/tests/array/current_variation1.phpt
/local/qa/5_3.zts/ext/standard/tests/array/end_variation1.phpt
/local/qa/5_3.zts/ext/standard/tests/array/key_variation1.phpt
/local/qa/5_3.zts/ext/standard/tests/array/next_variation1.phpt
/local/qa/5_3.zts/ext/standard/tests/array/prev_variation1.phpt
/local/qa/5_3.zts/ext/standard/tests/array/reset_variation1.phpt


These tests expect BC breakage, which this patch fixes. So they need to 
be fixed, I guess.

--
Stanislav Malyshev, Zend Software Architect
[EMAIL PROTECTED]   http://www.zend.com/
(408)253-8829   MSN: [EMAIL PROTECTED]

--
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_3) /ext/standard array.c basic_functions.c

2008-11-25 Thread Antony Dovgal
On 25.11.2008 12:15, Stanislav Malyshev wrote:
 Hi!
 
 All these tests fail after your patch:
...
 These tests expect BC breakage, which this patch fixes. So they need to 
 be fixed, I guess.

Does this mean you didn't run the tests before applying the patch?
Or does this mean you've just ignored them?

In either case, please fix the tests, if you're sure they need fixing.

-- 
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_3) /ext/standard array.c assert.c basic_functions.c browscap.c crypt.c file.c filestat.c head.c html.c http.c info.c mail.c math.c proc_open.c rand.c streamsfuncs.c st

2008-10-22 Thread Nuno Lopes

Hey, hey, what are you doing?
I assume you're reading the 
http://gcov.php.net/viewer.php?version=PHP_5_3func=params page. That script 
is very dumb and unfortunately shows many false positives. I did a cursory 
review of your commits and most of the changes you did aren't necessary (in 
fact they can degrade the performance).
This year I was hoping to get a student from the GSoC project to improve 
this analyzer, but I didn't. Let's hope next year we can get one :P (if 
someone is interested please contact me!)


In the mean time, please don't assume that script is 100% right. Please 
always look to the code first to check if the initialization is really 
needed.


Thanks,
Nuno

- Original Message - 
From: Arnaud Le Blanc [EMAIL PROTECTED]

To: php-cvs@lists.php.net
Sent: Tuesday, October 21, 2008 11:08 PM
Subject: [PHP-CVS] cvs: php-src(PHP_5_3) /ext/standard array.c assert.c 
basic_functions.c browscap.c crypt.c file.c filestat.c head.c html.c http.c 
info.c mail.c math.c proc_open.c rand.c streamsfuncs.c string.c type.c 
versioning.c




lbarnaud Tue Oct 21 22:08:39 2008 UTC

 Modified files:  (Branch: PHP_5_3)
   /php-src/ext/standard array.c assert.c basic_functions.c browscap.c
crypt.c file.c filestat.c head.c html.c
http.c info.c mail.c math.c proc_open.c
rand.c streamsfuncs.c string.c type.c
versioning.c
 Log:
 MFH: initialize optional vars 



--
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_3) /ext/standard array.c string.c var_unserializer.re ZendEngine2 zend_API.c zend_API.h zend_builtin_functions.c zend_object_handlers.c

2008-06-02 Thread Antony Dovgal

Please do not forget to run Valgrind when you commit patches like this (i.e. 
affecting the basics of the engine).
If you're a Windows user, you can either wait for gcov.php.net reports or ask 
me about it (I do valgrind runs every day anyway).

On 27.05.2008 14:29, Matt Wilmas wrote:

mattwil Tue May 27 10:29:34 2008 UTC

  Modified files:  (Branch: PHP_5_3)
/ZendEngine2	zend_API.c zend_API.h zend_builtin_functions.c 
	zend_object_handlers.c 
/php-src/ext/standard	array.c string.c var_unserializer.re 
  Log:

  MFH: Add array_init_size() and use it where array size is known at 
initialization




--
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_3) /ext/standard array.c

2008-02-12 Thread Felipe Pena
Em Ter, 2008-02-12 às 18:50 +0100, Hannes Magnusson escreveu:
 On Feb 12, 2008 2:31 AM, Felipe Pena [EMAIL PROTECTED] wrote:
  felipe  Tue Feb 12 01:31:12 2008 UTC
 
Modified files:  (Branch: PHP_5_3)
  /php-src/ext/standard   array.c
Log:
array_slice() - Fixed behavior when NULL is given in third parameter (BC)
 
 This is starting to be pretty damn funny.
 AFAICS this is the 4th attempt (in 3weeks) to fix the exact same bug,
 doesn't anyone have a test case specifcally for this bug?
 I know there are bunch of array_splice_*.phpt tests, but this bug
 really deserves its own test case.
 
 -Hannes
 

Yesterday I added a test case for this bug.

-- 
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_3) /ext/standard array.c

2008-02-12 Thread Hannes Magnusson
On Feb 12, 2008 2:31 AM, Felipe Pena [EMAIL PROTECTED] wrote:
 felipe  Tue Feb 12 01:31:12 2008 UTC

   Modified files:  (Branch: PHP_5_3)
 /php-src/ext/standard   array.c
   Log:
   array_slice() - Fixed behavior when NULL is given in third parameter (BC)

This is starting to be pretty damn funny.
AFAICS this is the 4th attempt (in 3weeks) to fix the exact same bug,
doesn't anyone have a test case specifcally for this bug?
I know there are bunch of array_splice_*.phpt tests, but this bug
really deserves its own test case.

-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_3) /ext/standard array.c /ext/standard/tests/array array_slice.phpt bug43541.phpt

2007-12-11 Thread Steph Fox

Hi Jani,

Thanks!

I split the existing array_slice.phpt into five (see bug report) because the 
output's unusable, but they'll need updating now because they were aimed at 
the 'no change' version. I'll do it later in the week.


- Steph

- Original Message - 
From: Jani Taskinen [EMAIL PROTECTED]

To: php-cvs@lists.php.net
Sent: Tuesday, December 11, 2007 9:47 AM
Subject: [PHP-CVS] cvs: php-src(PHP_5_3) /ext/standard array.c 
/ext/standard/tests/array array_slice.phpt bug43541.phpt




jani Tue Dec 11 09:47:21 2007 UTC

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

 Modified files:
   /php-src/ext/standard array.c
   /php-src/ext/standard/tests/array array_slice.phpt
 Log:
 MFH: - Fixed bug #43541








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


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