[php-src] Issue #10290: Number columns are being converted to strings when using oci8

From: Date: Wed, 11 Jan 2023 18:07:36 +0000
Subject: [php-src] Issue #10290: Number columns are being converted to strings when using oci8
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-243414@lists.php.net to get a copy of this message
Issue: https://github.com/php/php-src/issues/10290
Author: wmiguellima

### Description

The following code:

```php
$conn = oci_connect('DB', 'PASSWORD', '172.17.0.1:51521/XEPDB1');

if (!$conn) {
    $e = oci_error();
    trigger_error(htmlentities($e['message'], ENT_QUOTES), E_USER_ERROR);
}

$stid = oci_parse($conn, 'SELECT * FROM t22_assessment_elements');
oci_execute($stid);

while ($row = oci_fetch_array($stid, OCI_ASSOC+OCI_RETURN_NULLS)) {
    foreach ($row as $item) {
      echo gettype($item) . ' | ';
    }
}
```

Resulted in this output:
```
string | object | string |
```

But I expected this output instead:
```
integer | object | integer |
```

Problem:

The integer columns are being converted to strings.

Using CAST is not an option.

Possible solution:

Something like PDO::ATTR_STRINGIFY_FETCHES available on de sqlserver pdo


### PHP Version

PHP 8.1

### Operating System

Ubuntu 20.04


Thread (1 message)

  • wmiguellima
« previous php.bugs (#243414) next »