Re: [PHP4BETA] Re: min/max oddities

From: Date: Sun, 07 Nov 1999 20:41:00 +0000
Subject: Re: [PHP4BETA] Re: min/max oddities
References: 1  Groups: php.version4 
Request: Send a blank email to php-version4+get-5945@lists.php.net to get a copy of this message
Looks fine to me but I don't have time to apply it. I was just about to get off when I saw your letter. Andi At 09:13 PM 11/7/99 +0100, Thies C. Arntzen wrote:
hi andi, i've enclosed a patch that makes min()/max() use compare_function() from libzend - i'm too tired to commit something like this without at least two more eyes on it. maybe you could check & apply it? regards, tc On Sun, 7 Nov 1999, Andi Gutmans wrote: At 06:12 PM 11/7/99 +0100, Thies C. Arntzen wrote:
leon just reported a bug in min() and max() (PHP 3 and PHP 4 behave different). the problem is even "bigger": <? var_dump(min(5,1,10, "hello")); var_dump(min(array(5,1,10, "hello"))); var_dump(max(1,10, "hello")); var_dump(max(array(1,10, "hello"))); ?> produces: Content-Type: text/html string(5) "hello" int(1) int(10) string(5) "hello" that's because array_data_compare() (in basic_functions) is produces different results from is_smaller_function() (libzend) array_data_compare is the PHP 3 behaviour! so, what's the way to go: 1) use is_smaller_function() in array_data_compare() 2) create and array_data_compare_pval() and use that for min and max. way 2 would be 100% downward compatible but 1 would be the "right way" as is_smaller_function() is the function that the core language uses!
I would go with 1). We should be consistent with the core language. I don't think it is important that we force backwards compatibility for non-standard use of these functions. Andi --- Andi Gutmans <andi@zend.com> http://www.zend.com/ -- PHP 4.0 Beta Mailing List <http://www.php.net/version4/> To unsubscribe, e-mail: php4beta-unsubscribe@lists.php.net For additional commands, e-mail: php4beta-help@lists.php.net To contact the list administrators, e-mail: php4beta-admin@lists.php.net
Thies C. Arntzen                 "One Big-Mac, Small Fries and a Coke!"
Digital Collections             Phone +49 40 235350 Fax +49 40 23535180
Hammerbrookstr. 93                              20097 Hamburg / Germany
-- PHP 4.0 Beta Mailing List <http://www.php.net/version4/> To unsubscribe, e-mail: php4beta-unsubscribe@lists.php.net For additional commands, e-mail: php4beta-help@lists.php.net To contact the list administrators, e-mail: php4beta-admin@lists.php.net
--- Andi Gutmans <andi@zend.com> http://www.zend.com/

« previous php.version4 (#5945) next »