1--TEST--
2SPL: SplHeap, Test spl_heap_object_count_elements (spl_heap.c:490) for returning count() failure for Heaps
3--CREDITS--
4Chris Scott chris.scott@nstein.com
5#testfest London 2009-05-09
6--FILE--
7<?php
8
9class MyHeap extends SplHeap
10{
11    public function compare($a,$b)
12    {
13        return ($a < $b);
14    }
15
16    public function count() // override count to force failure
17    {
18        throw new Exception('Cause count to fail');
19        return parent::count();
20    }
21}
22
23
24$heap = new MyHeap();
25$heap->insert(1);
26try {
27	count($heap);// refers to MyHeap->count() method
28} catch (Exception $e) {
29	echo "Exception: " . $e->getMessage() . "\n";
30}
31
32?>
33--EXPECT--
34Exception: Cause count to fail
35