@@ -166,40 +166,25 @@ static zend_never_inline ZEND_COLD int stable_sort_fallback(Bucket *a, Bucket *b
166166
167167static zend_always_inline int php_array_key_compare_unstable_i (Bucket * f , Bucket * s ) /* {{{ */
168168{
169- zend_uchar t ;
170- zend_long l1 , l2 ;
171- double d ;
172-
173- if (f -> key == NULL ) {
174- if (s -> key == NULL ) {
175- return (zend_long )f -> h > (zend_long )s -> h ? 1 : -1 ;
176- } else {
177- l1 = (zend_long )f -> h ;
178- t = is_numeric_string (s -> key -> val , s -> key -> len , & l2 , & d , 1 );
179- if (t == IS_LONG ) {
180- /* pass */
181- } else if (t == IS_DOUBLE ) {
182- return ZEND_NORMALIZE_BOOL ((double )l1 - d );
183- } else {
184- l2 = 0 ;
185- }
186- }
187- } else {
188- if (s -> key ) {
189- return zendi_smart_strcmp (f -> key , s -> key );
190- } else {
191- l2 = (zend_long )s -> h ;
192- t = is_numeric_string (f -> key -> val , f -> key -> len , & l1 , & d , 1 );
193- if (t == IS_LONG ) {
194- /* pass */
195- } else if (t == IS_DOUBLE ) {
196- return ZEND_NORMALIZE_BOOL (d - (double )l2 );
197- } else {
198- l1 = 0 ;
199- }
200- }
201- }
202- return ZEND_NORMALIZE_BOOL (l1 - l2 );
169+ zval first ;
170+ zval second ;
171+
172+ if (f -> key == NULL && s -> key == NULL ) {
173+ return (zend_long )f -> h > (zend_long )s -> h ? 1 : -1 ;
174+ } else if (f -> key && s -> key ) {
175+ return zendi_smart_strcmp (f -> key , s -> key );
176+ }
177+ if (f -> key ) {
178+ ZVAL_STR (& first , f -> key );
179+ } else {
180+ ZVAL_LONG (& first , f -> h );
181+ }
182+ if (s -> key ) {
183+ ZVAL_STR (& second , s -> key );
184+ } else {
185+ ZVAL_LONG (& second , s -> h );
186+ }
187+ return zend_compare (& first , & second );
203188}
204189/* }}} */
205190
0 commit comments