php / php-src

The PHP Interpreter
https://www.php.net
Other
38.33k stars 7.76k forks source link

`dba_list()` is now zero-indexed instead of using resource ids #16990

Open alexandre-daubois opened 3 days ago

alexandre-daubois commented 3 days ago

Description

While adding new casters to Symfony, we came across a 8.4 regression. The following code:

<?php

$dba = dba_open('test.db', 'c');
var_dump(dba_list());

Resulted in this output:

array(1) {
  [0]=>
  string(52) "/Users/mac-ADAUBO01/PhpstormProjects/symfony/test.db"
}

But I expected this output instead:

array(1) {
  [52] =>
  string(52) "/Users/mac-ADAUBO01/PhpstormProjects/symfony/test.db"
}

Works fine on PHP 8.3.14. This makes it not possible to gather information with dba_list() by casting the resource/Dba\Connection to integer.

PHP Version

PHP 8.4.1

Operating System

macOS 15.1.1

kocsismate commented 1 day ago

Hi @alexandre-daubois,

Thanks for the report! It was a small oversight, so I've just submitted the bugfix at https://github.com/php/php-src/pull/17005