From 9b698dbceaceab67d3bb30777960e54789153cd5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gustavo=20Andr=C3=A9=20dos=20Santos=20Lopes?= Date: Tue, 21 Dec 2010 19:52:17 +0000 Subject: [PATCH] - Revert of revision 306542, turns out the semantics of compare() are different in SplMinHeap and SplMaxHeap. --- ext/pdo/pdo_dbh.c | 1 + ext/spl/spl_heap.c | 2 +- ext/spl/tests/bug53588.phpt | 23 ----------------------- 3 files changed, 2 insertions(+), 24 deletions(-) diff --git a/ext/pdo/pdo_dbh.c b/ext/pdo/pdo_dbh.c index 291ffdc44f3..620500f8d62 100755 --- a/ext/pdo/pdo_dbh.c +++ b/ext/pdo/pdo_dbh.c @@ -229,6 +229,7 @@ static PHP_METHOD(PDO, dbh_constructor) snprintf(alt_dsn, sizeof(alt_dsn), "pdo.dsn.%s", data_source); if (FAILURE == cfg_get_string(alt_dsn, &ini_dsn)) { zend_throw_exception_ex(php_pdo_get_exception(), 0 TSRMLS_CC, "invalid data source name"); + zval_dtor(object); ZVAL_NULL(object); return; } diff --git a/ext/spl/spl_heap.c b/ext/spl/spl_heap.c index c162f6f0691..d2fffd45a5d 100644 --- a/ext/spl/spl_heap.c +++ b/ext/spl/spl_heap.c @@ -176,7 +176,7 @@ static int spl_ptr_heap_zval_min_cmp(spl_ptr_heap_element a, spl_ptr_heap_elemen spl_heap_object *heap_object = (spl_heap_object*)zend_object_store_get_object((zval *)object TSRMLS_CC); if (heap_object->fptr_cmp) { long lval = 0; - if (spl_ptr_heap_cmp_cb_helper((zval *)object, heap_object, (zval *)b, (zval *)a, &lval TSRMLS_CC) == FAILURE) { + if (spl_ptr_heap_cmp_cb_helper((zval *)object, heap_object, (zval *)a, (zval *)b, &lval TSRMLS_CC) == FAILURE) { /* exception or call failure */ return 0; } diff --git a/ext/spl/tests/bug53588.phpt b/ext/spl/tests/bug53588.phpt index 1546908c35c..e69de29bb2d 100644 --- a/ext/spl/tests/bug53588.phpt +++ b/ext/spl/tests/bug53588.phpt @@ -1,23 +0,0 @@ ---TEST-- -Bug #53588 (SplMinHeap bad sorting with custom compare function) ---FILE-- -insert( 8 ); -$obj->insert( 0 ); -$obj->insert( 4 ); - -foreach( $obj as $number ) { - echo $number, "\n"; -} ---EXPECT-- -0 -4 -8 -