summaryrefslogtreecommitdiff
path: root/ext/spl/spl_heap.c
diff options
context:
space:
mode:
authorStanislav Malyshev <stas@php.net>2015-06-01 22:53:08 -0700
committerStanislav Malyshev <stas@php.net>2015-06-01 22:53:56 -0700
commite96c64ed5e0786c067259ad8728ded0085762632 (patch)
treebb2a48869fe158802c8246d4ce3838f47fddbbb4 /ext/spl/spl_heap.c
parentf863d89b5cc991ebfbb69caacc724ad90513924b (diff)
parent1cbd25ca15383394ffa9ee8601c5de4c0f2f90e1 (diff)
downloadphp-git-e96c64ed5e0786c067259ad8728ded0085762632.tar.gz
Merge branch 'PHP-5.5' into PHP-5.6
* PHP-5.5: Fix bug #69737 - Segfault when SplMinHeap::compare produces fatal error
Diffstat (limited to 'ext/spl/spl_heap.c')
-rw-r--r--ext/spl/spl_heap.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/ext/spl/spl_heap.c b/ext/spl/spl_heap.c
index 0645ceee2a..3ff503a2a9 100644
--- a/ext/spl/spl_heap.c
+++ b/ext/spl/spl_heap.c
@@ -249,9 +249,10 @@ static void spl_ptr_heap_insert(spl_ptr_heap *heap, spl_ptr_heap_element elem, v
heap->ctor(elem TSRMLS_CC);
/* sifting up */
- for(i = heap->count++; i > 0 && heap->cmp(heap->elements[(i-1)/2], elem, cmp_userdata TSRMLS_CC) < 0; i = (i-1)/2) {
+ for(i = heap->count; i > 0 && heap->cmp(heap->elements[(i-1)/2], elem, cmp_userdata TSRMLS_CC) < 0; i = (i-1)/2) {
heap->elements[i] = heap->elements[(i-1)/2];
}
+ heap->count++;
if (EG(exception)) {
/* exception thrown during comparison */