Date: 06/26/01
- Next message: Joey Smith: "[PHP-DEV] Possible bug in sybase-db?"
- Previous message: roman.kytka <email protected>: "[PHP-DEV] Bug #11695: rmdir"
- Next in thread: Zeev Suraski: "[PHP-DEV] Re: possible bug zend_hash_sort(...)"
- Reply: Zeev Suraski: "[PHP-DEV] Re: possible bug zend_hash_sort(...)"
- Maybe reply: Andre Langhorst: "Re: [PHP-DEV] possible bug zend_hash_sort(...)"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Hi,
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.
andré
· andre <email protected> m: +49 173 9558736 ·
* PHP Quality Assurance http://qa.php.net *
-- PHP Development Mailing List <http://www.php.net/> To unsubscribe, e-mail: php-dev-unsubscribe <email protected> For additional commands, e-mail: php-dev-help <email protected> To contact the list administrators, e-mail: php-list-admin <email protected>
- Next message: Joey Smith: "[PHP-DEV] Possible bug in sybase-db?"
- Previous message: roman.kytka <email protected>: "[PHP-DEV] Bug #11695: rmdir"
- Next in thread: Zeev Suraski: "[PHP-DEV] Re: possible bug zend_hash_sort(...)"
- Reply: Zeev Suraski: "[PHP-DEV] Re: possible bug zend_hash_sort(...)"
- Maybe reply: Andre Langhorst: "Re: [PHP-DEV] possible bug zend_hash_sort(...)"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]

