[php-src] Issue #14786: ext/dba/tests/dba_gdbm.phpt: test failure due to key ordering

From: Date: Wed, 03 Jul 2024 12:57:58 +0000
Subject: [php-src] Issue #14786: ext/dba/tests/dba_gdbm.phpt: test failure due to key ordering
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-247215@lists.php.net to get a copy of this message
Issue: https://github.com/php/php-src/issues/14786 Author: orlitzky ### Description Original report: https://bugs.gentoo.org/935379 The diff for this failed tests contains e.g. ```diff -key4: Another Content String key2: Content String 2 key5: The last content string -[key10]name10: Content String 10 name9: Content String 9 +[key10]name10: Content String 10 +key4: Another Content String [key30]name30: Content String 30 Total keys: 6 ``` The corresponding test code is, ```php // Fetch data $key = dba_firstkey($db_writer); $total_keys = 0; while ($key) { echo $key, ': ', dba_fetch($key, $db_writer), \PHP_EOL; $key = dba_nextkey($db_writer); $total_keys++; } echo 'Total keys: ', $total_keys, \PHP_EOL; ``` So to me it looks like the insert order is not guaranteed to be the iteration order according to dba_firstkey() and dba_nextkey(). Since there are only six keys, I guess we could sort the output (in a locale-independent way) before printing it? ### PHP Version PHP-8.2.20 ### Operating System Gentoo Linux

« previous php.bugs (#247215) next »