Edit report at http://bugs.php.net/bug.php?id=53588&edit=1
ID: 53588 Updated by: [email protected] Reported by: ojousset49 at yahoo dot fr Summary: SplMinHeap bad insert sort -Status: Assigned +Status: Closed -Type: Feature/Change Request +Type: Bug Package: SPL related Operating System: RHEL 55 64bits PHP Version: 5.3.4 Assigned To: cataphract Block user comment: N Private report: N New Comment: This bug has been fixed in SVN. Snapshots of the sources are packaged every three hours; this change will be in the next snapshot. You can grab the snapshot at http://snaps.php.net/. Thank you for the report, and for helping us make PHP better. Previous Comments: ------------------------------------------------------------------------ [2010-12-21 18:29:16] [email protected] Automatic comment from SVN on behalf of cataphract Revision: http://svn.php.net/viewvc/?view=revision&revision=306542 Log: - Fixed bug #53588 (SplMinHeap bad sorting with custom compare function). ------------------------------------------------------------------------ [2010-12-21 14:50:45] ojousset49 at yahoo dot fr Description: ------------ SplMinHeap have the same behavior than SplMaxHeap when inserting data. Top value of a SplMinHeap object is the max value instead of the min Test script: --------------- 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"; } // Output display : 8, 4, 0 instead of 0, 4, 8 ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/bug.php?id=53588&edit=1
