Merge branch 'PHP-5.6'

* PHP-5.6:
  Fix bug #69737 - Segfault when SplMinHeap::compare produces fatal error

Conflicts:
	ext/spl/spl_heap.c
This commit is contained in:
Stanislav Malyshev 2015-06-01 22:55:16 -07:00
commit 75d16a4564
2 changed files with 18 additions and 1 deletions

View file

@ -249,9 +249,10 @@ static void spl_ptr_heap_insert(spl_ptr_heap *heap, zval *elem, void *cmp_userda
}
/* sifting up */
for (i = heap->count++; i > 0 && heap->cmp(&heap->elements[(i-1)/2], elem, cmp_userdata) < 0; i = (i-1)/2) {
for (i = heap->count; i > 0 && heap->cmp(&heap->elements[(i-1)/2], elem, cmp_userdata) < 0; i = (i-1)/2) {
heap->elements[i] = heap->elements[(i-1)/2];
}
heap->count++;
if (EG(exception)) {
/* exception thrown during comparison */

View file

@ -0,0 +1,16 @@
--TEST--
Bug #69737 (Segfault when SplMinHeap::compare produces fatal error)
--FILE--
<?php
class SplMinHeap1 extends SplMinHeap {
public function compare($a, $b) {
return -parent::notexist($a, $b);
}
}
$h = new SplMinHeap1();
$h->insert(1);
$h->insert(6);
?>
===DONE===
--EXPECTF--
Fatal error: Call to undefined method SplMinHeap::notexist() in %s/bug69737.php on line %d