diff options
author | Gustavo André dos Santos Lopes <cataphract@php.net> | 2010-12-21 19:52:17 +0000 |
---|---|---|
committer | Gustavo André dos Santos Lopes <cataphract@php.net> | 2010-12-21 19:52:17 +0000 |
commit | 8f44d2ca36acd9bcd465ab56022c2ce2a8ab616e (patch) | |
tree | 9d6b64288784962b43daa656237ad0ecba593e67 /ext | |
parent | e427e312d4942566e42114d7098661f8a6062cd3 (diff) | |
download | php-git-8f44d2ca36acd9bcd465ab56022c2ce2a8ab616e.tar.gz |
- Revert of revision 306542, turns out the semantics of compare() are
different in SplMinHeap and SplMaxHeap.
Diffstat (limited to 'ext')
-rw-r--r-- | ext/spl/spl_heap.c | 2 | ||||
-rw-r--r-- | ext/spl/tests/bug53588.phpt | 23 |
2 files changed, 1 insertions, 24 deletions
diff --git a/ext/spl/spl_heap.c b/ext/spl/spl_heap.c index 52f2008cdb..f729478388 100644 --- a/ext/spl/spl_heap.c +++ b/ext/spl/spl_heap.c @@ -176,7 +176,7 @@ static int spl_ptr_heap_zval_min_cmp(spl_ptr_heap_element a, spl_ptr_heap_elemen spl_heap_object *heap_object = (spl_heap_object*)zend_object_store_get_object((zval *)object TSRMLS_CC); if (heap_object->fptr_cmp) { long lval = 0; - if (spl_ptr_heap_cmp_cb_helper((zval *)object, heap_object, (zval *)b, (zval *)a, &lval TSRMLS_CC) == FAILURE) { + if (spl_ptr_heap_cmp_cb_helper((zval *)object, heap_object, (zval *)a, (zval *)b, &lval TSRMLS_CC) == FAILURE) { /* exception or call failure */ return 0; } diff --git a/ext/spl/tests/bug53588.phpt b/ext/spl/tests/bug53588.phpt index 1546908c35..e69de29bb2 100644 --- a/ext/spl/tests/bug53588.phpt +++ b/ext/spl/tests/bug53588.phpt @@ -1,23 +0,0 @@ ---TEST-- -Bug #53588 (SplMinHeap bad sorting with custom compare function) ---FILE-- -<?php -class MySimpleHeap extends SplMinHeap{ - public function compare( $value1, $value2 ){ - return ( $value1 - $value2 ); - } -} - -$obj = new MySimpleHeap(); -$obj->insert( 8 ); -$obj->insert( 0 ); -$obj->insert( 4 ); - -foreach( $obj as $number ) { - echo $number, "\n"; -} ---EXPECT-- -0 -4 -8 - |