summaryrefslogtreecommitdiff
path: root/ext/oci8
diff options
context:
space:
mode:
authorChristopher Jones <christopher.jones@oracle.com>2018-12-09 11:30:15 +1100
committerChristopher Jones <christopher.jones@oracle.com>2018-12-09 11:30:15 +1100
commit03f6b16de787907fa55254cbc568f107707d81bb (patch)
treeda214fe2368b746f4cb1a7d2844e4eb92ef575d1 /ext/oci8
parentb3a6ca90af54482e88f714ef1062c84d36322167 (diff)
parent465c149cd3ba61e13817621931f2af748fe19d28 (diff)
downloadphp-git-03f6b16de787907fa55254cbc568f107707d81bb.tar.gz
Merge branch 'PHP-7.2' into PHP-7.3
Diffstat (limited to 'ext/oci8')
-rw-r--r--ext/oci8/README12
-rw-r--r--ext/oci8/oci8.c34
-rw-r--r--ext/oci8/oci8_interface.c180
-rw-r--r--ext/oci8/oci8_statement.c7
-rw-r--r--ext/oci8/package.xml1
5 files changed, 138 insertions, 96 deletions
diff --git a/ext/oci8/README b/ext/oci8/README
index 5d1743dfce..e0ff3249ab 100644
--- a/ext/oci8/README
+++ b/ext/oci8/README
@@ -11,14 +11,14 @@ Use 'pecl install oci8-2.0.12' to install for PHP 5.2 - PHP 5.6.
Use 'pecl install oci8-1.4.10' to install for PHP 4.3.9 - PHP 5.1.
-The OCI8 extension needs to be linked with Oracle 12, 11, or 10.2
+The OCI8 extension needs to be linked with Oracle 18, 12, 11, or 10.2
client libraries. These libraries are found in your database
installation, or in the free Oracle Instant Client from
-http://www.oracle.com/technetwork/database/features/instant-client/
-Install the 'Basic' or 'Basic Lite' Instant Client package. If
+https://www.oracle.com/technetwork/database/database-technologies/instant-client/overview/index.html
+Install the 'Basic' or 'Basic Light' Instant Client package. If
building from source, then also install the SDK package.
-Oracle's standard cross-version connectivity applies. For example,
-PHP OCI8 linked with Instant Client 11.2 can connect to Oracle
-Database 9.2 onward. See Oracle's note "Oracle Client / Server
+Oracle's standard cross-version interoperability applies. For
+example, PHP OCI8 linked with Instant Client 11.2 can connect to
+Oracle Database 9.2 onward. See Oracle's note "Oracle Client / Server
Interoperability Support" (ID 207303.1) for details.
diff --git a/ext/oci8/oci8.c b/ext/oci8/oci8.c
index bd46cd2aed..fa5b7870c7 100644
--- a/ext/oci8/oci8.c
+++ b/ext/oci8/oci8.c
@@ -1630,9 +1630,14 @@ void php_oci_do_connect(INTERNAL_FUNCTION_PARAMETERS, int persistent, int exclus
zend_long session_mode = OCI_DEFAULT;
/* if a fourth parameter is handed over, it is the charset identifier (but is only used in Oracle 9i+) */
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "ss|ssl", &username, &username_len, &password, &password_len, &dbname, &dbname_len, &charset, &charset_len, &session_mode) == FAILURE) {
- return;
- }
+ ZEND_PARSE_PARAMETERS_START(2, 5)
+ Z_PARAM_STRING(username, username_len)
+ Z_PARAM_STRING(password, password_len)
+ Z_PARAM_OPTIONAL
+ Z_PARAM_STRING(dbname, dbname_len)
+ Z_PARAM_STRING(charset, charset_len)
+ Z_PARAM_LONG(session_mode)
+ ZEND_PARSE_PARAMETERS_END();
#ifdef HAVE_OCI8_DTRACE
if (DTRACE_OCI8_CONNECT_ENTRY_ENABLED()) {
@@ -2547,9 +2552,12 @@ void php_oci_fetch_row (INTERNAL_FUNCTION_PARAMETERS, int mode, int expected_arg
if (expected_args > 2) {
/* only for ocifetchinto BC */
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "rz|l", &z_statement, &array, &fetch_mode) == FAILURE) {
- return;
- }
+ ZEND_PARSE_PARAMETERS_START(2, 3)
+ Z_PARAM_RESOURCE(z_statement)
+ Z_PARAM_ZVAL(array)
+ Z_PARAM_OPTIONAL
+ Z_PARAM_LONG(fetch_mode)
+ ZEND_PARSE_PARAMETERS_END();
if (ZEND_NUM_ARGS() == 2) {
fetch_mode = mode;
@@ -2563,9 +2571,11 @@ void php_oci_fetch_row (INTERNAL_FUNCTION_PARAMETERS, int mode, int expected_arg
} else if (expected_args == 2) {
/* only for oci_fetch_array() */
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "r|l", &z_statement, &fetch_mode) == FAILURE) {
- return;
- }
+ ZEND_PARSE_PARAMETERS_START(1, 2)
+ Z_PARAM_RESOURCE(z_statement)
+ Z_PARAM_OPTIONAL
+ Z_PARAM_LONG(fetch_mode)
+ ZEND_PARSE_PARAMETERS_END();
if (ZEND_NUM_ARGS() == 1) {
fetch_mode = mode;
@@ -2573,9 +2583,9 @@ void php_oci_fetch_row (INTERNAL_FUNCTION_PARAMETERS, int mode, int expected_arg
} else {
/* for all oci_fetch_*() */
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "r", &z_statement) == FAILURE) {
- return;
- }
+ ZEND_PARSE_PARAMETERS_START(1, 1)
+ Z_PARAM_RESOURCE(z_statement)
+ ZEND_PARSE_PARAMETERS_END();
fetch_mode = mode;
}
diff --git a/ext/oci8/oci8_interface.c b/ext/oci8/oci8_interface.c
index 06fd913b3f..922a294b74 100644
--- a/ext/oci8/oci8_interface.c
+++ b/ext/oci8/oci8_interface.c
@@ -129,9 +129,13 @@ PHP_FUNCTION(oci_define_by_name)
php_oci_define *define;
zend_string *zvtmp;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "rsz|l", &stmt, &name, &name_len, &var, &type) == FAILURE) {
- return;
- }
+ ZEND_PARSE_PARAMETERS_START(3, 4)
+ Z_PARAM_RESOURCE(stmt)
+ Z_PARAM_STRING(name, name_len)
+ Z_PARAM_ZVAL(var)
+ Z_PARAM_OPTIONAL
+ Z_PARAM_LONG(type)
+ ZEND_PARSE_PARAMETERS_END();
if (!name_len) {
php_error_docref(NULL, E_WARNING, "Column name cannot be empty");
@@ -193,9 +197,14 @@ PHP_FUNCTION(oci_bind_by_name)
zval *bind_var = NULL;
php_oci_statement *statement;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "rsz|ll", &z_statement, &name, &name_len, &bind_var, &maxlen, &type) == FAILURE) {
- return;
- }
+ ZEND_PARSE_PARAMETERS_START(3, 5)
+ Z_PARAM_RESOURCE(z_statement)
+ Z_PARAM_STRING(name, name_len)
+ Z_PARAM_ZVAL(bind_var)
+ Z_PARAM_OPTIONAL
+ Z_PARAM_LONG(maxlen)
+ Z_PARAM_LONG(type)
+ ZEND_PARSE_PARAMETERS_END();
if (type) {
bind_type = (ub2) type;
@@ -223,9 +232,15 @@ PHP_FUNCTION(oci_bind_array_by_name)
zval *bind_var = NULL;
php_oci_statement *statement;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "rszl|ll", &z_statement, &name, &name_len, &bind_var, &max_array_len, &max_item_len, &type) == FAILURE) {
- return;
- }
+ ZEND_PARSE_PARAMETERS_START(4, 6)
+ Z_PARAM_RESOURCE(z_statement)
+ Z_PARAM_STRING(name, name_len)
+ Z_PARAM_ZVAL(bind_var)
+ Z_PARAM_LONG(max_array_len)
+ Z_PARAM_OPTIONAL
+ Z_PARAM_LONG(max_item_len)
+ Z_PARAM_LONG(type)
+ ZEND_PARSE_PARAMETERS_END();
PHP_OCI_ZVAL_TO_STATEMENT(z_statement, statement);
@@ -1157,9 +1172,9 @@ PHP_FUNCTION(oci_rollback)
zval *z_connection;
php_oci_connection *connection;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "r", &z_connection) == FAILURE) {
- return;
- }
+ ZEND_PARSE_PARAMETERS_START(1, 1)
+ Z_PARAM_RESOURCE(z_connection)
+ ZEND_PARSE_PARAMETERS_END();
PHP_OCI_ZVAL_TO_CONNECTION(z_connection, connection);
@@ -1181,9 +1196,9 @@ PHP_FUNCTION(oci_commit)
zval *z_connection;
php_oci_connection *connection;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "r", &z_connection) == FAILURE) {
- return;
- }
+ ZEND_PARSE_PARAMETERS_START(1, 1)
+ Z_PARAM_RESOURCE(z_connection)
+ ZEND_PARSE_PARAMETERS_END();
PHP_OCI_ZVAL_TO_CONNECTION(z_connection, connection);
@@ -1379,9 +1394,11 @@ PHP_FUNCTION(oci_execute)
php_oci_statement *statement;
zend_long mode = OCI_COMMIT_ON_SUCCESS;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "r|l", &z_statement, &mode) == FAILURE) {
- return;
- }
+ ZEND_PARSE_PARAMETERS_START(1, 2)
+ Z_PARAM_RESOURCE(z_statement)
+ Z_PARAM_OPTIONAL
+ Z_PARAM_LONG(mode)
+ ZEND_PARSE_PARAMETERS_END();
PHP_OCI_ZVAL_TO_STATEMENT(z_statement, statement);
@@ -1420,9 +1437,9 @@ PHP_FUNCTION(oci_fetch)
php_oci_statement *statement;
ub4 nrows = 1; /* only one row at a time is supported for now */
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "r", &z_statement) == FAILURE) {
- return;
- }
+ ZEND_PARSE_PARAMETERS_START(1, 1)
+ Z_PARAM_RESOURCE(z_statement)
+ ZEND_PARSE_PARAMETERS_END();
PHP_OCI_ZVAL_TO_STATEMENT(z_statement, statement);
@@ -1454,9 +1471,14 @@ PHP_FUNCTION(oci_fetch_all)
int i;
zend_long rows = 0, flags = 0, skip = 0, maxrows = -1;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "rz/|lll", &z_statement, &array, &skip, &maxrows, &flags) == FAILURE) {
- return;
- }
+ ZEND_PARSE_PARAMETERS_START(2, 5)
+ Z_PARAM_RESOURCE(z_statement)
+ Z_PARAM_ZVAL_DEREF_EX(array, 0, 1)
+ Z_PARAM_OPTIONAL
+ Z_PARAM_LONG(skip)
+ Z_PARAM_LONG(maxrows)
+ Z_PARAM_LONG(flags)
+ ZEND_PARSE_PARAMETERS_END();
PHP_OCI_ZVAL_TO_STATEMENT(z_statement, statement);
@@ -1604,9 +1626,9 @@ PHP_FUNCTION(oci_free_statement)
zval *z_statement;
php_oci_statement *statement;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "r", &z_statement) == FAILURE) {
- return;
- }
+ ZEND_PARSE_PARAMETERS_START(1, 1)
+ Z_PARAM_RESOURCE(z_statement)
+ ZEND_PARSE_PARAMETERS_END();
PHP_OCI_ZVAL_TO_STATEMENT(z_statement, statement);
@@ -1634,9 +1656,9 @@ PHP_FUNCTION(oci_close)
return;
}
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "r", &z_connection) == FAILURE) {
- return;
- }
+ ZEND_PARSE_PARAMETERS_START(1, 1)
+ Z_PARAM_RESOURCE(z_connection)
+ ZEND_PARSE_PARAMETERS_END();
PHP_OCI_ZVAL_TO_CONNECTION(z_connection, connection);
if (GC_REFCOUNT(connection->id) == 2) { /* CHANGED VERSION::PHP7
@@ -1692,9 +1714,10 @@ PHP_FUNCTION(oci_error)
ub2 error_offset = 0;
text *sqltext = NULL;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "|r", &arg) == FAILURE) {
- return;
- }
+ ZEND_PARSE_PARAMETERS_START(0, 1)
+ Z_PARAM_OPTIONAL
+ Z_PARAM_RESOURCE(arg)
+ ZEND_PARSE_PARAMETERS_END();
if (ZEND_NUM_ARGS() > 0) {
statement = (php_oci_statement *) zend_fetch_resource_ex(arg, NULL, le_statement);
@@ -1758,9 +1781,9 @@ PHP_FUNCTION(oci_num_fields)
zval *z_statement;
php_oci_statement *statement;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "r", &z_statement) == FAILURE) {
- return;
- }
+ ZEND_PARSE_PARAMETERS_START(1, 1)
+ Z_PARAM_RESOURCE(z_statement)
+ ZEND_PARSE_PARAMETERS_END();
PHP_OCI_ZVAL_TO_STATEMENT(z_statement, statement);
@@ -1778,9 +1801,10 @@ PHP_FUNCTION(oci_parse)
char *query;
size_t query_len;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "rs", &z_connection, &query, &query_len) == FAILURE) {
- return;
- }
+ ZEND_PARSE_PARAMETERS_START(2, 2)
+ Z_PARAM_RESOURCE(z_connection)
+ Z_PARAM_STRING(query, query_len)
+ ZEND_PARSE_PARAMETERS_END();
PHP_OCI_ZVAL_TO_CONNECTION(z_connection, connection);
@@ -1801,9 +1825,10 @@ PHP_FUNCTION(oci_set_prefetch)
php_oci_statement *statement;
zend_long size;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "rl", &z_statement, &size) == FAILURE) {
- return;
- }
+ ZEND_PARSE_PARAMETERS_START(2, 2)
+ Z_PARAM_RESOURCE(z_statement)
+ Z_PARAM_LONG(size)
+ ZEND_PARSE_PARAMETERS_END();
PHP_OCI_ZVAL_TO_STATEMENT(z_statement, statement);
@@ -1829,9 +1854,10 @@ PHP_FUNCTION(oci_set_client_identifier)
size_t client_id_len;
sword errstatus;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "rs", &z_connection, &client_id, &client_id_len) == FAILURE) {
- return;
- }
+ ZEND_PARSE_PARAMETERS_START(2, 2)
+ Z_PARAM_RESOURCE(z_connection)
+ Z_PARAM_STRING(client_id, client_id_len)
+ ZEND_PARSE_PARAMETERS_END();
PHP_OCI_ZVAL_TO_CONNECTION(z_connection, connection);
@@ -1878,9 +1904,9 @@ PHP_FUNCTION(oci_set_edition)
char *edition;
size_t edition_len;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", &edition, &edition_len) == FAILURE) {
- return;
- }
+ ZEND_PARSE_PARAMETERS_START(1, 1)
+ Z_PARAM_STRING(edition, edition_len)
+ ZEND_PARSE_PARAMETERS_END();
if (OCI_G(edition)) {
efree(OCI_G(edition));
@@ -1913,9 +1939,10 @@ PHP_FUNCTION(oci_set_module_name)
size_t module_len;
sword errstatus;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "rs", &z_connection, &module, &module_len) == FAILURE) {
- return;
- }
+ ZEND_PARSE_PARAMETERS_START(2, 2)
+ Z_PARAM_RESOURCE(z_connection)
+ Z_PARAM_STRING(module, module_len)
+ ZEND_PARSE_PARAMETERS_END();
PHP_OCI_ZVAL_TO_CONNECTION(z_connection, connection);
@@ -1945,9 +1972,10 @@ PHP_FUNCTION(oci_set_action)
size_t action_len;
sword errstatus;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "rs", &z_connection, &action, &action_len) == FAILURE) {
- return;
- }
+ ZEND_PARSE_PARAMETERS_START(2, 2)
+ Z_PARAM_RESOURCE(z_connection)
+ Z_PARAM_STRING(action, action_len)
+ ZEND_PARSE_PARAMETERS_END();
PHP_OCI_ZVAL_TO_CONNECTION(z_connection, connection);
@@ -1977,9 +2005,10 @@ PHP_FUNCTION(oci_set_client_info)
size_t client_info_len;
sword errstatus;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "rs", &z_connection, &client_info, &client_info_len) == FAILURE) {
- return;
- }
+ ZEND_PARSE_PARAMETERS_START(2, 2)
+ Z_PARAM_RESOURCE(z_connection)
+ Z_PARAM_STRING(client_info, client_info_len)
+ ZEND_PARSE_PARAMETERS_END();
PHP_OCI_ZVAL_TO_CONNECTION(z_connection, connection);
@@ -2009,9 +2038,10 @@ PHP_FUNCTION(oci_set_db_operation)
char *dbop_name;
size_t dbop_name_len;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "rs", &z_connection, &dbop_name, &dbop_name_len) == FAILURE) {
- return;
- }
+ ZEND_PARSE_PARAMETERS_START(2, 2)
+ Z_PARAM_RESOURCE(z_connection)
+ Z_PARAM_STRING(dbop_name, dbop_name_len)
+ ZEND_PARSE_PARAMETERS_END();
PHP_OCI_ZVAL_TO_CONNECTION(z_connection, connection);
@@ -2092,9 +2122,9 @@ PHP_FUNCTION(oci_new_cursor)
php_oci_connection *connection;
php_oci_statement *statement;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "r", &z_connection) == FAILURE) {
- return;
- }
+ ZEND_PARSE_PARAMETERS_START(1, 1)
+ Z_PARAM_RESOURCE(z_connection)
+ ZEND_PARSE_PARAMETERS_END();
PHP_OCI_ZVAL_TO_CONNECTION(z_connection, connection);
@@ -2143,9 +2173,9 @@ PHP_FUNCTION(oci_server_version)
char version[256];
zend_string *ret;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "r", &z_connection) == FAILURE) {
- return;
- }
+ ZEND_PARSE_PARAMETERS_START(1, 1)
+ Z_PARAM_RESOURCE(z_connection)
+ ZEND_PARSE_PARAMETERS_END();
PHP_OCI_ZVAL_TO_CONNECTION(z_connection, connection);
@@ -2166,9 +2196,9 @@ PHP_FUNCTION(oci_statement_type)
php_oci_statement *statement;
ub2 type;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "r", &z_statement) == FAILURE) {
- return;
- }
+ ZEND_PARSE_PARAMETERS_START(1, 1)
+ Z_PARAM_RESOURCE(z_statement)
+ ZEND_PARSE_PARAMETERS_END();
PHP_OCI_ZVAL_TO_STATEMENT(z_statement, statement);
@@ -2221,9 +2251,9 @@ PHP_FUNCTION(oci_num_rows)
php_oci_statement *statement;
ub4 rowcount;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "r", &z_statement) == FAILURE) {
- return;
- }
+ ZEND_PARSE_PARAMETERS_START(1, 1)
+ Z_PARAM_RESOURCE(z_statement)
+ ZEND_PARSE_PARAMETERS_END();
PHP_OCI_ZVAL_TO_STATEMENT(z_statement, statement);
@@ -2524,9 +2554,9 @@ PHP_FUNCTION(oci_get_implicit_resultset)
php_oci_statement *statement;
php_oci_statement *imp_statement;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "r", &z_statement) == FAILURE) {
- return;
- }
+ ZEND_PARSE_PARAMETERS_START(1, 1)
+ Z_PARAM_RESOURCE(z_statement)
+ ZEND_PARSE_PARAMETERS_END();
PHP_OCI_ZVAL_TO_STATEMENT(z_statement, statement);
diff --git a/ext/oci8/oci8_statement.c b/ext/oci8/oci8_statement.c
index 74ebe9b833..69c34bc7cf 100644
--- a/ext/oci8/oci8_statement.c
+++ b/ext/oci8/oci8_statement.c
@@ -1511,9 +1511,10 @@ php_oci_out_column *php_oci_statement_get_column_helper(INTERNAL_FUNCTION_PARAME
php_oci_statement *statement;
php_oci_out_column *column;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "rz", &z_statement, &column_index) == FAILURE) {
- return NULL;
- }
+ ZEND_PARSE_PARAMETERS_START(2, 2)
+ Z_PARAM_RESOURCE(z_statement)
+ Z_PARAM_ZVAL(column_index)
+ ZEND_PARSE_PARAMETERS_END_EX(return NULL);
statement = (php_oci_statement *) zend_fetch_resource_ex(z_statement, "oci8 statement", le_statement);
diff --git a/ext/oci8/package.xml b/ext/oci8/package.xml
index b07200ee97..0cf046eea6 100644
--- a/ext/oci8/package.xml
+++ b/ext/oci8/package.xml
@@ -68,6 +68,7 @@ Interoperability Support" (ID 207303.1) for details.
This version is for PHP 7 only.
Fixed bug #76804 (oci_pconnect with OCI_CRED_EXT not working). (KoenigsKind)
Fixed installation on 7.3.
+Internal change: Convert some parameter parsing to the Fast Parameter Parsing API.
</notes>
<contents>
<dir name="/">