Annotation of embedaddon/php/ext/dba/tests/bug38698.phpt, revision 1.1.1.2
1.1 misho 1: --TEST--
2: Bug #38698 (Bug #38698 for some keys cdbmake creates corrupted db and cdb can't read valid db)
3: --SKIPIF--
4: <?php
5: $handler = 'cdb_make';
6: require_once(dirname(__FILE__) .'/skipif.inc');
7: ?>
8: --FILE--
9: <?php
10:
1.1.1.2 ! misho 11: function isLittleEndian() {
! 12: return 0x00FF === current(unpack('v', pack('S',0x00FF)));
! 13: }
! 14:
1.1 misho 15: $db_file = dirname(__FILE__) .'/129php.cdb';
16:
17: if (($db_make=dba_open($db_file, "n", 'cdb_make'))!==FALSE) {
1.1.1.2 ! misho 18: if (isLittleEndian() === FALSE) {
! 19: dba_insert(pack('V',129), "Booo!", $db_make);
! 20: } else{
! 21: dba_insert(pack('i',129), "Booo!", $db_make);
! 22: }
1.1 misho 23: dba_close($db_make);
24: // write md5 checksum of generated database file
25: var_dump(md5_file($db_file));
26: @unlink($db_file);
27: } else {
28: echo "Error creating database\n";
29: }
30: ?>
31: ===DONE===
32: --EXPECT--
33: string(32) "1f34b74bde3744265acfc21e0f30af95"
34: ===DONE===
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>