Skip to content

Commit bcb1fed

Browse files
committed
merge PHP 5 pdo into HEAD. This source compiles on both PHP 5 and PHP 6.
If you're poking around in here, please make sure that any changes you make compile on both PHP 5 and 6. Thanks!
1 parent a7b594d commit bcb1fed

9 files changed

+359
-156
lines changed

ext/pdo/config.m4

+4-1
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,10 @@ for more detail on this issue.
4949
esac
5050
fi
5151
PHP_NEW_EXTENSION(pdo, pdo.c pdo_dbh.c pdo_stmt.c pdo_sql_parser.c pdo_sqlstate.c, $ext_shared)
52-
PHP_ADD_EXTENSION_DEP(pdo, spl, true)
52+
ifdef([PHP_ADD_EXTENSION_DEP],
53+
[
54+
PHP_ADD_EXTENSION_DEP(pdo, spl, true)
55+
])
5356

5457
ifdef([PHP_INSTALL_HEADERS],
5558
[

ext/pdo/pdo.c

+11-4
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,12 @@ int php_pdo_list_entry(void)
5454
/* for exceptional circumstances */
5555
zend_class_entry *pdo_exception_ce;
5656

57-
PDO_API zend_class_entry *php_pdo_get_exception(TSRMLS_D)
57+
PDO_API zend_class_entry *php_pdo_get_dbh_ce(void)
58+
{
59+
return pdo_dbh_ce;
60+
}
61+
62+
PDO_API zend_class_entry *php_pdo_get_exception(void)
5863
{
5964
return pdo_exception_ce;
6065
}
@@ -68,7 +73,7 @@ PDO_API char *php_pdo_str_tolower_dup(const char *src, int len)
6873

6974
PDO_API zend_class_entry *php_pdo_get_exception_base(int root TSRMLS_DC)
7075
{
71-
#if can_handle_soft_dependency_on_SPL && defined(HAVE_SPL)
76+
#if can_handle_soft_dependency_on_SPL && defined(HAVE_SPL) && ((PHP_MAJOR_VERSION > 5) || (PHP_MAJOR_VERSION == 5 && PHP_MINOR_VERSION >= 1))
7277
if (!root) {
7378
if (!spl_ce_RuntimeException) {
7479
zend_class_entry **pce;
@@ -82,7 +87,7 @@ PDO_API zend_class_entry *php_pdo_get_exception_base(int root TSRMLS_DC)
8287
}
8388
}
8489
#endif
85-
#if (PHP_MAJOR_VERSION < 6)
90+
#if (PHP_MAJOR_VERSION == 5) && (PHP_MINOR_VERSION < 2)
8691
return zend_exception_get_default();
8792
#else
8893
return zend_exception_get_default(TSRMLS_C);
@@ -151,7 +156,7 @@ zend_module_entry pdo_module_entry = {
151156
/* }}} */
152157

153158
/* TODO: visit persistent handles: for each persistent statement handle,
154-
* remove bound parameter associations in RSHUTDOWN */
159+
* remove bound parameter associations */
155160

156161
#ifdef COMPILE_DL_PDO
157162
ZEND_GET_MODULE(pdo)
@@ -368,6 +373,8 @@ PHP_MINFO_FUNCTION(pdo)
368373

369374
if (drivers) {
370375
efree(drivers);
376+
} else {
377+
efree(ldrivers);
371378
}
372379

373380
php_info_print_table_end();

0 commit comments

Comments
 (0)