[php-src] Issue #11804: oci8: most tests fail out-of-the-box
| From: | orlitzky | Date: | Thu, 27 Jul 2023 12:41:51 +0000 |
| Subject: | [php-src] Issue #11804: oci8: most tests fail out-of-the-box | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-245052@lists.php.net to get a copy of this message | ||
Issue: https://github.com/php/php-src/issues/11804
Author: orlitzky
### Description
If I build a fresh clone of php-src with,
```
# note: needs ORACLE_HOME set in the environment
$ ./configure --disable-all --enable-cli --enable-pdo --with-pdo-oci --with-oci8
```
and then run the tests, most of the oci8 tests fail:
```
$ sapi/cli/php -n ./run-tests.php -n ext/oci8/tests
...
Running selected tests.
FAIL oci_bind_array_by_name() and invalid values 1 [ext/oci8/tests/array_bind_001.phpt]
FAIL oci_bind_array_by_name() and invalid values 2 [ext/oci8/tests/array_bind_002.phpt]
BORK Fatal error: connect.inc: Failed to connect as 'system' to 'localhost/XE':
ORA-12541: TNS:no listener in /home/mjo/src/php-src/ext/oci8/tests/connect.inc on line 14
[ext/oci8/tests/array_bind_003.phpt] reason: invalid output from SKIPIF
BORK Fatal error: connect.inc: Failed to connect as 'system' to 'localhost/XE':
ORA-12541: TNS:no listener in /home/mjo/src/php-src/ext/oci8/tests/connect.inc on line 14
[ext/oci8/tests/array_bind_004.phpt] reason: invalid output from SKIPIF
...
```
The ones that I've looked at are all expecting to be able to connect to a running Oracle DB via
ext/oci8/tests/connect.inc:
```
$ cat ext/oci8/tests/connect.inc
<?php
require("details.inc");
if (!empty($dbase)) {
$c = @oci_connect($user, $password, $dbase);
}
else {
$c = @oci_connect($user, $password);
}
if (!$c) {
$m = oci_error();
trigger_error("connect.inc: Failed to connect as '$user' to '$dbase':
". $m['message'], E_USER_ERROR);
}
?>
```
Naturally that fails unless you've created a database at the right place and with the right
credentials. The other database extensions like mysqli and pgsql handle this by skipping the tests
if a connection cannot be made, as in ext/mysqli/tests/skipifconnectfailure.inc or
ext/pgsql/tests/skipif.inc. I think oci8 should do the same.
### PHP Version
git HEAD
### Operating System
_No response_