Skip to content

Commit e3d4059

Browse files
authored
Fix sqlsrv (#479)
* Trigger test failure * Copy files * Set env * Debug * Debug * Debug * Restore * Debug * Set env * Debug * Clean up * Debug * Fail * Debug * Clean up * Try * Set env * Minimal
1 parent 3bd6785 commit e3d4059

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

layers/sqlsrv/Dockerfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ RUN php /bref/lib-copy/copy-dependencies.php /tmp/pdo_sqlsrv.so /tmp/extension-l
2525

2626
FROM scratch
2727

28+
COPY --from=ext /opt/microsoft /opt/microsoft
2829
COPY --from=ext /tmp/sqlsrv.so /opt/bref/extensions/sqlsrv.so
2930
COPY --from=ext /tmp/pdo_sqlsrv.so /opt/bref/extensions/pdo_sqlsrv.so
3031
COPY --from=ext /tmp/ext.ini /opt/bref/etc/php/conf.d/ext-sqlsrv.ini

layers/sqlsrv/test.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
<?php
22

3-
putenv('ODBCSYSINI=/opt/microsoft/conf/');
4-
53
// This test is for sqlsrv.so
64
if (!function_exists($func = 'sqlsrv_connect')) {
75
echo sprintf('FAIL: Function "%s" does not exist.', $func).PHP_EOL;
@@ -17,8 +15,8 @@
1715
// This test attempts a connection, forcing MS odbc libraries to be loaded
1816
if (!sqlsrv_connect('localhost', ['LoginTimeout' => 1])) {
1917
foreach (sqlsrv_errors() as $error) {
20-
if ($error['SQLSTATE'] == '01000') {
21-
echo sprintf('FAIL: sqlsrv extension library not loaded. %s', $error['message']).PHP_EOL;
18+
if ($error['SQLSTATE'] === '01000' || $error['SQLSTATE'] === 'IM002' || $error['SQLSTATE'] === 'IMSSP') {
19+
echo sprintf('FAIL: %s', $error['message']).PHP_EOL;
2220
exit(1);
2321
}
2422
}

tests/Dockerfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,4 @@ FROM bref/$TARGET_IMAGE AS ext
55
FROM bref/php-$PHP_VERSION:2
66

77
COPY --from=ext /opt /opt
8+
ENV ODBCSYSINI=/opt/microsoft/conf/

0 commit comments

Comments
 (0)