[php-src] Issue #18831: Build fails with ICU 76+ due to missing `toU16StringView` in unistr.h
| From: | thecaliskan | Date: | Wed, 11 Jun 2025 07:35:21 +0000 |
| Subject: | [php-src] Issue #18831: Build fails with ICU 76+ due to missing `toU16StringView` in unistr.h | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-250239@lists.php.net to get a copy of this message | ||
Issue: https://github.com/php/php-src/issues/18831
Author: thecaliskan
### Description
I'm encountering a build failure when trying to install PHP extensions (
intl) on
Alpine 3.22. The issue is caused by the toU16StringView function being used in ICU
headers but missing from the current ICU version shipped with Alpine 3.22 (ICU 76+).
## 📄 Error Log
```
/usr/include/unicode/unistr.h: In function 'icu_76::UnicodeString icu_76::operator+(const
UnicodeString&, const S&)':
/usr/include/unicode/unistr.h:4118:46: error: 'toU16StringView' is not a member of
'icu_76::internal'
4118 | return unistr_internalConcat(s1, internal::toU16StringView(s2));
| ^~~~~~~~~~~~~~~
/usr/include/unicode/unistr.h:4118:10: error: there are no arguments to
'unistr_internalConcat' that depend on a template parameter, so a declaration of
'unistr_internalConcat' must be available [-fpermissive]
```
You can also reproduce this with a minimal Dockerfile using php:8.4-alpine3.22:
## 🐳 Docker Reproduction
```Dockerfile
FROM php:8.4-alpine3.22
RUN apk add --no-cache icu-dev g++ && docker-php-ext-install intl
```
## ✅ Works on:
- Alpine 3.21 (with older ICU version)
## ❌ Fails on:
- Alpine 3.22 (icu-76.1)
---
This appears to be an incompatibility between PHP's use of the ICU headers and the updated ICU
76+ API. toU16StringView might have been removed or renamed (e.g., to
toU16StringViewNullable).
Would love guidance on how best to proceed. Is a patch to intl needed to be compatible
with ICU 76+?
Thanks!
> Reference Issue: [GitHub Issue Link](https://github.com/php/php-src/issues/18743)
> Reference build failure: [GitHub Action
> Link](https://github.com/thecaliskan/oort/actions/runs/15573866767/job/43865059489)
### PHP Version
```plain
8.4-alpine
8.3-alpine
8.2-alpine
8.1-alpine
```
### Operating System
Alpine 3.22