use Friendica\Content\ContactSelector;
use Friendica\Core\Logger;
+use Friendica\Core\System;
use ParagonIE\ConstantTime\Base64;
/**
return INF;
}
- $units = ['B', 'KB', 'MB', 'GB', 'TB'];
+ $units = ['B', 'KiB', 'MiB', 'GiB', 'TiB'];
$bytes = max($bytes, 0);
$pow = floor(($bytes ? log($bytes) : 0) / log(1024));
$pow = min($pow, count($units) - 1);
$blocks = [];
- $text = preg_replace_callback($regex,
+ $return = preg_replace_callback($regex,
function ($matches) use ($executionId, &$blocks) {
$return = '«block-' . $executionId . '-' . count($blocks) . '»';
$text
);
- $text = $callback($text) ?? '';
+ if (is_null($return)) {
+ Logger::warning('Received null value from preg_replace_callback', ['text' => $text, 'regex' => $regex, 'blocks' => $blocks, 'executionId' => $executionId, 'callstack' => System::callstack(10)]);
+ }
+
+ $text = $callback($return ?? $text) ?? '';
// Restore code blocks
$text = preg_replace_callback('/«block-' . $executionId . '-([0-9]+)»/iU',