Fix memcache build on PHP 8.5

This commit is contained in:
crazywhalecc
2026-05-08 19:07:06 +08:00
parent 6b6025d3f0
commit a8a851659f

View File

@@ -17,6 +17,20 @@ class memcache extends PhpExtensionPackage
#[BeforeStage('php', [php::class, 'buildconfForUnix'], 'ext-memcache')]
public function patchBeforeBuildconf(): bool
{
// PHP 8.5 moved php_smart_string*.h from ext/standard/ to Zend/
foreach (['src/memcache_pool.h', 'src/memcache_pool.c', 'src/memcache_session.c', 'src/memcache_ascii_protocol.c', 'src/memcache_binary_protocol.c'] as $file) {
FileSystem::replaceFileStr(
"{$this->getSourceDir()}/{$file}",
'#include "ext/standard/php_smart_string_public.h"',
'#include "Zend/zend_smart_string_public.h"',
);
FileSystem::replaceFileStr(
"{$this->getSourceDir()}/{$file}",
'#include "ext/standard/php_smart_string.h"',
'#include "Zend/zend_smart_string.h"',
);
}
if (!$this->isBuildStatic()) {
return false;
}