Skip to content

ext/iconv, ext/standard: make tests more robust on FreeBSD - #24406

Open
Sjord wants to merge 1 commit into
php:PHP-8.4from
Sjord:improve-tests-freebsd
Open

Sjord wants to merge 1 commit into
php:PHP-8.4from
Sjord:improve-tests-freebsd

Conversation

@Sjord

@Sjord Sjord commented Oct 18, 2026

Copy link
Copy Markdown
Contributor

I ran PHP's tests on FreeBSD 15.1, and these were failing:

  • ext/iconv/tests/bug52211.phpt: trigger the error with an incomplete UTF-8 source sequence. Rejecting a valid but unrepresentable character is implementation-defined; FreeBSD's ASCII passes bytes through for identity conversions, while glibc rejects them. https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=296765

  • ext/standard/tests/file/chmod_basic.phpt: probe which special mode bits can be set on a regular file. FreeBSD rejects the sticky bit on regular files with EFTYPE.

  • ext/standard/tests/file/006_variation2.phpt: apply the sticky bit only to the directory, whose semantics are portable, and update the expected file modes.

  • ext/standard/tests/ini_info/php_ini_loaded_file.phpt: do not forward TEST_PHP_EXTRA_ARGS for the "no ini file" case. It can contain -c, which takes precedence over -n, causing the child to load run-tests.php's temporary ini file.

Also clear the stat cache before calling fileperms(), not after.

I ran PHP's tests on FreeBSD 15.1, and these were failing:

- ext/iconv/tests/bug52211.phpt: trigger the error with an incomplete
  UTF-8 source sequence. Rejecting a valid but unrepresentable
  character is implementation-defined; FreeBSD's ASCII passes bytes
  through for identity conversions, while glibc rejects them.
  https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=296765

- ext/standard/tests/file/chmod_basic.phpt: probe which special mode
  bits can be set on a regular file. FreeBSD rejects the sticky bit on
  regular files with EFTYPE.

- ext/standard/tests/file/006_variation2.phpt: apply the sticky bit only
  to the directory, whose semantics are portable, and update the
  expected file modes.

- ext/standard/tests/ini_info/php_ini_loaded_file.phpt: do not forward
  TEST_PHP_EXTRA_ARGS for the "no ini file" case. It can contain -c,
  which takes precedence over -n, causing the child to load
  run-tests.php's temporary ini file.

Also clear the stat cache before calling fileperms(), not after.
@Sjord
Sjord marked this pull request as ready for review October 18, 2026 16:32
@Sjord
Sjord requested a review from bukka as a code owner October 18, 2026 16:32
@NattyNarwhal

Copy link
Copy Markdown
Member

Tagging myself since I think this will help test failures on PASE (see GH-22837, been whittling those away), just need to get around to testing it (can't tonight).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants