[PHP-DEV] Bug #14591 Updated: uasort mixes array with equal elements

2001-12-19 Thread mfischer

ID: 14591
Updated by: mfischer
Reported By: [EMAIL PROTECTED]
Old Status: Bogus
Status: Open
Bug Type: Arrays related
Operating System: Linux/Windows
PHP Version: 4.1.0
New Comment:

Hartmut, I don't agree with you at all. This is a major BC problem. If case you 
haven't checked , PHP 4.0.6 and prior version doesn't change the sort order. I'ld like 
to hear what sterling can tell us about this.

Not bogus, Reopened.

Previous Comments:


[2001-12-19 05:05:25] [EMAIL PROTECTED]

well, you can't say that no sorting is needed
in advance as uasort() does not know that
your comparison function is going to return
only zeros

i'm not that deep into qsort implementations
and, yes, i would expect qsort not to swap
elements that are considered equal, but only
for performance reasons ...
(sterling might be able to tell you how and
 why zend_qsort does it internaly)

besides that it is totaly ok that you get 
a different element order back as is still
a valid order for your sort criteria

good old "garbage in, garbage out" principle ;)



[2001-12-19 04:31:47] [EMAIL PROTECTED]

Hm, I'd rather expect that an array keeps untouched if there is no need to sort it.



[2001-12-18 19:24:23] [EMAIL PROTECTED]

and the problem is ...?

by returning all zeros you made perfectly clear
that you don't care about the order of elements
in your array ;)





[2001-12-18 17:03:19] [EMAIL PROTECTED]

If you call uasort with a function that always returns 0 (elements equal) you get a 
totally screwed array returned.



returns:

array(6) {
  [0]=>
  string(1) "h"
  [1]=>
  string(1) "s"
  [2]=>
  string(1) "i"
  [3]=>
  string(1) "c"
  [4]=>
  string(1) "q"
  [5]=>
  string(1) "m"
}
array(6) {
  [1]=>
  string(1) "s"
  [2]=>
  string(1) "i"
  [3]=>
  string(1) "c"
  [4]=>
  string(1) "q"
  [5]=>
  string(1) "m"
  [0]=>
  string(1) "h"
}






Edit this bug report at http://bugs.php.net/?id=14591&edit=1


-- 
PHP Development Mailing List 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP-DEV] Bug #14591 Updated: uasort mixes array with equal elements

2001-12-19 Thread hholzgra

ID: 14591
Updated by: hholzgra
Reported By: [EMAIL PROTECTED]
Status: Bogus
Bug Type: Arrays related
Operating System: Linux/Windows
PHP Version: 4.1.0
New Comment:

well, you can't say that no sorting is needed
in advance as uasort() does not know that
your comparison function is going to return
only zeros

i'm not that deep into qsort implementations
and, yes, i would expect qsort not to swap
elements that are considered equal, but only
for performance reasons ...
(sterling might be able to tell you how and
 why zend_qsort does it internaly)

besides that it is totaly ok that you get 
a different element order back as is still
a valid order for your sort criteria

good old "garbage in, garbage out" principle ;)

Previous Comments:


[2001-12-19 04:31:47] [EMAIL PROTECTED]

Hm, I'd rather expect that an array keeps untouched if there is no need to sort it.



[2001-12-18 19:24:23] [EMAIL PROTECTED]

and the problem is ...?

by returning all zeros you made perfectly clear
that you don't care about the order of elements
in your array ;)





[2001-12-18 17:03:19] [EMAIL PROTECTED]

If you call uasort with a function that always returns 0 (elements equal) you get a 
totally screwed array returned.



returns:

array(6) {
  [0]=>
  string(1) "h"
  [1]=>
  string(1) "s"
  [2]=>
  string(1) "i"
  [3]=>
  string(1) "c"
  [4]=>
  string(1) "q"
  [5]=>
  string(1) "m"
}
array(6) {
  [1]=>
  string(1) "s"
  [2]=>
  string(1) "i"
  [3]=>
  string(1) "c"
  [4]=>
  string(1) "q"
  [5]=>
  string(1) "m"
  [0]=>
  string(1) "h"
}






Edit this bug report at http://bugs.php.net/?id=14591&edit=1


-- 
PHP Development Mailing List 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP-DEV] Bug #14591 Updated: uasort mixes array with equal elements

2001-12-19 Thread jan

ID: 14591
User updated by: [EMAIL PROTECTED]
Reported By: [EMAIL PROTECTED]
Status: Bogus
Bug Type: Arrays related
Operating System: Linux/Windows
PHP Version: 4.1.0
New Comment:

Hm, I'd rather expect that an array keeps untouched if there is no need to sort it.

Previous Comments:


[2001-12-18 19:24:23] [EMAIL PROTECTED]

and the problem is ...?

by returning all zeros you made perfectly clear
that you don't care about the order of elements
in your array ;)





[2001-12-18 17:03:19] [EMAIL PROTECTED]

If you call uasort with a function that always returns 0 (elements equal) you get a 
totally screwed array returned.



returns:

array(6) {
  [0]=>
  string(1) "h"
  [1]=>
  string(1) "s"
  [2]=>
  string(1) "i"
  [3]=>
  string(1) "c"
  [4]=>
  string(1) "q"
  [5]=>
  string(1) "m"
}
array(6) {
  [1]=>
  string(1) "s"
  [2]=>
  string(1) "i"
  [3]=>
  string(1) "c"
  [4]=>
  string(1) "q"
  [5]=>
  string(1) "m"
  [0]=>
  string(1) "h"
}






Edit this bug report at http://bugs.php.net/?id=14591&edit=1


-- 
PHP Development Mailing List 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP-DEV] Bug #14591 Updated: uasort mixes array with equal elements

2001-12-18 Thread hholzgra

ID: 14591
Updated by: hholzgra
Reported By: [EMAIL PROTECTED]
Old Status: Open
Status: Bogus
Bug Type: Arrays related
Operating System: Linux/Windows
PHP Version: 4.1.0
New Comment:

and the problem is ...?

by returning all zeros you made perfectly clear
that you don't care about the order of elements
in your array ;)



Previous Comments:


[2001-12-18 17:03:19] [EMAIL PROTECTED]

If you call uasort with a function that always returns 0 (elements equal) you get a 
totally screwed array returned.



returns:

array(6) {
  [0]=>
  string(1) "h"
  [1]=>
  string(1) "s"
  [2]=>
  string(1) "i"
  [3]=>
  string(1) "c"
  [4]=>
  string(1) "q"
  [5]=>
  string(1) "m"
}
array(6) {
  [1]=>
  string(1) "s"
  [2]=>
  string(1) "i"
  [3]=>
  string(1) "c"
  [4]=>
  string(1) "q"
  [5]=>
  string(1) "m"
  [0]=>
  string(1) "h"
}






Edit this bug report at http://bugs.php.net/?id=14591&edit=1


-- 
PHP Development Mailing List 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]