davidc Sat Nov 22 14:19:47 2008 UTC Modified files: (Branch: PHP_5_3) /php-src/ext/spl spl_heap.c /php-src/ext/spl/tests heap_007.phpt pqueue_003.phpt Log: - MFH - Bug #46615 - Return the count - 1 when invoking SplHeap->key() - Adjusted the tests http://cvs.php.net/viewvc.cgi/php-src/ext/spl/spl_heap.c?r1=1.1.2.11&r2=1.1.2.12&diff_format=u Index: php-src/ext/spl/spl_heap.c diff -u php-src/ext/spl/spl_heap.c:1.1.2.11 php-src/ext/spl/spl_heap.c:1.1.2.12 --- php-src/ext/spl/spl_heap.c:1.1.2.11 Mon Nov 17 11:27:59 2008 +++ php-src/ext/spl/spl_heap.c Sat Nov 22 14:19:47 2008 @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: spl_heap.c,v 1.1.2.11 2008/11/17 11:27:59 felipe Exp $ */ +/* $Id: spl_heap.c,v 1.1.2.12 2008/11/22 14:19:47 davidc Exp $ */ #ifdef HAVE_CONFIG_H # include "config.h" @@ -970,8 +970,8 @@ SPL_METHOD(SplHeap, key) { spl_heap_object *intern = (spl_heap_object*)zend_object_store_get_object(getThis() TSRMLS_CC); - - RETURN_LONG(intern->heap->count); + + RETURN_LONG(intern->heap->count - 1); } /* }}} */ http://cvs.php.net/viewvc.cgi/php-src/ext/spl/tests/heap_007.phpt?r1=1.1.2.3&r2=1.1.2.4&diff_format=u Index: php-src/ext/spl/tests/heap_007.phpt diff -u php-src/ext/spl/tests/heap_007.phpt:1.1.2.3 php-src/ext/spl/tests/heap_007.phpt:1.1.2.4 --- php-src/ext/spl/tests/heap_007.phpt:1.1.2.3 Sat May 24 14:10:44 2008 +++ php-src/ext/spl/tests/heap_007.phpt Sat Nov 22 14:19:47 2008 @@ -12,6 +12,7 @@ $h->rewind(); echo "count(\$h) = ".count($h)."\n"; echo "\$h->count() = ".$h->count()."\n"; + while ($h->valid()) { $k = $h->key(); $v = $h->current(); @@ -24,8 +25,8 @@ --EXPECTF-- count($h) = 4 $h->count() = 4 -4=>5 -3=>4 -2=>1 -1=>0 +3=>5 +2=>4 +1=>1 +0=>0 ===DONE=== http://cvs.php.net/viewvc.cgi/php-src/ext/spl/tests/pqueue_003.phpt?r1=1.1.2.3&r2=1.1.2.4&diff_format=u Index: php-src/ext/spl/tests/pqueue_003.phpt diff -u php-src/ext/spl/tests/pqueue_003.phpt:1.1.2.3 php-src/ext/spl/tests/pqueue_003.phpt:1.1.2.4 --- php-src/ext/spl/tests/pqueue_003.phpt:1.1.2.3 Sat May 24 14:10:44 2008 +++ php-src/ext/spl/tests/pqueue_003.phpt Sat Nov 22 14:19:47 2008 @@ -24,8 +24,8 @@ --EXPECTF-- count($h) = 4 $h->count() = 4 -4=>5 -3=>4 -2=>1 -1=>0 +3=>5 +2=>4 +1=>1 +0=>0 ===DONE===
-- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php