diff --git a/ext/pdo_mysql/mysql_driver.c b/ext/pdo_mysql/mysql_driver.c index 5fdd4436222..75c7fc2cac8 100755 --- a/ext/pdo_mysql/mysql_driver.c +++ b/ext/pdo_mysql/mysql_driver.c @@ -424,7 +424,7 @@ static int pdo_mysql_handle_factory(pdo_dbh_t *dbh, zval *driver_options TSRMLS_ } dbname = vars[1].optval; - host = vars[2].optval; + host = vars[2].optval; if(vars[3].optval) { port = atoi(vars[3].optval); } diff --git a/ext/pdo_oci/oci_driver.c b/ext/pdo_oci/oci_driver.c index 3424ebedb82..706faebf385 100755 --- a/ext/pdo_oci/oci_driver.c +++ b/ext/pdo_oci/oci_driver.c @@ -144,6 +144,18 @@ ub4 _oci_error(OCIError *err, pdo_dbh_t *dbh, pdo_stmt_t *stmt, char *what, swor } } + if (stmt) { + /* always propogate the error code back up to the dbh, + * so that we can catch the error information when execute + * is called via query. See Bug #33707 */ + if (H->einfo.errmsg) { + efree(H->einfo.errmsg); + } + H->einfo = *einfo; + H->einfo.errmsg = einfo->errmsg ? estrdup(einfo->errmsg) : NULL; + strcpy(dbh->error_code, stmt->error_code); + } + /* little mini hack so that we can use this code from the dbh ctor */ if (!dbh->methods) { zend_throw_exception_ex(php_pdo_get_exception(TSRMLS_C), 0 TSRMLS_CC, "SQLSTATE[%s]: %s", *pdo_err, einfo->errmsg); diff --git a/ext/pdo_pgsql/pgsql_statement.c b/ext/pdo_pgsql/pgsql_statement.c index 9e6420eeb48..88e0e4620fd 100644 --- a/ext/pdo_pgsql/pgsql_statement.c +++ b/ext/pdo_pgsql/pgsql_statement.c @@ -203,6 +203,10 @@ static int pgsql_stmt_param_hook(pdo_stmt_t *stmt, struct pdo_bound_param_data * Z_TYPE_P(param->parameter) == IS_NULL) { S->param_values[param->paramno] = NULL; S->param_lengths[param->paramno] = 0; + } else if (Z_TYPE_P(param->parameter) == IS_BOOL) { + S->param_values[param->paramno] = Z_BVAL_P(param->parameter) ? "t" : "f"; + S->param_lengths[param->paramno] = 1; + S->param_formats[param->paramno] = 1; } else { convert_to_string(param->parameter); S->param_values[param->paramno] = Z_STRVAL_P(param->parameter); diff --git a/ext/pdo_sqlite/sqlite_driver.c b/ext/pdo_sqlite/sqlite_driver.c index a93aec9eeff..65790750f64 100644 --- a/ext/pdo_sqlite/sqlite_driver.c +++ b/ext/pdo_sqlite/sqlite_driver.c @@ -457,7 +457,11 @@ static PHP_METHOD(SQLite, sqliteCreateFunction) char *func_name; int func_name_len; long argc = -1; +#ifdef IS_UNICODE zval cbname; +#else + char *cbname; +#endif pdo_dbh_t *dbh; pdo_sqlite_db_handle *H; int ret; @@ -470,11 +474,20 @@ static PHP_METHOD(SQLite, sqliteCreateFunction) dbh = zend_object_store_get_object(getThis() TSRMLS_CC); if (!zend_is_callable(callback, 0, &cbname)) { +#ifdef IS_UNICODE php_error_docref(NULL TSRMLS_CC, E_WARNING, "function '%R' is not callable", Z_TYPE(cbname), Z_UNIVAL(cbname)); zval_dtor(&cbname); +#else + php_error_docref(NULL TSRMLS_CC, E_WARNING, "function '%s' is not callable", cbname); + efree(cbname); +#endif RETURN_FALSE; } +#ifdef IS_UNICODE zval_dtor(&cbname); +#else + efree(cbname); +#endif H = (pdo_sqlite_db_handle *)dbh->driver_data; @@ -528,7 +541,11 @@ static PHP_METHOD(SQLite, sqliteCreateAggregate) char *func_name; int func_name_len; long argc = -1; +#ifdef IS_UNICODE zval cbname; +#else + char *cbname; +#endif pdo_dbh_t *dbh; pdo_sqlite_db_handle *H; int ret; @@ -541,17 +558,35 @@ static PHP_METHOD(SQLite, sqliteCreateAggregate) dbh = zend_object_store_get_object(getThis() TSRMLS_CC); if (!zend_is_callable(step_callback, 0, &cbname)) { +#ifdef IS_UNICODE php_error_docref(NULL TSRMLS_CC, E_WARNING, "function '%R' is not callable", Z_TYPE(cbname), Z_UNIVAL(cbname)); zval_dtor(&cbname); +#else + php_error_docref(NULL TSRMLS_CC, E_WARNING, "function '%s' is not callable", cbname); + efree(cbname); +#endif RETURN_FALSE; } +#ifdef IS_UNICODE zval_dtor(&cbname); +#else + efree(cbname); +#endif if (!zend_is_callable(fini_callback, 0, &cbname)) { +#ifdef IS_UNICODE php_error_docref(NULL TSRMLS_CC, E_WARNING, "function '%R' is not callable", Z_TYPE(cbname), Z_UNIVAL(cbname)); zval_dtor(&cbname); +#else + php_error_docref(NULL TSRMLS_CC, E_WARNING, "function '%s' is not callable", cbname); + efree(cbname); +#endif RETURN_FALSE; } +#ifdef IS_UNICODE zval_dtor(&cbname); +#else + efree(cbname); +#endif H = (pdo_sqlite_db_handle *)dbh->driver_data;