Req #53588 [NEW]: SplMinHeap bad insert sort
From:
Operating system: RHEL 55 64bits
PHP version: 5.3.4
Package: SPL related
Bug Type: Feature/Change Request
Bug description:SplMinHeap bad insert sort
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 bug report at http://bugs.php.net/bug.php?id=53588&edit=1
--
Try a snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=53588&r=trysnapshot52
Try a snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=53588&r=trysnapshot53
Try a snapshot (trunk): http://bugs.php.net/fix.php?id=53588&r=trysnapshottrunk
Fixed in SVN: http://bugs.php.net/fix.php?id=53588&r=fixed
Fixed in SVN and need be documented: http://bugs.php.net/fix.php?id=53588&r=needdocs
Fixed in release: http://bugs.php.net/fix.php?id=53588&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=53588&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=53588&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=53588&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=53588&r=support
Expected behavior: http://bugs.php.net/fix.php?id=53588&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=53588&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=53588&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=53588&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=53588&r=php4
Daylight Savings: http://bugs.php.net/fix.php?id=53588&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=53588&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=53588&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=53588&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=53588&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=53588&r=mysqlcfg
Thread (3 messages)
- ojousset49 at yahoo dot fr