destruction).
SQLT_AFC, AVC). (Tony)
- Fixed bug #37564 (AES privacy encryption not possible due to net-snmp 5.2
compatibility issue). (Jani, patch by scott dot moynes+php at gmail dot com)
+- Fixed bug #37445 (Fixed crash in pdo_mysql resulting from premature object
+ destruction). (Ilia)
24 Jul 2006, PHP 5.2.0RC1
- Updated bundled MySQL client library to version 5.0.22 in the Windows
stmt->dbh = dbh;
/* give it a reference to me */
zend_objects_store_add_ref(getThis() TSRMLS_CC);
+ php_pdo_dbh_addref(dbh TSRMLS_CC);
stmt->database_object_handle = *getThis();
/* we haven't created a lazy object yet */
ZVAL_NULL(&stmt->lazy_object_ref);
stmt->dbh = dbh;
/* give it a reference to me */
zend_objects_store_add_ref(getThis() TSRMLS_CC);
+ php_pdo_dbh_addref(dbh TSRMLS_CC);
stmt->database_object_handle = *getThis();
/* we haven't created a lazy object yet */
ZVAL_NULL(&stmt->lazy_object_ref);
do_fetch_opt_finish(stmt, 1 TSRMLS_CC);
zend_objects_store_del_ref(&stmt->database_object_handle TSRMLS_CC);
+ php_pdo_dbh_delref(stmt->dbh TSRMLS_CC);
efree(stmt);
}
--- /dev/null
+--TEST--
+PDO MySQL Bug #37445 (Premature stmt object destruction)
+--SKIPIF--
+<?php
+if (!extension_loaded('pdo') || !extension_loaded('pdo_mysql')) die('skip not loaded');
+require dirname(__FILE__) . '/config.inc';
+require dirname(__FILE__) . '/../../../ext/pdo/tests/pdo_test.inc';
+$db = PDOTest::test_factory(dirname(__FILE__) . '/common.phpt');
+PDOTest::skip();
+?>
+--FILE--
+<?php
+require dirname(__FILE__) . '/../../../ext/pdo/tests/pdo_test.inc';
+$db = PDOTest::test_factory(dirname(__FILE__) . '/common.phpt');
+
+$db->setAttribute(PDO :: ATTR_EMULATE_PREPARES, true);
+$stmt = $db->prepare("SELECT 1");
+$stmt->bindParam(':a', 'b');
+
+--EXPECTF--
+Fatal error: Cannot pass parameter 2 by reference in %s/bug_37445.php on line %d
\ No newline at end of file
} else {
$config['ENV']['PDOTEST_DSN'] = 'mysql:host=localhost;dbname=test';
$config['ENV']['PDOTEST_USER'] = 'root';
- $config['ENV']['PDOTEST_PASS'] = 'asukasmysql';
+ $config['ENV']['PDOTEST_PASS'] = '';
}
return $config;