<?php
$report = array (
'18427e904f7a227e8c3b80dd2858a70e' =>
array (
'needle' =>
array (
0 =>
array (
'starts_at' => 11821,
'ends_at' => 14377,
'length' => 2556,
'original' => 'foo'
),
),
'haystack' =>
array (
0 =>
array (
'starts_at' => 12227,
'ends_at' => 14783,
'length' => 2556,
'original' => 'foo'
),
),
),
'dd0c26f35ebf55de25eabea3edbfba32' =>
array (
'needle' =>
array (
0 =>
array (
'starts_at' => 17255,
'ends_at' => 32431,
'length' => 15176,
'original' => 'foo'
),
),
'haystack' =>
array (
0 =>
array (
'starts_at' => 17776,
'ends_at' => 33032,
'length' => 15256,
'original' => 'foo'
),
),
));
var_dump(remapMatches($report, true));
function remapMatches($matches)
{
$remapped = [];
foreach ($matches as $fingerprint => $match) {
$remapped[$fingerprint] = $match;
$needle = $remapped[$fingerprint]['needle'];
$haystack = $remapped[$fingerprint]['haystack'];
unset($needle);
unset($haystack);
foreach ($remapped[$fingerprint]['needle'] as &$needle)
unset($needle['original']);
foreach ($remapped[$fingerprint]['haystack'] as &$haystack)
unset($haystack['original']);
}
return $remapped;
}
- Output for 7.2.0 - 7.2.33, 7.3.0 - 7.3.33, 7.4.0 - 7.4.33, 8.0.0 - 8.0.30, 8.1.0 - 8.1.28, 8.2.0 - 8.2.18, 8.3.0 - 8.3.4, 8.3.6
- array(2) {
["18427e904f7a227e8c3b80dd2858a70e"]=>
array(2) {
["needle"]=>
array(1) {
[0]=>
array(1) {
[0]=>
array(4) {
["starts_at"]=>
int(17255)
["ends_at"]=>
int(32431)
["length"]=>
int(15176)
["original"]=>
string(3) "foo"
}
}
}
["haystack"]=>
array(1) {
[0]=>
array(1) {
[0]=>
array(4) {
["starts_at"]=>
int(17776)
["ends_at"]=>
int(33032)
["length"]=>
int(15256)
["original"]=>
string(3) "foo"
}
}
}
}
["dd0c26f35ebf55de25eabea3edbfba32"]=>
array(2) {
["needle"]=>
array(1) {
[0]=>
array(3) {
["starts_at"]=>
int(17255)
["ends_at"]=>
int(32431)
["length"]=>
int(15176)
}
}
["haystack"]=>
array(1) {
[0]=>
array(3) {
["starts_at"]=>
int(17776)
["ends_at"]=>
int(33032)
["length"]=>
int(15256)
}
}
}
}
- Output for 8.3.5
- Warning: PHP Startup: Unable to load dynamic library 'sodium.so' (tried: /usr/lib/php/8.3.5/modules/sodium.so (libsodium.so.23: cannot open shared object file: No such file or directory), /usr/lib/php/8.3.5/modules/sodium.so.so (/usr/lib/php/8.3.5/modules/sodium.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0
array(2) {
["18427e904f7a227e8c3b80dd2858a70e"]=>
array(2) {
["needle"]=>
array(1) {
[0]=>
array(1) {
[0]=>
array(4) {
["starts_at"]=>
int(17255)
["ends_at"]=>
int(32431)
["length"]=>
int(15176)
["original"]=>
string(3) "foo"
}
}
}
["haystack"]=>
array(1) {
[0]=>
array(1) {
[0]=>
array(4) {
["starts_at"]=>
int(17776)
["ends_at"]=>
int(33032)
["length"]=>
int(15256)
["original"]=>
string(3) "foo"
}
}
}
}
["dd0c26f35ebf55de25eabea3edbfba32"]=>
array(2) {
["needle"]=>
array(1) {
[0]=>
array(3) {
["starts_at"]=>
int(17255)
["ends_at"]=>
int(32431)
["length"]=>
int(15176)
}
}
["haystack"]=>
array(1) {
[0]=>
array(3) {
["starts_at"]=>
int(17776)
["ends_at"]=>
int(33032)
["length"]=>
int(15256)
}
}
}
}
preferences:
172.2 ms | 404 KiB | 178 Q