mirror of
https://github.com/php/php-src.git
synced 2025-08-18 06:58:55 +02:00
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:
commit
75d16a4564
2 changed files with 18 additions and 1 deletions
|
@ -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 */
|
||||
|
|
16
ext/spl/tests/bug69737.phpt
Normal file
16
ext/spl/tests/bug69737.phpt
Normal 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
|
Loading…
Add table
Add a link
Reference in a new issue