Skip to content

Commit 1272acd

Browse files
committed
Fix bcmath with c23 bug
1 parent 6e354b4 commit 1272acd

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

src/SPC/store/SourcePatcher.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,15 @@ public static function patchBeforeConfigure(BuilderBase $builder): void
125125
FileSystem::replaceFileRegex(SOURCE_PATH . '/php-src/configure', '/have_capstone="yes"/', 'have_capstone="no"');
126126
}
127127

128+
// PHP 8.2 and below: bcmath libbcmath uses K&R style C function
129+
if (is_unix() && $builder->getPHPVersionID() < 80300) {
130+
FileSystem::replaceFileStr(
131+
SOURCE_PATH . '/php-src/configure',
132+
"for ac_arg in '' -std=gnu23",
133+
"for ac_arg in ''"
134+
);
135+
}
136+
128137
if (file_exists(SOURCE_PATH . '/php-src/configure.ac.bak')) {
129138
// restore configure.ac
130139
FileSystem::restoreBackupFile(SOURCE_PATH . '/php-src/configure.ac');

0 commit comments

Comments
 (0)