Skip to content

Commit 3f507ce

Browse files
committed
update test for Windows x86 platform
1 parent 7ba9c28 commit 3f507ce

7 files changed

Lines changed: 8 additions & 30 deletions

File tree

.github/workflows/windows.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ jobs:
1919
- name: Get the extension matrix
2020
id: extension-matrix
2121
uses: php/php-windows-builder/extension-matrix@v1
22+
with:
23+
php-version-list: '8.1'
2224
build:
2325
needs: get-extension-matrix
2426
runs-on: ${{ matrix.os }}

tests/011.phpt

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,6 @@ $rar_file1 = rar_open(dirname(__FILE__).'/multi.part1.rar');
99
$entries = rar_list($rar_file1);
1010
echo count($entries)." files:\n\n";
1111
//var_dump($entries);
12-
function int32_to_hex($value) {
13-
$value &= 0xffffffff;
14-
return str_pad(strtoupper(dechex($value)), 8, "0", STR_PAD_LEFT);
15-
}
1612
foreach ($entries as $e) {
1713
$stream = $e->getStream();
1814
if ($stream === false) {
@@ -25,7 +21,7 @@ foreach ($entries as $e) {
2521
$a .= fread($stream, 8192);
2622
}
2723
echo strlen($a)." bytes, CRC ";
28-
echo int32_to_hex(crc32($a))."\n\n"; //you can confirm they're equal to those given by $e->getCrc()
24+
echo strtoupper(hash("crc32b", $a))."\n\n"; //you can confirm they're equal to those given by $e->getCrc()
2925
}
3026

3127
echo "Done\n";

tests/019.phpt

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,6 @@ $rar_file1 = rar_open(dirname(__FILE__).'/store_method.rar');
99
$entries = rar_list($rar_file1);
1010
echo count($entries)." files:\n\n";
1111
//var_dump($entries);
12-
function int32_to_hex($value) {
13-
$value &= 0xffffffff;
14-
return str_pad(strtoupper(dechex($value)), 8, "0", STR_PAD_LEFT);
15-
}
1612
foreach ($entries as $e) {
1713
$stream = $e->getStream();
1814
echo $e->getName().": ";
@@ -21,7 +17,7 @@ foreach ($entries as $e) {
2117
$a .= fread($stream, 512);
2218
}
2319
echo strlen($a)." bytes, CRC ";
24-
echo int32_to_hex(crc32($a))."\n\n"; //you can confirm they're equal to those given by $e->getCrc()
20+
echo strtoupper(hash("crc32b", $a))."\n\n"; //you can confirm they're equal to those given by $e->getCrc()
2521
}
2622

2723
echo "Done\n";

tests/020.phpt

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,6 @@ $rar_file1 = rar_open(dirname(__FILE__).'/solid.rar');
99
$entries = rar_list($rar_file1);
1010
echo count($entries)." files:\n\n";
1111
//var_dump($entries);
12-
function int32_to_hex($value) {
13-
$value &= 0xffffffff;
14-
return str_pad(strtoupper(dechex($value)), 8, "0", STR_PAD_LEFT);
15-
}
1612
foreach ($entries as $e) {
1713
$stream = $e->getStream();
1814
echo $e->getName().": ";
@@ -21,7 +17,7 @@ foreach ($entries as $e) {
2117
$a .= fread($stream, 8192);
2218
}
2319
echo strlen($a)." bytes, CRC ";
24-
echo int32_to_hex(crc32($a))."\n\n"; //you can confirm they're equal to those given by $e->getCrc()
20+
echo strtoupper(hash("crc32b", $a))."\n\n"; //you can confirm they're equal to those given by $e->getCrc()
2521
}
2622

2723
echo "Done\n";

tests/046.phpt

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,6 @@ function resolve($vol) {
1010
else
1111
return null;
1212
}
13-
function int32_to_hex($value) {
14-
$value &= 0xffffffff;
15-
return str_pad(strtoupper(dechex($value)), 8, "0", STR_PAD_LEFT);
16-
}
1713
$rar_file1 = rar_open(dirname(__FILE__).'/multi_broken.part1.rar', null, 'resolve');
1814
foreach ($rar_file1 as $e) {
1915
$stream = $e->getStream();
@@ -23,7 +19,7 @@ foreach ($rar_file1 as $e) {
2319
$a .= fread($stream, 8192);
2420
}
2521
echo strlen($a)." bytes, CRC ";
26-
echo int32_to_hex(crc32($a))."\n\n"; //you can confirm they're equal to those given by $e->getCrc()
22+
echo strtoupper(hash("crc32b", $a))."\n\n"; //you can confirm they're equal to those given by $e->getCrc()
2723
}
2824

2925
echo "Done\n";

tests/047.phpt

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,6 @@ function resolve($vol) {
1010
else
1111
return null;
1212
}
13-
function int32_to_hex($value) {
14-
$value &= 0xffffffff;
15-
return str_pad(strtoupper(dechex($value)), 8, "0", STR_PAD_LEFT);
16-
}
1713
echo "Fail:\n";
1814
$rar_file1 = rar_open(dirname(__FILE__).'/multi_broken.part1.rar');
1915
$entry = $rar_file1->getEntry('file2.txt');
@@ -22,7 +18,7 @@ echo "\nSuccess:\n";
2218
$rar_file1 = rar_open(dirname(__FILE__).'/multi_broken.part1.rar', null, 'resolve');
2319
$entry = $rar_file1->getEntry('file2.txt');
2420
$entry->extract(null, dirname(__FILE__) . "/temp_file2.txt");
25-
echo int32_to_hex(crc32(file_get_contents(dirname(__FILE__) . "/temp_file2.txt")));
21+
echo strtoupper(hash("crc32b", file_get_contents(dirname(__FILE__) . "/temp_file2.txt")));
2622
echo "\n";
2723
echo "Done\n";
2824
?>

tests/055.phpt

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,17 +11,13 @@ function resolve($vol) {
1111
else
1212
return null;
1313
}
14-
function int32_to_hex($value) {
15-
$value &= 0xffffffff;
16-
return str_pad(strtoupper(dechex($value)), 8, "0", STR_PAD_LEFT);
17-
}
1814
$stream = fopen("rar://" .
1915
dirname(__FILE__) . '/multi_broken.part1.rar' .
2016
"#file2.txt", "r", false,
2117
stream_context_create(array('rar'=>array('volume_callback'=>'resolve'))));
2218
$a = stream_get_contents($stream);
2319
echo strlen($a)." bytes, CRC ";
24-
echo int32_to_hex(crc32($a))."\n\n"; //you can confirm they're equal to those given by $e->getCrc()
20+
echo strtoupper(hash("crc32b", $a))."\n\n"; //you can confirm they're equal to those given by $e->getCrc()
2521
echo "Done.\n";
2622
--EXPECTF--
2723
17704 bytes, CRC F2C79881

0 commit comments

Comments
 (0)