Skip to content

Commit a095c57

Browse files
orlitzkyarnaud-lb
authored andcommitted
Alpine CI: don't install gnu-libiconv-dev
If we do not install GNU libiconv, the musl libc iconv() implementation should take over, allowing it to be tested on the CI. Closes phpGH-22645
1 parent 841b5bf commit a095c57

3 files changed

Lines changed: 29 additions & 6 deletions

File tree

.github/actions/apk/action.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ runs:
2828
curl-dev \
2929
freetype-dev \
3030
gettext-dev \
31-
gnu-libiconv-dev \
3231
gmp-dev \
3332
icu-dev \
3433
icu-data-full \

.github/actions/configure-alpine/action.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ runs:
4343
--enable-pcntl \
4444
--with-readline \
4545
--enable-mbstring \
46-
--with-iconv=/usr \
46+
--with-iconv \
4747
--with-curl \
4848
--with-gettext \
4949
--enable-sockets \

ext/iconv/tests/bug48147.phpt

Lines changed: 28 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,26 +2,50 @@
22
Bug #48147 (iconv with //IGNORE cuts the string)
33
--EXTENSIONS--
44
iconv
5+
--SKIPIF--
6+
<?php
7+
/*
8+
* POSIX 2024 specifies how the "//IGNORE" suffix should behave, but
9+
* falls short of requiring implementations to support it (iconv_open
10+
* is allowed to return EINVAL for a suffix it does not recognize).
11+
*
12+
* Many implementations still do not support it, which is OK. We
13+
* whitelist the ones that are known to.
14+
*/
15+
if (ICONV_IMPL != "glibc" && ICONV_IMPL != "libiconv") {
16+
die("skip iconv implementation may not support //IGNORE");
17+
}
18+
?>
519
--FILE--
620
<?php
21+
/*
22+
* POSIX says that when //IGNORE is specified, invalid bytes followed
23+
* by valid bytes "shall not be treated as an error." GNU iconv does
24+
* not follow this convention, but PHP does the right thing. In the
25+
* examples below, invalid bytes in the middle of the string get
26+
* dropped, and a string is returned. The two examples where the
27+
* problem is at the end do not qualify for the "shall not" exception
28+
* because there are no VALID bytes after the error. So PHP is morally
29+
* correct in those cases to return an error (false).
30+
*/
731
$text = "aa\xC3\xC3\xC3\xB8aa";
832
var_dump(iconv("UTF-8", "UTF-8", $text));
933
var_dump(urlencode(iconv("UTF-8", "UTF-8//IGNORE", $text)));
1034
// only invalid
11-
var_dump(urlencode(iconv("UTF-8", "UTF-8//IGNORE", "\xC3")));
35+
var_dump(iconv("UTF-8", "UTF-8//IGNORE", "\xC3"));
1236
// start invalid
1337
var_dump(urlencode(iconv("UTF-8", "UTF-8//IGNORE", "\xC3\xC3\xC3\xB8aa")));
1438
// finish invalid
15-
var_dump(urlencode(iconv("UTF-8", "UTF-8//IGNORE", "aa\xC3\xC3\xC3")));
39+
var_dump(iconv("UTF-8", "UTF-8//IGNORE", "aa\xC3\xC3\xC3"));
1640
?>
1741
--EXPECTF--
1842
Notice: iconv(): Detected an illegal character in input string in %s on line %d
1943
bool(false)
2044
string(10) "aa%C3%B8aa"
2145

2246
Notice: iconv(): Detected an incomplete multibyte character in input string in %s on line %d
23-
string(0) ""
47+
bool(false)
2448
string(8) "%C3%B8aa"
2549

2650
Notice: iconv(): Detected an incomplete multibyte character in input string in %s on line %d
27-
string(0) ""
51+
bool(false)

0 commit comments

Comments
 (0)