php-developer-list | 2002112
Date: 11/16/02
- Next message: Michael Mauch: "Re: [PHP-DEV] Re: #19259 [Csd->Ctl]: sort-functions don't work"
- Previous message: Andi Gutmans: "Re: [PHP-DEV] ZEND_ADD_STRING patch"
- Next in thread: Michael Mauch: "Re: [PHP-DEV] Re: #19259 [Csd->Ctl]: sort-functions don't work"
- Reply: Michael Mauch: "Re: [PHP-DEV] Re: #19259 [Csd->Ctl]: sort-functions don't work"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Thanks it looks good - applied.
marcus
At 16:29 16.11.2002, Michael Mauch wrote:
>I wrote:
>
>>These test results scared me as well, but it looks like this array test
>>itsself is flawed: it relies on the fact that integers automatically wrap
>>around to negative values at INT_MAX (=2147483647 on 32 bit machines).
>
>Attaching a patch for the array test: I changed the array in data.inc
>to have only "normal" values (1000 and -1000) instead of 2147483647 and
>-2147483647, and used the output of the tests on a 32 bit Linux machine to
>be the expected result. With the patch, all three tests PASSed on the 64
>bit Tru64 machine. So array sorting is fortunately not broken again on Tru64.
>
>Regards...
> Michael
>
>
>diff -r -u ../php-cvs/php4/ext/standard/tests/array/001.phpt
>ext/standard/tests/array/001.phpt
>--- ../php-cvs/php4/ext/standard/tests/array/001.phpt Sat Nov 9
>11:42:49 2002
>+++ ext/standard/tests/array/001.phpt Sat Nov 16 16:08:01 2002
>@@ -57,7 +57,7 @@
> int(27)
> [3]=>
> string(4) "test"
>- ["-2147483647"]=>
>+ ["-1000"]=>
> array(2) {
> [0]=>
> string(6) "banana"
>@@ -113,7 +113,7 @@
> int(27)
> int(3)
> string(4) "test"
>-string(11) "-2147483647"
>+string(5) "-1000"
> array(2) {
> [0]=>
> string(6) "banana"
>diff -r -u ../php-cvs/php4/ext/standard/tests/array/002.phpt
>ext/standard/tests/array/002.phpt
>--- ../php-cvs/php4/ext/standard/tests/array/002.phpt Sat Nov 9
>11:42:49 2002
>+++ ext/standard/tests/array/002.phpt Sat Nov 16 16:07:14 2002
>@@ -24,16 +24,43 @@
> var_dump ($data);
> }
>
>+echo "Unsorted data:\n";
>+var_dump ($data);
> foreach (array ('arsort', 'asort', 'krsort', 'ksort', 'rsort', 'sort')
> as $test_function) {
> test_sort ($test_function, $data);
> }
>
> ?>
> --EXPECT--
>--- Testing arsort() --
>+Unsorted data:
>+array(8) {
>+ [0]=>
>+ string(3) "PHP"
>+ [17]=>
>+ string(27) "PHP: Hypertext Preprocessor"
>+ [5]=>
>+ string(4) "Test"
>+ ["test"]=>
>+ int(27)
>+ [1000]=>
>+ string(4) "test"
>+ ["-1000"]=>
>+ array(2) {
>+ [0]=>
>+ string(6) "banana"
>+ [1]=>
>+ string(6) "orange"
>+ }
>+ [1001]=>
>+ string(6) "monkey"
>+ [16777216]=>
>+ float(-0.33333333333333)
>+}
>+
>+ -- Testing arsort() --
> No second argument:
> array(8) {
>- ["-2147483647"]=>
>+ ["-1000"]=>
> array(2) {
> [0]=>
> string(6) "banana"
>@@ -42,9 +69,9 @@
> }
> ["test"]=>
> int(27)
>- [2147483647]=>
>+ [1000]=>
> string(4) "test"
>- [-2147483648]=>
>+ [1001]=>
> string(6) "monkey"
> [5]=>
> string(4) "Test"
>@@ -57,7 +84,7 @@
> }
> Using SORT_REGULAR:
> array(8) {
>- ["-2147483647"]=>
>+ ["-1000"]=>
> array(2) {
> [0]=>
> string(6) "banana"
>@@ -66,9 +93,9 @@
> }
> ["test"]=>
> int(27)
>- [2147483647]=>
>+ [1000]=>
> string(4) "test"
>- [-2147483648]=>
>+ [1001]=>
> string(6) "monkey"
> [5]=>
> string(4) "Test"
>@@ -83,7 +110,7 @@
> array(8) {
> ["test"]=>
> int(27)
>- ["-2147483647"]=>
>+ ["-1000"]=>
> array(2) {
> [0]=>
> string(6) "banana"
>@@ -94,20 +121,20 @@
> string(3) "PHP"
> [17]=>
> string(27) "PHP: Hypertext Preprocessor"
>- [-2147483648]=>
>+ [1001]=>
> string(6) "monkey"
> [5]=>
> string(4) "Test"
>- [2147483647]=>
>+ [1000]=>
> string(4) "test"
> [16777216]=>
> float(-0.33333333333333)
> }
> Using SORT_STRING
> array(8) {
>- [2147483647]=>
>+ [1000]=>
> string(4) "test"
>- [-2147483648]=>
>+ [1001]=>
> string(6) "monkey"
> [5]=>
> string(4) "Test"
>@@ -115,7 +142,7 @@
> string(27) "PHP: Hypertext Preprocessor"
> [0]=>
> string(3) "PHP"
>- ["-2147483647"]=>
>+ ["-1000"]=>
> array(2) {
> [0]=>
> string(6) "banana"
>@@ -139,13 +166,13 @@
> string(27) "PHP: Hypertext Preprocessor"
> [5]=>
> string(4) "Test"
>- [-2147483648]=>
>+ [1001]=>
> string(6) "monkey"
>- [2147483647]=>
>+ [1000]=>
> string(4) "test"
> ["test"]=>
> int(27)
>- ["-2147483647"]=>
>+ ["-1000"]=>
> array(2) {
> [0]=>
> string(6) "banana"
>@@ -163,13 +190,13 @@
> string(27) "PHP: Hypertext Preprocessor"
> [5]=>
> string(4) "Test"
>- [-2147483648]=>
>+ [1001]=>
> string(6) "monkey"
>- [2147483647]=>
>+ [1000]=>
> string(4) "test"
> ["test"]=>
> int(27)
>- ["-2147483647"]=>
>+ ["-1000"]=>
> array(2) {
> [0]=>
> string(6) "banana"
>@@ -181,9 +208,9 @@
> array(8) {
> [16777216]=>
> float(-0.33333333333333)
>- [-2147483648]=>
>+ [1001]=>
> string(6) "monkey"
>- [2147483647]=>
>+ [1000]=>
> string(4) "test"
> [5]=>
> string(4) "Test"
>@@ -191,7 +218,7 @@
> string(27) "PHP: Hypertext Preprocessor"
> [0]=>
> string(3) "PHP"
>- ["-2147483647"]=>
>+ ["-1000"]=>
> array(2) {
> [0]=>
> string(6) "banana"
>@@ -207,7 +234,7 @@
> float(-0.33333333333333)
> ["test"]=>
> int(27)
>- ["-2147483647"]=>
>+ ["-1000"]=>
> array(2) {
> [0]=>
> string(6) "banana"
>@@ -220,19 +247,21 @@
> string(27) "PHP: Hypertext Preprocessor"
> [5]=>
> string(4) "Test"
>- [-2147483648]=>
>+ [1001]=>
> string(6) "monkey"
>- [2147483647]=>
>+ [1000]=>
> string(4) "test"
> }
>
> -- Testing krsort() --
> No second argument:
> array(8) {
>- [2147483647]=>
>- string(4) "test"
> [16777216]=>
> float(-0.33333333333333)
>+ [1001]=>
>+ string(6) "monkey"
>+ [1000]=>
>+ string(4) "test"
> [17]=>
> string(27) "PHP: Hypertext Preprocessor"
> [5]=>
>@@ -241,46 +270,46 @@
> int(27)
> [0]=>
> string(3) "PHP"
>- ["-2147483647"]=>
>+ ["-1000"]=>
> array(2) {
> [0]=>
> string(6) "banana"
> [1]=>
> string(6) "orange"
> }
>- [-2147483648]=>
>- string(6) "monkey"
> }
> Using SORT_REGULAR:
> array(8) {
>- [2147483647]=>
>- string(4) "test"
> [16777216]=>
> float(-0.33333333333333)
>+ [1001]=>
>+ string(6) "monkey"
>+ [1000]=>
>+ string(4) "test"
> [17]=>
> string(27) "PHP: Hypertext Preprocessor"
> [5]=>
> string(4) "Test"
>- ["test"]=>
>- int(27)
> [0]=>
> string(3) "PHP"
>- ["-2147483647"]=>
>+ ["test"]=>
>+ int(27)
>+ ["-1000"]=>
> array(2) {
> [0]=>
> string(6) "banana"
> [1]=>
> string(6) "orange"
> }
>- [-2147483648]=>
>- string(6) "monkey"
> }
> Using SORT_NUMERIC:
> array(8) {
>- [2147483647]=>
>- string(4) "test"
> [16777216]=>
> float(-0.33333333333333)
>+ [1001]=>
>+ string(6) "monkey"
>+ [1000]=>
>+ string(4) "test"
> [17]=>
> string(27) "PHP: Hypertext Preprocessor"
> [5]=>
>@@ -289,15 +318,13 @@
> int(27)
> [0]=>
> string(3) "PHP"
>- ["-2147483647"]=>
>+ ["-1000"]=>
> array(2) {
> [0]=>
> string(6) "banana"
> [1]=>
> string(6) "orange"
> }
>- [-2147483648]=>
>- string(6) "monkey"
> }
> Using SORT_STRING
> array(8) {
>@@ -305,17 +332,17 @@
> int(27)
> [5]=>
> string(4) "Test"
>- [2147483647]=>
>- string(4) "test"
> [17]=>
> string(27) "PHP: Hypertext Preprocessor"
> [16777216]=>
> float(-0.33333333333333)
>+ [1001]=>
>+ string(6) "monkey"
>+ [1000]=>
>+ string(4) "test"
> [0]=>
> string(3) "PHP"
>- [-2147483648]=>
>- string(6) "monkey"
>- ["-2147483647"]=>
>+ ["-1000"]=>
> array(2) {
> [0]=>
> string(6) "banana"
>@@ -327,9 +354,7 @@
> -- Testing ksort() --
> No second argument:
> array(8) {
>- [-2147483648]=>
>- string(6) "monkey"
>- ["-2147483647"]=>
>+ ["-1000"]=>
> array(2) {
> [0]=>
> string(6) "banana"
>@@ -344,16 +369,16 @@
> string(4) "Test"
> [17]=>
> string(27) "PHP: Hypertext Preprocessor"
>+ [1000]=>
>+ string(4) "test"
>+ [1001]=>
>+ string(6) "monkey"
> [16777216]=>
> float(-0.33333333333333)
>- [2147483647]=>
>- string(4) "test"
> }
> Using SORT_REGULAR:
> array(8) {
>- [-2147483648]=>
>- string(6) "monkey"
>- ["-2147483647"]=>
>+ ["-1000"]=>
> array(2) {
> [0]=>
> string(6) "banana"
>@@ -368,16 +393,16 @@
> string(4) "Test"
> [17]=>
> string(27) "PHP: Hypertext Preprocessor"
>+ [1000]=>
>+ string(4) "test"
>+ [1001]=>
>+ string(6) "monkey"
> [16777216]=>
> float(-0.33333333333333)
>- [2147483647]=>
>- string(4) "test"
> }
> Using SORT_NUMERIC:
> array(8) {
>- [-2147483648]=>
>- string(6) "monkey"
>- ["-2147483647"]=>
>+ ["-1000"]=>
> array(2) {
> [0]=>
> string(6) "banana"
>@@ -392,30 +417,32 @@
> string(4) "Test"
> [17]=>
> string(27) "PHP: Hypertext Preprocessor"
>+ [1000]=>
>+ string(4) "test"
>+ [1001]=>
>+ string(6) "monkey"
> [16777216]=>
> float(-0.33333333333333)
>- [2147483647]=>
>- string(4) "test"
> }
> Using SORT_STRING
> array(8) {
>- ["-2147483647"]=>
>+ ["-1000"]=>
> array(2) {
> [0]=>
> string(6) "banana"
> [1]=>
> string(6) "orange"
> }
>- [-2147483648]=>
>- string(6) "monkey"
> [0]=>
> string(3) "PHP"
>+ [1000]=>
>+ string(4) "test"
>+ [1001]=>
>+ string(6) "monkey"
> [16777216]=>
> float(-0.33333333333333)
> [17]=>
> string(27) "PHP: Hypertext Preprocessor"
>- [2147483647]=>
>- string(4) "test"
> [5]=>
> string(4) "Test"
> ["test"]=>
>diff -r -u ../php-cvs/php4/ext/standard/tests/array/003.phpt
>ext/standard/tests/array/003.phpt
>--- ../php-cvs/php4/ext/standard/tests/array/003.phpt Sat Nov 9
>11:42:49 2002
>+++ ext/standard/tests/array/003.phpt Sat Nov 16 16:08:59 2002
>@@ -34,7 +34,7 @@
> array(8) {
> [16777216]=>
> float(-0.33333333333333)
>- ["-2147483647"]=>
>+ ["-1000"]=>
> array(2) {
> [0]=>
> string(6) "banana"
>@@ -49,31 +49,31 @@
> string(27) "PHP: Hypertext Preprocessor"
> [5]=>
> string(4) "Test"
>- [-2147483648]=>
>+ [1001]=>
> string(6) "monkey"
>- [2147483647]=>
>+ [1000]=>
> string(4) "test"
> }
>
> -- Testing uksort() --
> array(8) {
>- ["-2147483647"]=>
>+ ["-1000"]=>
> array(2) {
> [0]=>
> string(6) "banana"
> [1]=>
> string(6) "orange"
> }
>- [-2147483648]=>
>- string(6) "monkey"
> [0]=>
> string(3) "PHP"
>+ [1000]=>
>+ string(4) "test"
>+ [1001]=>
>+ string(6) "monkey"
> [16777216]=>
> float(-0.33333333333333)
> [17]=>
> string(27) "PHP: Hypertext Preprocessor"
>- [2147483647]=>
>- string(4) "test"
> [5]=>
> string(4) "Test"
> ["test"]=>
>diff -r -u ../php-cvs/php4/ext/standard/tests/array/data.inc
>ext/standard/tests/array/data.inc
>--- ../php-cvs/php4/ext/standard/tests/array/data.inc Sat Nov 9
>11:42:49 2002
>+++ ext/standard/tests/array/data.inc Sat Nov 16 16:05:49 2002
>@@ -5,8 +5,8 @@
> 17=>'PHP: Hypertext Preprocessor',
> 5=>'Test',
> 'test'=>27,
>- 2147483647=>'test',
>- "-2147483647"=>array('banana', 'orange'),
>+ 1000=>'test',
>+ "-1000"=>array('banana', 'orange'),
> 'monkey',
> $tmp=>-1/3
> );
>
>--
>PHP Development Mailing List <http://www.php.net/>
>To unsubscribe, visit: http://www.php.net/unsub.php
-- PHP Development Mailing List <http://www.php.net/> To unsubscribe, visit: http://www.php.net/unsub.php
- Next message: Michael Mauch: "Re: [PHP-DEV] Re: #19259 [Csd->Ctl]: sort-functions don't work"
- Previous message: Andi Gutmans: "Re: [PHP-DEV] ZEND_ADD_STRING patch"
- Next in thread: Michael Mauch: "Re: [PHP-DEV] Re: #19259 [Csd->Ctl]: sort-functions don't work"
- Reply: Michael Mauch: "Re: [PHP-DEV] Re: #19259 [Csd->Ctl]: sort-functions don't work"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]

