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);
26count($heap);// refers to MyHeap->count() method
27
28?>
29--EXPECTF--
30Fatal error: Uncaught exception 'Exception' with message 'Cause count to fail' in %s
31Stack trace:
32#0 [internal function]: MyHeap->count()
33#1 %s count(Object(MyHeap))
34#2 {main}
35  thrown in %s on line %d
36