I'd say that this is a bug, and needs to be fixed.


At 15:40 26/6/2001, Andre Langhorst wrote:
>apparently php-users are fooled (bug 9633, private email to me) by zends 
>sorting on one-element arrays. In fact we do nothing there.
> >       if (ht->nNumOfElements <= 1) {  /* Doesn't require sorting */
> >       return SUCCESS;
> >       }
>but zend_hash_sort is called with renumber=1 for sort() and the like. thus 
>any array with size>1 will be renumbered except the one element array, 
>that one is returned unchanged. shoudn't have renumbering an effect on 
>one-element arrays even if there is nothing to sort?
>POV 1)
>One element, nothing to sort. Simply return it.
>Problem: inconsistent behaviour
>POV 2)
>Renumber arrays with size>1, renumber all.
>Problem: backwards compatibilty.
>well, I am unsure. To not have the BC problem we should at least document 
>this, because experience shows that people do expect that sort() acts 
>similar on all arrays and renumbers even one-element arrays.
>ok. why would you sort a one-element array? I wouldn't, but people 
>apparently do and I can understand this kind of inconsistency assuming.
>· [EMAIL PROTECTED]          m: +49 173 9558736 ·
>* PHP Quality Assurance  http://qa.php.net  *

Zeev Suraski <[EMAIL PROTECTED]>
CTO &  co-founder, Zend Technologies Ltd. http://www.zend.com/

PHP Development Mailing List <http://www.php.net/>
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to