Skip to content

Commit 9098d15

Browse files
committed
ext/iconv/tests/bug52211.phpt: skip for non-GNU iconv implementations
This test ensures that iconv() will not return part of the string if it encounters an error, but the particular error it wants to cause is not portable. When the input sequence is not representable in the output charset, POSIX says that "iconv() shall perform an implementation-defined conversion on the character" rather than fail. As far as I know, the only two implementations that go against this recommendation (and return the error that this test is expecting) are GNU libiconv and glibc. This commit adds a SKIPIF check for the two GNU implementations to ensure that an error is actually encountered during this test.
1 parent 27a1d69 commit 9098d15

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

ext/iconv/tests/bug52211.phpt

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,16 @@
11
--TEST--
22
Bug #52211 (iconv() returns part of string on error)
3+
--SKIPIF--
4+
<?php
5+
// The two GNU iconvs (glibc and libiconv) fail if the input sequence
6+
// cannot be converted to the target charset, but most others
7+
// (including musl, FreeBSD, NetBSD, and Solaris) do not. POSIX says
8+
// that "iconv() shall perform an implementation-defined conversion on
9+
// the character," so this is likely to remain a GNUism.
10+
if (ICONV_IMPL != "libiconv" && ICONV_IMPL != "glibc") {
11+
die("skip iconv impl may not fail on unconvertable sequences");
12+
}
13+
?>
314
--EXTENSIONS--
415
iconv
516
--FILE--

0 commit comments

Comments
 (0)