From bcc00324886b7a5db0f7d3d62843d2d7baf0e123 Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Thu, 14 Jan 2021 16:15:47 +0100 Subject: [PATCH 1/8] Fix misleading indentation warning --- ext/pdo_oci/oci_statement.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/ext/pdo_oci/oci_statement.c b/ext/pdo_oci/oci_statement.c index 74c59fe9c5ba0..87fe34e287857 100644 --- a/ext/pdo_oci/oci_statement.c +++ b/ext/pdo_oci/oci_statement.c @@ -235,10 +235,11 @@ static sb4 oci_bind_output_cb(dvoid *ctx, OCIBind *bindp, ub4 iter, ub4 index, d ZEND_ASSERT(param); - if (Z_ISREF(param->parameter)) - parameter = Z_REFVAL(param->parameter); - else - parameter = ¶m->parameter; + if (Z_ISREF(param->parameter)) { + parameter = Z_REFVAL(param->parameter); + } else { + parameter = ¶m->parameter; + } if (PDO_PARAM_TYPE(param->param_type) == PDO_PARAM_LOB) { P->actual_len = sizeof(OCILobLocator*); From dcfa6183212cdcca1322afa3314a4913e7bb7bdd Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Thu, 14 Jan 2021 16:24:29 +0100 Subject: [PATCH 2/8] Test oci on azure --- azure/configure.yml | 2 ++ azure/setup.yml | 9 +++++++++ 2 files changed, 11 insertions(+) diff --git a/azure/configure.yml b/azure/configure.yml index 2f7b28e15d717..115639e26f854 100644 --- a/azure/configure.yml +++ b/azure/configure.yml @@ -64,6 +64,8 @@ steps: --with-pdo-odbc=unixODBC,/usr \ --with-pdo-firebird \ --with-pdo-dblib \ + --with-pdo-oci=instantclient,/opt/oracle/instantclient \ + --with-oci8=shared,instantclient,/opt/oracle/instantclient \ --enable-werror \ --with-config-file-path=/etc \ --with-config-file-scan-dir=/etc/php.d diff --git a/azure/setup.yml b/azure/setup.yml index 21fccd415b5b4..7586762b9ff28 100644 --- a/azure/setup.yml +++ b/azure/setup.yml @@ -9,6 +9,15 @@ steps: sudo -u postgres psql -c "CREATE DATABASE test;" docker exec sql1 /opt/mssql-tools/bin/sqlcmd -S 127.0.0.1 -U SA -P "" -Q "create login pdo_test with password='password', check_policy=off; create user pdo_test for login pdo_test; grant alter, control to pdo_test;" displayName: 'Setup' + - script: | + mkdir /opt/oracle + wget https://download.oracle.com/otn_software/linux/instantclient/instantclient-basiclite-linuxx64.zip + unzip instantclient-basiclite-linuxx64.zip + wget https://download.oracle.com/otn_software/linux/instantclient/instantclient-sdk-linuxx64.zip + unzip instantclient-sdk-linuxx64.zip + mv instantclient_*_* /opt/oracle/instantclient + echo "##vso[task.setvariable variable=LD_LIBRARY_PATH]/opt/oracle/instantclient:$LD_LIBRARY_PATH" + displayName: 'Setup Oracle Instant Client' - script: ./azure/setup-slapd.sh displayName: 'Configure slapd' - script: | From a9f00a643a020ea0c7429d4bfdeb46108e868c0b Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Thu, 14 Jan 2021 16:33:13 +0100 Subject: [PATCH 3/8] Move installation into apt step --- azure/apt.yml | 9 +++++++++ azure/setup.yml | 9 --------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/azure/apt.yml b/azure/apt.yml index 8c21d1c45f52e..3927753374b7a 100644 --- a/azure/apt.yml +++ b/azure/apt.yml @@ -52,3 +52,12 @@ steps: firebird-dev \ ${{ parameters.packages }} displayName: 'APT' + - script: | + mkdir /opt/oracle + wget https://download.oracle.com/otn_software/linux/instantclient/instantclient-basiclite-linuxx64.zip + unzip instantclient-basiclite-linuxx64.zip + wget https://download.oracle.com/otn_software/linux/instantclient/instantclient-sdk-linuxx64.zip + unzip instantclient-sdk-linuxx64.zip + mv instantclient_*_* /opt/oracle/instantclient + echo "##vso[task.setvariable variable=LD_LIBRARY_PATH]/opt/oracle/instantclient:$LD_LIBRARY_PATH" + displayName: 'Install Oracle Instant Client' diff --git a/azure/setup.yml b/azure/setup.yml index 7586762b9ff28..21fccd415b5b4 100644 --- a/azure/setup.yml +++ b/azure/setup.yml @@ -9,15 +9,6 @@ steps: sudo -u postgres psql -c "CREATE DATABASE test;" docker exec sql1 /opt/mssql-tools/bin/sqlcmd -S 127.0.0.1 -U SA -P "" -Q "create login pdo_test with password='password', check_policy=off; create user pdo_test for login pdo_test; grant alter, control to pdo_test;" displayName: 'Setup' - - script: | - mkdir /opt/oracle - wget https://download.oracle.com/otn_software/linux/instantclient/instantclient-basiclite-linuxx64.zip - unzip instantclient-basiclite-linuxx64.zip - wget https://download.oracle.com/otn_software/linux/instantclient/instantclient-sdk-linuxx64.zip - unzip instantclient-sdk-linuxx64.zip - mv instantclient_*_* /opt/oracle/instantclient - echo "##vso[task.setvariable variable=LD_LIBRARY_PATH]/opt/oracle/instantclient:$LD_LIBRARY_PATH" - displayName: 'Setup Oracle Instant Client' - script: ./azure/setup-slapd.sh displayName: 'Configure slapd' - script: | From 619568102053994bf62604ee6d6e7f29bdc7fd56 Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Thu, 14 Jan 2021 18:48:24 +0100 Subject: [PATCH 4/8] Try removing ldap.h header --- azure/apt.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/azure/apt.yml b/azure/apt.yml index 3927753374b7a..65095227e4bcb 100644 --- a/azure/apt.yml +++ b/azure/apt.yml @@ -59,5 +59,7 @@ steps: wget https://download.oracle.com/otn_software/linux/instantclient/instantclient-sdk-linuxx64.zip unzip instantclient-sdk-linuxx64.zip mv instantclient_*_* /opt/oracle/instantclient + # Interferes with libldap2 headers. + rm /opt/oracle/instantclient/sdk/include/ldap.h echo "##vso[task.setvariable variable=LD_LIBRARY_PATH]/opt/oracle/instantclient:$LD_LIBRARY_PATH" displayName: 'Install Oracle Instant Client' From 01b84b7a60537f264b1059dba20e8dd2d5a04786 Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Thu, 14 Jan 2021 20:50:53 +0100 Subject: [PATCH 5/8] Try to use rpath --- azure/apt.yml | 1 - azure/configure.yml | 3 ++- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/azure/apt.yml b/azure/apt.yml index 65095227e4bcb..9166509dccae7 100644 --- a/azure/apt.yml +++ b/azure/apt.yml @@ -61,5 +61,4 @@ steps: mv instantclient_*_* /opt/oracle/instantclient # Interferes with libldap2 headers. rm /opt/oracle/instantclient/sdk/include/ldap.h - echo "##vso[task.setvariable variable=LD_LIBRARY_PATH]/opt/oracle/instantclient:$LD_LIBRARY_PATH" displayName: 'Install Oracle Instant Client' diff --git a/azure/configure.yml b/azure/configure.yml index 115639e26f854..6e217710f2e70 100644 --- a/azure/configure.yml +++ b/azure/configure.yml @@ -68,5 +68,6 @@ steps: --with-oci8=shared,instantclient,/opt/oracle/instantclient \ --enable-werror \ --with-config-file-path=/etc \ - --with-config-file-scan-dir=/etc/php.d + --with-config-file-scan-dir=/etc/php.d \ + LIBS='-Wl,-rpath,/opt/oracle/instantclient' displayName: 'Configure Build' From bbd80789542d4cb3db07b3611cf566651569c2d5 Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Thu, 14 Jan 2021 23:01:31 +0100 Subject: [PATCH 6/8] Use LDFLAGS --- azure/configure.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/azure/configure.yml b/azure/configure.yml index 6e217710f2e70..4d5493b2a4629 100644 --- a/azure/configure.yml +++ b/azure/configure.yml @@ -69,5 +69,5 @@ steps: --enable-werror \ --with-config-file-path=/etc \ --with-config-file-scan-dir=/etc/php.d \ - LIBS='-Wl,-rpath,/opt/oracle/instantclient' + LDFLAGS='-Wl,-rpath,/opt/oracle/instantclient' displayName: 'Configure Build' From e8d0d36546620e607603518f9454bdd6eb4ee5a3 Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Fri, 15 Jan 2021 10:06:22 +0100 Subject: [PATCH 7/8] Disable new dtags --- azure/configure.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/azure/configure.yml b/azure/configure.yml index 4d5493b2a4629..74f0ce379bd9f 100644 --- a/azure/configure.yml +++ b/azure/configure.yml @@ -69,5 +69,7 @@ steps: --enable-werror \ --with-config-file-path=/etc \ --with-config-file-scan-dir=/etc/php.d \ - LDFLAGS='-Wl,-rpath,/opt/oracle/instantclient' + LIBS='-Wl,--disable-new-dtags' + # --disable-new-dtags forces use of RPATH instead of RUNPATH, which applies to dlopened + # libraries as well, allowing OCI to work. displayName: 'Configure Build' From d08152586cd685b905bc88820997379b3f8fda21 Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Fri, 15 Jan 2021 10:56:14 +0100 Subject: [PATCH 8/8] Try to build PDO OCI shared as well While the previous version works, it probably makes more sense to build PDO OCI shared as well, as we're not interested in running tests. That should automatically avoid rpath issues as well. --- azure/configure.yml | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/azure/configure.yml b/azure/configure.yml index 74f0ce379bd9f..9869de514e82c 100644 --- a/azure/configure.yml +++ b/azure/configure.yml @@ -64,12 +64,9 @@ steps: --with-pdo-odbc=unixODBC,/usr \ --with-pdo-firebird \ --with-pdo-dblib \ - --with-pdo-oci=instantclient,/opt/oracle/instantclient \ + --with-pdo-oci=shared,instantclient,/opt/oracle/instantclient \ --with-oci8=shared,instantclient,/opt/oracle/instantclient \ --enable-werror \ --with-config-file-path=/etc \ - --with-config-file-scan-dir=/etc/php.d \ - LIBS='-Wl,--disable-new-dtags' - # --disable-new-dtags forces use of RPATH instead of RUNPATH, which applies to dlopened - # libraries as well, allowing OCI to work. + --with-config-file-scan-dir=/etc/php.d displayName: 'Configure Build'