str_starts_with

This commit is contained in:
DubbleClick 2025-07-19 15:11:22 +07:00
parent 01887d652c
commit ada203c00c

View File

@ -33,7 +33,7 @@ class xlswriter extends Extension
SourcePatcher::patchFile('spc_fix_xlswriter_win32.patch', $this->source_dir); SourcePatcher::patchFile('spc_fix_xlswriter_win32.patch', $this->source_dir);
$content = file_get_contents($this->source_dir . '/library/libxlsxwriter/src/theme.c'); $content = file_get_contents($this->source_dir . '/library/libxlsxwriter/src/theme.c');
$bom = pack('CCC', 0xEF, 0xBB, 0xBF); $bom = pack('CCC', 0xEF, 0xBB, 0xBF);
if (substr($content, 0, 3) !== $bom) { if (!str_starts_with($content, $bom)) {
file_put_contents($this->source_dir . '/library/libxlsxwriter/src/theme.c', $bom . $content); file_put_contents($this->source_dir . '/library/libxlsxwriter/src/theme.c', $bom . $content);
} }
return true; return true;