2010-03-05 08:23:26 +08:00
|
|
|
--TEST--
|
|
|
|
Bug #38698 (Bug #38698 for some keys cdbmake creates corrupted db and cdb can't read valid db)
|
|
|
|
--SKIPIF--
|
2018-09-17 01:16:42 +08:00
|
|
|
<?php
|
2010-03-05 08:23:26 +08:00
|
|
|
$handler = 'cdb_make';
|
2019-03-16 05:55:30 +08:00
|
|
|
require_once(__DIR__ .'/skipif.inc');
|
2010-03-05 08:23:26 +08:00
|
|
|
?>
|
|
|
|
--FILE--
|
|
|
|
<?php
|
|
|
|
|
2013-06-27 00:50:37 +08:00
|
|
|
function isLittleEndian() {
|
|
|
|
return 0x00FF === current(unpack('v', pack('S',0x00FF)));
|
|
|
|
}
|
|
|
|
|
2019-03-16 05:55:30 +08:00
|
|
|
$db_file = __DIR__ .'/129php.cdb';
|
2010-03-05 08:23:26 +08:00
|
|
|
|
|
|
|
if (($db_make=dba_open($db_file, "n", 'cdb_make'))!==FALSE) {
|
2013-06-27 00:50:37 +08:00
|
|
|
if (isLittleEndian() === FALSE) {
|
|
|
|
dba_insert(pack('V',129), "Booo!", $db_make);
|
|
|
|
} else{
|
|
|
|
dba_insert(pack('i',129), "Booo!", $db_make);
|
|
|
|
}
|
2010-03-05 08:23:26 +08:00
|
|
|
dba_close($db_make);
|
|
|
|
// write md5 checksum of generated database file
|
|
|
|
var_dump(md5_file($db_file));
|
|
|
|
@unlink($db_file);
|
|
|
|
} else {
|
|
|
|
echo "Error creating database\n";
|
|
|
|
}
|
|
|
|
?>
|
|
|
|
===DONE===
|
|
|
|
--EXPECT--
|
|
|
|
string(32) "1f34b74bde3744265acfc21e0f30af95"
|
|
|
|
===DONE===
|