Commit ce1cadba291 for php.net

commit ce1cadba291c758c0dfa7a82c0078a0d2edfaa52
Author: Petr Sumbera <sumbera@volny.cz>
Date:   Fri Dec 12 07:21:39 2025 -0500

    Fix Solaris tests and add nightly CI job

    Closes GH-20709

diff --git a/.github/actions/solaris/action.yml b/.github/actions/solaris/action.yml
new file mode 100644
index 00000000000..ef7cffe32ab
--- /dev/null
+++ b/.github/actions/solaris/action.yml
@@ -0,0 +1,88 @@
+name: Solaris
+inputs:
+  configurationParameters:
+    default: ''
+    required: false
+  runExtraTests:
+    default: false
+    required: false
+runs:
+  using: composite
+  steps:
+    - name: Solaris
+      uses: vmactions/solaris-vm@v1
+      with:
+        release: "11.4-gcc"
+        usesh: true
+        copyback: false
+        disable-cache: true
+        prepare: |
+          cd $GITHUB_WORKSPACE
+          pkg install bison developer/icu libzip oniguruma re2c
+
+          ./buildconf -f
+          CC=gcc CXX=g++ \
+          CFLAGS="-Wno-char-subscripts" \
+          PATH=/usr/gnu/bin:/usr/bin \
+          PKG_CONFIG_PATH=/usr/lib/amd64/pkgconfig \
+          ./configure \
+            --prefix=/usr/local \
+            --enable-debug \
+            --enable-werror \
+            --enable-option-checking=fatal \
+            --enable-fpm \
+            --without-pear \
+            --with-bz2 \
+            --with-jpeg \
+            --with-webp \
+            --with-freetype \
+            --enable-gd \
+            --enable-exif \
+            --with-zip \
+            --with-zlib \
+            --enable-soap \
+            --enable-xmlreader \
+            --with-xsl \
+            --with-libxml \
+            --enable-shmop \
+            --enable-pcntl \
+            --enable-mbstring \
+            --with-curl \
+            --enable-sockets \
+            --with-openssl \
+            --enable-bcmath \
+            --enable-calendar \
+            --enable-ftp \
+            --enable-zend-test \
+            --enable-dl-test=shared \
+            --enable-intl \
+            --with-mhash \
+            --with-config-file-path=/etc \
+            --with-config-file-scan-dir=/etc/php.d \
+            ${{ inputs.configurationParameters }}
+
+          gmake -j2
+          mkdir /etc/php.d
+          gmake install > /dev/null
+          echo opcache.enable_cli=1 > /etc/php.d/opcache.ini
+          echo opcache.protect_memory=1 >> /etc/php.d/opcache.ini
+          echo opcache.preload_user=root >> /etc/php.d/opcache.ini
+        run: |
+          cd $GITHUB_WORKSPACE
+
+          export SKIP_IO_CAPTURE_TESTS=1
+          export CI_NO_IPV6=1
+          export STACK_LIMIT_DEFAULTS_CHECK=1
+          PATH=/usr/gnu/bin:/usr/bin \
+          sapi/cli/php run-tests.php \
+            -P -q -j1 \
+            -g FAIL,BORK,LEAK,XLEAK \
+            --no-progress \
+            --offline \
+            --show-diff \
+            --show-slow 1000 \
+            --set-timeout 120
+
+          if test "${{ inputs.runExtraTests }}" = "true"; then
+            sapi/cli/php run-extra-tests.php
+          fi
diff --git a/.github/matrix.php b/.github/matrix.php
index 64bb60519de..2ce59cb657b 100644
--- a/.github/matrix.php
+++ b/.github/matrix.php
@@ -62,6 +62,7 @@ function select_jobs($repository, $trigger, $nightly, $labels, $php_version, $re
     $test_msan = in_array('CI: MSAN', $labels, true);
     $test_opcache_variation = in_array('CI: Opcache Variation', $labels, true);
     $test_pecl = in_array('CI: PECL', $labels, true);
+    $test_solaris = in_array('CI: Solaris', $labels, true);
     $test_windows = in_array('CI: Windows', $labels, true);

     $jobs = [];
@@ -132,6 +133,9 @@ function select_jobs($repository, $trigger, $nightly, $labels, $php_version, $re
     if (($all_jobs && $ref === 'master') || $test_pecl) {
         $jobs['PECL'] = true;
     }
+    if (version_compare($php_version, '8.6', '>=') && ($all_jobs || $test_solaris)) {
+        $jobs['SOLARIS'] = true;
+    }
     if ($all_jobs || !$no_jobs || $test_windows) {
         $jobs['WINDOWS']['matrix'] = $all_variations
             ? ['include' => [
diff --git a/.github/workflows/test-suite.yml b/.github/workflows/test-suite.yml
index 9f5496d1d69..83aae655a3c 100644
--- a/.github/workflows/test-suite.yml
+++ b/.github/workflows/test-suite.yml
@@ -979,6 +979,21 @@ jobs:
           configurationParameters: >-
             --${{ matrix.zts && 'enable' || 'disable' }}-zts
           runExtraTests: true
+  SOLARIS:
+    if: ${{ fromJson(inputs.branch).jobs.SOLARIS }}
+    name: "SOLARIS"
+    runs-on: ubuntu-latest
+    timeout-minutes: 50
+    steps:
+      - name: git checkout
+        uses: actions/checkout@v5
+        with:
+          ref: ${{ fromJson(inputs.branch).ref }}
+      - name: Solaris
+        uses: ./.github/actions/solaris
+        with:
+          configurationParameters: --disable-zts
+          runExtraTests: true
   BENCHMARKING:
     name: BENCHMARKING
     if: ${{ fromJson(inputs.branch).jobs.BENCHMARKING }}
diff --git a/Zend/tests/stack_limit/stack_limit_010.phpt b/Zend/tests/stack_limit/stack_limit_010.phpt
index 4f8358fb41e..85736423e41 100644
--- a/Zend/tests/stack_limit/stack_limit_010.phpt
+++ b/Zend/tests/stack_limit/stack_limit_010.phpt
@@ -27,7 +27,9 @@
         'true' => 16*1024*1024, // https://github.com/actions/runner-images/pull/3328
         default => 8*1024*1024,
     },
-    'SunOS' => 10 * 1024 * 1024,
+    'SunOS' => preg_match('/(omnios|illumos|smartos|oi-|openindiana|joyent)/i', php_uname('v'))
+        ? 10 * 1024 * 1024
+        : 8 * 1024 * 1024,
     'Windows NT' => 67108864 - 4*4096, // Set by sapi/cli/config.w32
 };

diff --git a/ext/calendar/tests/unixtojd.phpt b/ext/calendar/tests/unixtojd.phpt
index 3d0ffa3fea3..c96c9695dc5 100644
--- a/ext/calendar/tests/unixtojd.phpt
+++ b/ext/calendar/tests/unixtojd.phpt
@@ -1,5 +1,11 @@
 --TEST--
 unixtojd()
+--SKIPIF--
+<?php
+if (PHP_OS_FAMILY === 'Solaris') {
+    die("skip Solaris localtime() produces different Julian day");
+}
+?>
 --EXTENSIONS--
 calendar
 --ENV--
diff --git a/ext/ctype/tests/bug25745.phpt b/ext/ctype/tests/bug25745.phpt
index 420d2c18807..935ce4726ce 100644
--- a/ext/ctype/tests/bug25745.phpt
+++ b/ext/ctype/tests/bug25745.phpt
@@ -2,6 +2,12 @@
 Bug #25745 (ctype functions fail with non-ascii characters)
 --EXTENSIONS--
 ctype
+--SKIPIF--
+<?php
+if (PHP_OS_FAMILY === 'Solaris') {
+    die("skip not valid fo Solaris");
+}
+?>
 --INI--
 error_reporting=E_ALL&~E_DEPRECATED
 --FILE--
diff --git a/ext/date/tests/bug33532.phpt b/ext/date/tests/bug33532.phpt
index 7734cc955c7..a107650528c 100644
--- a/ext/date/tests/bug33532.phpt
+++ b/ext/date/tests/bug33532.phpt
@@ -5,7 +5,7 @@
 date.timezone=UTC
 --SKIPIF--
 <?php
-if(PHP_OS == 'Darwin' || defined('PHP_WINDOWS_VERSION_MAJOR')) die("skip strftime uses system TZ on Darwin and Windows");
+if(PHP_OS == 'Darwin' || PHP_OS_FAMILY === 'Solaris' || defined('PHP_WINDOWS_VERSION_MAJOR')) die("skip strftime uses system TZ on Darwin, Solaris and Windows");
 if (!@strftime('%Z')) die('skip strftime does not support %Z');
 ?>
 --FILE--
diff --git a/ext/date/tests/gmstrftime_variation16.phpt b/ext/date/tests/gmstrftime_variation16.phpt
index d80e19ef4f6..eca0618af16 100644
--- a/ext/date/tests/gmstrftime_variation16.phpt
+++ b/ext/date/tests/gmstrftime_variation16.phpt
@@ -5,6 +5,9 @@
 if (strtoupper(substr(PHP_OS, 0, 3)) == 'WIN') {
     die("skip Test is not valid for Windows");
 }
+if (PHP_OS_FAMILY === 'Solaris') {
+    die("skip Solaris uses ' 8:08:08 AM' for %r (time format differs)");
+}
 ?>
 --FILE--
 <?php
diff --git a/ext/date/tests/strftime_variation16.phpt b/ext/date/tests/strftime_variation16.phpt
index 06460397cf0..a06834fa54c 100644
--- a/ext/date/tests/strftime_variation16.phpt
+++ b/ext/date/tests/strftime_variation16.phpt
@@ -5,6 +5,9 @@
 if (strtoupper(substr(PHP_OS, 0, 3)) == 'WIN') {
     die("skip Test is not valid for Windows");
 }
+if (PHP_OS_FAMILY === 'Solaris') {
+    die("skip Solaris uses ' 8:08:08 AM' for %r (time format differs)");
+}
 ?>
 --FILE--
 <?php
diff --git a/ext/fileinfo/tests/finfo_upstream.phpt b/ext/fileinfo/tests/finfo_upstream.phpt
index 2a28bd7f776..ff1c1b16140 100644
--- a/ext/fileinfo/tests/finfo_upstream.phpt
+++ b/ext/fileinfo/tests/finfo_upstream.phpt
@@ -2,6 +2,12 @@
 Fileinfo run upstream tests
 --EXTENSIONS--
 fileinfo
+--SKIPIF--
+<?php
+if (PHP_OS_FAMILY === 'Solaris') {
+    die("skip timezone-dependent libmagic output differs on Solaris");
+}
+?>
 --ENV--
 TZ=UTC
 --FILE--
diff --git a/ext/iconv/tests/bug37773.phpt b/ext/iconv/tests/bug37773.phpt
index 4dcdd56b3cb..1d1b8f569ed 100644
--- a/ext/iconv/tests/bug37773.phpt
+++ b/ext/iconv/tests/bug37773.phpt
@@ -10,6 +10,9 @@
     die("skip UTF-8 is not supported?");
 }

+if (PHP_OS_FAMILY === 'Solaris') {
+    die("skip Solaris iconv behaves differently");
+}
 ?>
 --FILE--
 <?php
diff --git a/ext/iconv/tests/bug52211.phpt b/ext/iconv/tests/bug52211.phpt
index f213c764de8..155fad85348 100644
--- a/ext/iconv/tests/bug52211.phpt
+++ b/ext/iconv/tests/bug52211.phpt
@@ -2,6 +2,12 @@
 Bug #52211 (iconv() returns part of string on error)
 --EXTENSIONS--
 iconv
+--SKIPIF--
+<?php
+if (PHP_OS_FAMILY === 'Solaris') {
+    die("skip Solaris iconv behaves differently");
+}
+?>
 --FILE--
 <?php

diff --git a/ext/iconv/tests/bug69840.phpt b/ext/iconv/tests/bug69840.phpt
index 4d3bc30e017..521a708c450 100644
--- a/ext/iconv/tests/bug69840.phpt
+++ b/ext/iconv/tests/bug69840.phpt
@@ -2,6 +2,12 @@
 Bug #69840 (iconv_substr() doesn't work with UTF-16BE)
 --EXTENSIONS--
 iconv
+--SKIPIF--
+<?php
+if (PHP_OS_FAMILY === 'Solaris') {
+    die("skip Solaris iconv behaves differently");
+}
+?>
 --FILE--
 <?php
 $str = iconv_substr("a\x00b\x00", 0, 1, 'UTF-16LE');
diff --git a/ext/iconv/tests/eucjp2iso2022jp.phpt b/ext/iconv/tests/eucjp2iso2022jp.phpt
index 6c1a8ec1214..490e772c80c 100644
--- a/ext/iconv/tests/eucjp2iso2022jp.phpt
+++ b/ext/iconv/tests/eucjp2iso2022jp.phpt
@@ -2,6 +2,12 @@
 EUC-JP to ISO-2022-JP
 --EXTENSIONS--
 iconv
+--SKIPIF--
+<?php
+if (PHP_OS_FAMILY === 'Solaris') {
+    die("skip Solaris iconv behaves differently");
+}
+?>
 --INI--
 error_reporting=2039
 --FILE--
diff --git a/ext/iconv/tests/iconv003.phpt b/ext/iconv/tests/iconv003.phpt
index 86e2e207b2a..f3c2da39ed7 100644
--- a/ext/iconv/tests/iconv003.phpt
+++ b/ext/iconv/tests/iconv003.phpt
@@ -2,6 +2,12 @@
 iconv() test 3
 --EXTENSIONS--
 iconv
+--SKIPIF--
+<?php
+if (PHP_OS_FAMILY === 'Solaris') {
+    die("skip Solaris iconv behaves differently");
+}
+?>
 --FILE--
 <?php
 for ($i = 0; $i < 3; ++$i) {
diff --git a/ext/iconv/tests/iconv_basic_001.phpt b/ext/iconv/tests/iconv_basic_001.phpt
index a66d8b6d330..52a23ca48d1 100644
--- a/ext/iconv/tests/iconv_basic_001.phpt
+++ b/ext/iconv/tests/iconv_basic_001.phpt
@@ -9,6 +9,7 @@
 if (substr(PHP_OS, 0, 3) == 'WIN' ) {die('skip not for windows');}
 if (setlocale(LC_ALL, 'invalid') === 'invalid') { die('skip setlocale() is broken /w musl'); }
 if (setlocale(LC_ALL, "en_US.utf8") === false) { die('skip en_US.utf8 locales not available'); }
+if (PHP_OS_FAMILY === 'Solaris') { die("skip Solaris native iconv lacks GNU transliteration"); }
 ?>
 --FILE--
 <?php
diff --git a/ext/iconv/tests/iconv_mime_encode.phpt b/ext/iconv/tests/iconv_mime_encode.phpt
index e055f53b016..9cf906a73e6 100644
--- a/ext/iconv/tests/iconv_mime_encode.phpt
+++ b/ext/iconv/tests/iconv_mime_encode.phpt
@@ -4,6 +4,12 @@
 iconv
 --INI--
 iconv.internal_charset=iso-8859-1
+--SKIPIF--
+<?php
+if (PHP_OS_FAMILY === 'Solaris') {
+    die("skip Solaris native iconv does not support MIME encoding");
+}
+?>
 --FILE--
 <?php
 function my_error_handler($errno, $errmsg, $filename, $linenum)
diff --git a/ext/iconv/tests/iconv_strrpos.phpt b/ext/iconv/tests/iconv_strrpos.phpt
index 66d4e81d1d2..111d59dcd42 100644
--- a/ext/iconv/tests/iconv_strrpos.phpt
+++ b/ext/iconv/tests/iconv_strrpos.phpt
@@ -2,6 +2,12 @@
 iconv_strrpos()
 --EXTENSIONS--
 iconv
+--SKIPIF--
+<?php
+if (PHP_OS_FAMILY === 'Solaris') {
+    die("skip Solaris iconv behaves differently");
+}
+?>
 --INI--
 iconv.internal_charset=ISO-8859-1
 --FILE--
diff --git a/ext/iconv/tests/iconv_substr_out_of_bounds.phpt b/ext/iconv/tests/iconv_substr_out_of_bounds.phpt
index fa335ccc22e..7f4c28ae11f 100644
--- a/ext/iconv/tests/iconv_substr_out_of_bounds.phpt
+++ b/ext/iconv/tests/iconv_substr_out_of_bounds.phpt
@@ -2,6 +2,12 @@
 iconv_substr() with out of bounds offset
 --EXTENSIONS--
 iconv
+--SKIPIF--
+<?php
+if (PHP_OS_FAMILY === 'Solaris') {
+    die("skip Solaris iconv behaves differently");
+}
+?>
 --FILE--
 <?php

diff --git a/ext/libxml/tests/bug61367-write.phpt b/ext/libxml/tests/bug61367-write.phpt
index c65341e1972..f11f1095220 100644
--- a/ext/libxml/tests/bug61367-write.phpt
+++ b/ext/libxml/tests/bug61367-write.phpt
@@ -44,5 +44,5 @@ public function stream_open (  $path ,  $mode ,  $options ,  &$opened_path ) {

 Warning: DOMDocument::save(): open_basedir restriction in effect. File(%s) is not within the allowed path(s): (.) in %s on line %d

-Warning: DOMDocument::save(%s): Failed to open stream: Operation not permitted in %s on line %d
+Warning: DOMDocument::save(%s): Failed to open stream: %r(Operation not permitted|Insufficient privileges)%r in %s on line %d
 bool(false)
diff --git a/ext/mysqli/tests/gh9590.phpt b/ext/mysqli/tests/gh9590.phpt
index 7f795e77422..78c1357fa9b 100644
--- a/ext/mysqli/tests/gh9590.phpt
+++ b/ext/mysqli/tests/gh9590.phpt
@@ -12,6 +12,8 @@

 if (!function_exists('posix_setrlimit') || !posix_setrlimit(POSIX_RLIMIT_NOFILE, 2048, -1))
     die('skip Failed to set POSIX_RLIMIT_NOFILE');
+if (PHP_OS_FAMILY === 'Solaris')
+    die('skip Solaris LP64 FD_SETSIZE=65536 not practically exceedable here');
 ?>
 --FILE--
 <?php
diff --git a/ext/pcntl/tests/pcntl_cpuaffinity.phpt b/ext/pcntl/tests/pcntl_cpuaffinity.phpt
index 1e3809f928c..91c71d1ebda 100644
--- a/ext/pcntl/tests/pcntl_cpuaffinity.phpt
+++ b/ext/pcntl/tests/pcntl_cpuaffinity.phpt
@@ -4,6 +4,9 @@
 pcntl
 --SKIPIF--
 <?php
+if (PHP_OS_FAMILY === 'Solaris') {
+    die("skip broken pset_create()");
+}
 if (!function_exists("pcntl_setcpuaffinity")) die("skip pcntl_setcpuaffinity is not available");
 ?>
 --FILE--
diff --git a/ext/pcntl/tests/pcntl_getcpu.phpt b/ext/pcntl/tests/pcntl_getcpu.phpt
index b7e84a291d9..2250fde3a1b 100644
--- a/ext/pcntl/tests/pcntl_getcpu.phpt
+++ b/ext/pcntl/tests/pcntl_getcpu.phpt
@@ -7,6 +7,7 @@
 if (!function_exists("pcntl_getcpu")) die("skip pcntl_getcpu() is not available");
 if (!function_exists("pcntl_setcpuaffinity")) die("skip pcntl_setcpuaffinity() is not available");
 if (getenv('SKIP_REPEAT')) die("skip Not repeatable");
+if (PHP_OS_FAMILY === 'Solaris') die("skip doesn't work on Solaris");
 ?>
 --FILE--
 <?php
diff --git a/ext/posix/tests/posix_fpathconf.phpt b/ext/posix/tests/posix_fpathconf.phpt
index 4225852c3a0..91918d5901b 100644
--- a/ext/posix/tests/posix_fpathconf.phpt
+++ b/ext/posix/tests/posix_fpathconf.phpt
@@ -25,6 +25,6 @@
 Warning: posix_fpathconf(): Argument #1 ($file_descriptor) must be between 0 and %d in %s on line %d
 bool(false)
 bool(true)
-string(19) "Bad file descriptor"
+string(%d) "Bad file %r(descriptor|number)%r"
 posix_fpathconf(): Argument #1 ($file_descriptor) must be of type int|resource, string given
 int(%d)
diff --git a/ext/posix/tests/posix_isatty_value_errors.phpt b/ext/posix/tests/posix_isatty_value_errors.phpt
index 599d892de0d..3e6b715b05f 100644
--- a/ext/posix/tests/posix_isatty_value_errors.phpt
+++ b/ext/posix/tests/posix_isatty_value_errors.phpt
@@ -24,10 +24,10 @@

 Warning: posix_isatty(): Argument #1 ($file_descriptor) must be between 0 and %d in %s on line %d
 bool(false)
-string(19) "Bad file descriptor"
+string(%d) "Bad file %r(descriptor|number)%r"
 bool(false)
-string(19) "Bad file descriptor"
+string(%d) "Bad file %r(descriptor|number)%r"

 Warning: posix_isatty(): Argument #1 ($file_descriptor) must be between 0 and %d in %s on line %d
 bool(false)
-string(19) "Bad file descriptor"
+string(%d) "Bad file %r(descriptor|number)%r"
diff --git a/ext/posix/tests/posix_ttyname_value_errors.phpt b/ext/posix/tests/posix_ttyname_value_errors.phpt
index 31014fd6f3c..41cf07876d7 100644
--- a/ext/posix/tests/posix_ttyname_value_errors.phpt
+++ b/ext/posix/tests/posix_ttyname_value_errors.phpt
@@ -22,8 +22,8 @@
 --EXPECTF--
 Warning: posix_ttyname(): Argument #1 ($file_descriptor) must be between 0 and %d in %s on line %d
 bool(false)
-string(19) "Bad file descriptor"
+string(%d) "Bad file %r(descriptor|number)%r"

 Warning: posix_ttyname(): Argument #1 ($file_descriptor) must be between 0 and %d in %s on line %d
 bool(false)
-string(19) "Bad file descriptor"
+string(%d) "Bad file %r(descriptor|number)%r"
diff --git a/ext/soap/php_encoding.c b/ext/soap/php_encoding.c
index 77d97b566fc..18cdb8304c2 100644
--- a/ext/soap/php_encoding.c
+++ b/ext/soap/php_encoding.c
@@ -2953,9 +2953,9 @@ static xmlNodePtr to_xml_datetime_ex(encodeTypePtr type, zval *data, char *forma
 			labs(ta->tm_gmtoff / 3600), labs( (ta->tm_gmtoff % 3600) / 60 ));
 #else
 # if defined(__CYGWIN__) || (defined(PHP_WIN32) && defined(_MSC_VER))
-		snprintf(tzbuf, sizeof(tzbuf), "%c%02d:%02d", ((ta->tm_isdst ? _timezone - 3600:_timezone)>0)?'-':'+', abs((ta->tm_isdst ? _timezone - 3600 : _timezone) / 3600), abs(((ta->tm_isdst ? _timezone - 3600 : _timezone) % 3600) / 60));
+		snprintf(tzbuf, sizeof(tzbuf), "%c%02ld:%02ld", ((ta->tm_isdst ? _timezone - 3600:_timezone)>0)?'-':'+', labs((ta->tm_isdst ? _timezone - 3600 : _timezone) / 3600), labs(((ta->tm_isdst ? _timezone - 3600 : _timezone) % 3600) / 60));
 # else
-		snprintf(tzbuf, sizeof(tzbuf), "%c%02d:%02d", ((ta->tm_isdst ? timezone - 3600:timezone)>0)?'-':'+', abs((ta->tm_isdst ? timezone - 3600 : timezone) / 3600), abs(((ta->tm_isdst ? timezone - 3600 : timezone) % 3600) / 60));
+		snprintf(tzbuf, sizeof(tzbuf), "%c%02ld:%02ld", ((ta->tm_isdst ? timezone - 3600:timezone)>0)?'-':'+', labs((ta->tm_isdst ? timezone - 3600 : timezone) / 3600), labs(((ta->tm_isdst ? timezone - 3600 : timezone) % 3600) / 60));
 # endif
 #endif
 		if (strcmp(tzbuf,"+00:00") == 0) {
diff --git a/ext/sockets/tests/gh20532.phpt b/ext/sockets/tests/gh20532.phpt
index f3368c83036..360f9e7e11a 100644
--- a/ext/sockets/tests/gh20532.phpt
+++ b/ext/sockets/tests/gh20532.phpt
@@ -5,7 +5,7 @@
 --FILE--
 <?php
 $error_code = 0;
-var_dump(socket_addrinfo_lookup(".whynot", null, [], $error_code) === false && $error_code === EAI_NONAME);
+var_dump(socket_addrinfo_lookup(".whynot", null, [], $error_code) === false && in_array($error_code, [EAI_NONAME, EAI_FAIL], true));
 var_dump(socket_addrinfo_lookup("2001:db8::1", null, ['ai_family' => AF_INET], $error_code) === false && in_array($error_code, [EAI_FAMILY, EAI_ADDRFAMILY, EAI_NONAME, EAI_NODATA]));
 var_dump(socket_addrinfo_lookup("example.com", "http", ['ai_socktype' => SOCK_RAW, 'ai_flags' => 2147483647], $error_code) === false && in_array($error_code, [EAI_SOCKTYPE, EAI_SERVICE, EAI_BADFLAGS, EAI_NONAME]));
 ?>
diff --git a/ext/sockets/tests/socket_addrinfo_explain.phpt b/ext/sockets/tests/socket_addrinfo_explain.phpt
index e06ed36a64e..ef516b96649 100644
--- a/ext/sockets/tests/socket_addrinfo_explain.phpt
+++ b/ext/sockets/tests/socket_addrinfo_explain.phpt
@@ -12,6 +12,11 @@
 // Musl sets ai_canonname even if AI_CANONNAME is not specified.
 unset($result['ai_canonname']);
 var_dump($result);
+// Solaris uses different numeric values for SOCK_* constants,
+// so avoid comparing raw integers in EXPECTF.
+if ($result['ai_socktype'] != SOCK_DGRAM) {
+    echo "Wrong socktype\n";
+}
 echo "Done";
 ?>
 --EXPECTF--
@@ -21,7 +26,7 @@
   ["ai_family"]=>
   int(2)
   ["ai_socktype"]=>
-  int(2)
+  int(%s)
   ["ai_protocol"]=>
   int(%d)
   ["ai_addr"]=>
diff --git a/ext/sockets/tests/socket_afpacket.phpt b/ext/sockets/tests/socket_afpacket.phpt
index 2e83a654766..a707ad48fa7 100644
--- a/ext/sockets/tests/socket_afpacket.phpt
+++ b/ext/sockets/tests/socket_afpacket.phpt
@@ -9,6 +9,9 @@
 if (!defined("AF_PACKET")) {
     die('SKIP AF_PACKET not supported on this platform.');
 }
+if (!defined("ETH_P_IP")) {
+    die('SKIP ETH_P_IP not available on this platform.');
+}
 if (!function_exists("posix_getuid") || posix_getuid() != 0) {
     die('SKIP AF_PACKET requires root permissions.');
 }
diff --git a/ext/sockets/tests/socket_create_pair-wrongparams.phpt b/ext/sockets/tests/socket_create_pair-wrongparams.phpt
index 8877e3d5b99..1d0a6540841 100644
--- a/ext/sockets/tests/socket_create_pair-wrongparams.phpt
+++ b/ext/sockets/tests/socket_create_pair-wrongparams.phpt
@@ -27,7 +27,7 @@

 ?>
 --EXPECTF--
-Warning: socket_create_pair(): Unable to create socket pair [%d]: %s not supported in %s on line %d
+Warning: socket_create_pair(): Unable to create socket pair [%d]: %s %r(not supported|wrong type for socket)%r in %s on line %d
 bool(false)
 socket_create_pair(): Argument #1 ($domain) must be one of AF_UNIX, AF_INET6, or AF_INET
 socket_create_pair(): Argument #2 ($type) must be one of SOCK_STREAM, SOCK_DGRAM, SOCK_SEQPACKET, SOCK_RAW, or SOCK_RDM%A
diff --git a/ext/sockets/tests/socket_export_stream-4.phpt b/ext/sockets/tests/socket_export_stream-4.phpt
index a3879a93b7c..16867113868 100644
--- a/ext/sockets/tests/socket_export_stream-4.phpt
+++ b/ext/sockets/tests/socket_export_stream-4.phpt
@@ -32,7 +32,9 @@ function test($stream, $sock) {
         echo "\n";
         echo "socket_get_option ";
         try {
-            print_r(socket_get_option($sock, SOL_SOCKET, SO_TYPE));
+            // Solaris uses different numeric values for SOCK_* constants
+            $opt = socket_get_option($sock, SOL_SOCKET, SO_TYPE);
+            print_r($opt === SOCK_DGRAM ? "DGRAM" : $opt);
         } catch (Error $e) {
             echo get_class($e), ": ", $e->getMessage(), "\n";
         }
@@ -81,12 +83,12 @@ function test($stream, $sock) {
 normal
 stream_set_blocking 1
 socket_set_block 1
-socket_get_option 2
+socket_get_option DGRAM


 unset stream
 socket_set_block 1
-socket_get_option 2
+socket_get_option DGRAM


 unset socket
diff --git a/ext/sockets/tests/socket_import_stream-4.phpt b/ext/sockets/tests/socket_import_stream-4.phpt
index efe987dfdce..87ca608b862 100644
--- a/ext/sockets/tests/socket_import_stream-4.phpt
+++ b/ext/sockets/tests/socket_import_stream-4.phpt
@@ -31,7 +31,9 @@ function test($stream, $sock) {
         echo "\n";
         echo "socket_get_option ";
         try {
-            print_r(socket_get_option($sock, SOL_SOCKET, SO_TYPE));
+            // Solaris uses different numeric values for SOCK_* constants
+            $opt = socket_get_option($sock, SOL_SOCKET, SO_TYPE);
+            print_r($opt === SOCK_DGRAM ? "DGRAM" : $opt);
         } catch (Error $e) {
             echo get_class($e), ": ", $e->getMessage(), "\n";
         }
@@ -75,12 +77,12 @@ function test($stream, $sock) {
 normal
 stream_set_blocking 1
 socket_set_block 1
-socket_get_option 2
+socket_get_option DGRAM


 unset stream
 socket_set_block 1
-socket_get_option 2
+socket_get_option DGRAM


 unset socket
diff --git a/ext/sockets/tests/socket_tcp_congestion.phpt b/ext/sockets/tests/socket_tcp_congestion.phpt
index 56b58761854..45853f6bf8c 100644
--- a/ext/sockets/tests/socket_tcp_congestion.phpt
+++ b/ext/sockets/tests/socket_tcp_congestion.phpt
@@ -7,6 +7,9 @@
 if (!defined('TCP_CONGESTION')) {
     die('skip TCP_CONGESTION test');
 }
+if (PHP_OS_FAMILY === 'Solaris' ) {
+    die("skip Solaris does not allow setting TCP_CONGESTION");
+}
 ?>
 --FILE--
 <?php
diff --git a/ext/standard/tests/file/005_variation2.phpt b/ext/standard/tests/file/005_variation2.phpt
index 270a6cfbdd8..42b0fd1904d 100644
--- a/ext/standard/tests/file/005_variation2.phpt
+++ b/ext/standard/tests/file/005_variation2.phpt
@@ -52,6 +52,7 @@ function stat_fn( $filename ) {

 var_dump(unlink(' '));
 var_dump(unlink('|'));
+chdir(__DIR__); // Solaris cannot remove CWD
 rmdir($dir);

 echo "Done";
diff --git a/ext/standard/tests/file/007_variation1.phpt b/ext/standard/tests/file/007_variation1.phpt
index 09960a08f6d..11fef2967f7 100644
--- a/ext/standard/tests/file/007_variation1.phpt
+++ b/ext/standard/tests/file/007_variation1.phpt
@@ -39,7 +39,7 @@
 line of text
 li"

-Notice: fwrite(): Write of 37 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fwrite(): Write of 37 bytes failed with errno=9 Bad file %r(descriptor|number)%r in %s on line %d
 bool(false)
 bool(true)
 string(7) "Unknown"
diff --git a/ext/standard/tests/file/007_variation11.phpt b/ext/standard/tests/file/007_variation11.phpt
index 202837e1212..2672f3e661d 100644
--- a/ext/standard/tests/file/007_variation11.phpt
+++ b/ext/standard/tests/file/007_variation11.phpt
@@ -57,7 +57,7 @@
 int(37)
 int(37)

-Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file %r(descriptor|number)%r in %s on line %d
 bool(false)
 int(0)
 bool(true)
diff --git a/ext/standard/tests/file/007_variation13.phpt b/ext/standard/tests/file/007_variation13.phpt
index 0d28522e7b7..1bc80e7578a 100644
--- a/ext/standard/tests/file/007_variation13.phpt
+++ b/ext/standard/tests/file/007_variation13.phpt
@@ -47,7 +47,7 @@
 string(6) "stream"
 int(37)

-Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file %r(descriptor|number)%r in %s on line %d
 bool(false)
 int(0)
 bool(true)
diff --git a/ext/standard/tests/file/007_variation15.phpt b/ext/standard/tests/file/007_variation15.phpt
index 0b1efdcfb5f..54e89d95f37 100644
--- a/ext/standard/tests/file/007_variation15.phpt
+++ b/ext/standard/tests/file/007_variation15.phpt
@@ -49,7 +49,7 @@
 int(37)
 int(37)

-Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file %r(descriptor|number)%r in %s on line %d
 bool(false)
 int(0)
 bool(true)
diff --git a/ext/standard/tests/file/007_variation17.phpt b/ext/standard/tests/file/007_variation17.phpt
index 466f39eec1e..884ce2c855a 100644
--- a/ext/standard/tests/file/007_variation17.phpt
+++ b/ext/standard/tests/file/007_variation17.phpt
@@ -39,7 +39,7 @@
 line of text
 li"

-Notice: fwrite(): Write of 37 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fwrite(): Write of 37 bytes failed with errno=9 Bad file %r(descriptor|number)%r in %s on line %d
 bool(false)
 bool(true)
 string(7) "Unknown"
diff --git a/ext/standard/tests/file/007_variation19.phpt b/ext/standard/tests/file/007_variation19.phpt
index d40f188bbc4..7740ea3059c 100644
--- a/ext/standard/tests/file/007_variation19.phpt
+++ b/ext/standard/tests/file/007_variation19.phpt
@@ -52,7 +52,7 @@
 int(37)
 int(37)

-Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file %r(descriptor|number)%r in %s on line %d
 bool(false)
 int(0)
 bool(true)
diff --git a/ext/standard/tests/file/007_variation21.phpt b/ext/standard/tests/file/007_variation21.phpt
index 4506df61ff8..eb6b780dec7 100644
--- a/ext/standard/tests/file/007_variation21.phpt
+++ b/ext/standard/tests/file/007_variation21.phpt
@@ -42,7 +42,7 @@
 string(6) "stream"
 int(37)

-Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file %r(descriptor|number)%r in %s on line %d
 bool(false)
 int(0)
 bool(true)
diff --git a/ext/standard/tests/file/007_variation23.phpt b/ext/standard/tests/file/007_variation23.phpt
index 3d2fd40b375..f080596a2cd 100644
--- a/ext/standard/tests/file/007_variation23.phpt
+++ b/ext/standard/tests/file/007_variation23.phpt
@@ -40,7 +40,7 @@
 int(37)
 int(37)

-Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file %r(descriptor|number)%r in %s on line %d
 bool(false)
 int(0)
 bool(true)
diff --git a/ext/standard/tests/file/007_variation3.phpt b/ext/standard/tests/file/007_variation3.phpt
index 5b8ac4c7ae0..8bd0ac454fd 100644
--- a/ext/standard/tests/file/007_variation3.phpt
+++ b/ext/standard/tests/file/007_variation3.phpt
@@ -52,7 +52,7 @@
 int(37)
 int(37)

-Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file %r(descriptor|number)%r in %s on line %d
 bool(false)
 int(0)
 bool(true)
diff --git a/ext/standard/tests/file/007_variation5.phpt b/ext/standard/tests/file/007_variation5.phpt
index ce2243719fc..86e009ee211 100644
--- a/ext/standard/tests/file/007_variation5.phpt
+++ b/ext/standard/tests/file/007_variation5.phpt
@@ -42,7 +42,7 @@
 string(6) "stream"
 int(37)

-Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file %r(descriptor|number)%r in %s on line %d
 bool(false)
 int(0)
 bool(true)
diff --git a/ext/standard/tests/file/007_variation7.phpt b/ext/standard/tests/file/007_variation7.phpt
index 154454736e3..e25c1dd9083 100644
--- a/ext/standard/tests/file/007_variation7.phpt
+++ b/ext/standard/tests/file/007_variation7.phpt
@@ -40,7 +40,7 @@
 int(37)
 int(37)

-Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file %r(descriptor|number)%r in %s on line %d
 bool(false)
 int(0)
 bool(true)
diff --git a/ext/standard/tests/file/007_variation9.phpt b/ext/standard/tests/file/007_variation9.phpt
index 1cc1670df66..ec9b8c96308 100644
--- a/ext/standard/tests/file/007_variation9.phpt
+++ b/ext/standard/tests/file/007_variation9.phpt
@@ -39,7 +39,7 @@
 line of text
 li"

-Notice: fwrite(): Write of 37 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fwrite(): Write of 37 bytes failed with errno=9 Bad file %r(descriptor|number)%r in %s on line %d
 bool(false)
 bool(true)
 string(7) "Unknown"
diff --git a/ext/standard/tests/file/bug35781.phpt b/ext/standard/tests/file/bug35781.phpt
index c07900e9d70..5b65b7d6b7a 100644
--- a/ext/standard/tests/file/bug35781.phpt
+++ b/ext/standard/tests/file/bug35781.phpt
@@ -19,7 +19,7 @@
 echo "Done\n";
 ?>
 --EXPECTF--
-Notice: fpassthru(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fpassthru(): Read of 8192 bytes failed with errno=9 Bad file %r(descriptor|number)%r in %s on line %d
 string(15) "Guvf vf n grfg
 "
 Done
diff --git a/ext/standard/tests/file/bug65272.phpt b/ext/standard/tests/file/bug65272.phpt
index 24e50d15bee..0419a7023d6 100644
--- a/ext/standard/tests/file/bug65272.phpt
+++ b/ext/standard/tests/file/bug65272.phpt
@@ -1,5 +1,11 @@
 --TEST--
 Bug #65272: flock() correctly sets wouldblock out param in windows
+--SKIPIF--
+<?php
+if (PHP_OS_FAMILY === 'Solaris') {
+    die("skip: Solaris flock() uses fcntl semantics - per-process (not per-file-descriptor)");
+}
+?>
 --FILE--
 <?php

diff --git a/ext/standard/tests/file/fdatasync.phpt b/ext/standard/tests/file/fdatasync.phpt
index 235669a9943..e1fa4758345 100644
--- a/ext/standard/tests/file/fdatasync.phpt
+++ b/ext/standard/tests/file/fdatasync.phpt
@@ -34,7 +34,12 @@

 echo "\n*** Testing fdatasync(): attempting to sync stdin ***\n";
 $file_handle = fopen("php://stdin", "w");
-var_dump(fdatasync($file_handle));
+// On Solaris, fdatasync() on stdin returns true
+if (PHP_OS_FAMILY === 'Solaris') {
+  var_dump(!fdatasync($file_handle));
+} else {
+  var_dump(fdatasync($file_handle));
+}
 fclose($file_handle);

 echo "\n*** Testing fdatasync(): for non-file stream ***\n";
diff --git a/ext/standard/tests/file/fgetc_variation3.phpt b/ext/standard/tests/file/fgetc_variation3.phpt
index ba47e303f78..0f9b69bd302 100644
--- a/ext/standard/tests/file/fgetc_variation3.phpt
+++ b/ext/standard/tests/file/fgetc_variation3.phpt
@@ -55,7 +55,7 @@
 int(0)
 bool(false)

-Notice: fgetc(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fgetc(): Read of 8192 bytes failed with errno=9 Bad file %r(descriptor|number)%r in %s on line %d
 bool(false)
 int(0)
 bool(false)
@@ -64,7 +64,7 @@
 int(0)
 bool(false)

-Notice: fgetc(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fgetc(): Read of 8192 bytes failed with errno=9 Bad file %r(descriptor|number)%r in %s on line %d
 bool(false)
 int(0)
 bool(false)
@@ -73,7 +73,7 @@
 int(0)
 bool(false)

-Notice: fgetc(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fgetc(): Read of 8192 bytes failed with errno=9 Bad file %r(descriptor|number)%r in %s on line %d
 bool(false)
 int(0)
 bool(false)
@@ -82,7 +82,7 @@
 int(0)
 bool(false)

-Notice: fgetc(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fgetc(): Read of 8192 bytes failed with errno=9 Bad file %r(descriptor|number)%r in %s on line %d
 bool(false)
 int(0)
 bool(false)
@@ -91,7 +91,7 @@
 int(0)
 bool(false)

-Notice: fgetc(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fgetc(): Read of 8192 bytes failed with errno=9 Bad file %r(descriptor|number)%r in %s on line %d
 bool(false)
 int(0)
 bool(false)
@@ -100,7 +100,7 @@
 int(0)
 bool(false)

-Notice: fgetc(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fgetc(): Read of 8192 bytes failed with errno=9 Bad file %r(descriptor|number)%r in %s on line %d
 bool(false)
 int(0)
 bool(false)
@@ -109,7 +109,7 @@
 int(0)
 bool(false)

-Notice: fgetc(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fgetc(): Read of 8192 bytes failed with errno=9 Bad file %r(descriptor|number)%r in %s on line %d
 bool(false)
 int(0)
 bool(false)
@@ -118,7 +118,7 @@
 int(0)
 bool(false)

-Notice: fgetc(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fgetc(): Read of 8192 bytes failed with errno=9 Bad file %r(descriptor|number)%r in %s on line %d
 bool(false)
 int(0)
 bool(false)
@@ -127,7 +127,7 @@
 int(0)
 bool(false)

-Notice: fgetc(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fgetc(): Read of 8192 bytes failed with errno=9 Bad file %r(descriptor|number)%r in %s on line %d
 bool(false)
 int(0)
 bool(false)
diff --git a/ext/standard/tests/file/fgets_variation1.phpt b/ext/standard/tests/file/fgets_variation1.phpt
index 0c07c7a76ca..f0ff2fd7d58 100644
--- a/ext/standard/tests/file/fgets_variation1.phpt
+++ b/ext/standard/tests/file/fgets_variation1.phpt
@@ -51,7 +51,7 @@
 int(0)
 bool(false)

-Notice: fgets(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fgets(): Read of 8192 bytes failed with errno=9 Bad file %r(descriptor|number)%r in %s on line %d
 bool(false)
 int(0)
 bool(false)
@@ -60,7 +60,7 @@
 int(0)
 bool(false)

-Notice: fgets(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fgets(): Read of 8192 bytes failed with errno=9 Bad file %r(descriptor|number)%r in %s on line %d
 bool(false)
 int(0)
 bool(false)
@@ -69,7 +69,7 @@
 int(0)
 bool(false)

-Notice: fgets(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fgets(): Read of 8192 bytes failed with errno=9 Bad file %r(descriptor|number)%r in %s on line %d
 bool(false)
 int(0)
 bool(false)
@@ -78,7 +78,7 @@
 int(0)
 bool(false)

-Notice: fgets(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fgets(): Read of 8192 bytes failed with errno=9 Bad file %r(descriptor|number)%r in %s on line %d
 bool(false)
 int(0)
 bool(false)
@@ -87,7 +87,7 @@
 int(0)
 bool(false)

-Notice: fgets(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fgets(): Read of 8192 bytes failed with errno=9 Bad file %r(descriptor|number)%r in %s on line %d
 bool(false)
 int(0)
 bool(false)
@@ -96,7 +96,7 @@
 int(0)
 bool(false)

-Notice: fgets(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fgets(): Read of 8192 bytes failed with errno=9 Bad file %r(descriptor|number)%r in %s on line %d
 bool(false)
 int(0)
 bool(false)
@@ -105,7 +105,7 @@
 int(0)
 bool(false)

-Notice: fgets(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fgets(): Read of 8192 bytes failed with errno=9 Bad file %r(descriptor|number)%r in %s on line %d
 bool(false)
 int(0)
 bool(false)
@@ -114,7 +114,7 @@
 int(0)
 bool(false)

-Notice: fgets(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fgets(): Read of 8192 bytes failed with errno=9 Bad file %r(descriptor|number)%r in %s on line %d
 bool(false)
 int(0)
 bool(false)
@@ -123,7 +123,7 @@
 int(0)
 bool(false)

-Notice: fgets(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fgets(): Read of 8192 bytes failed with errno=9 Bad file %r(descriptor|number)%r in %s on line %d
 bool(false)
 int(0)
 bool(false)
diff --git a/ext/standard/tests/file/filetype_variation2.phpt b/ext/standard/tests/file/filetype_variation2.phpt
index 8ea1e16b22c..ca33417332b 100644
--- a/ext/standard/tests/file/filetype_variation2.phpt
+++ b/ext/standard/tests/file/filetype_variation2.phpt
@@ -13,8 +13,14 @@
 ?>
 --FILE--
 <?php
+$devnull = "/dev/null";
+// On Solaris, /dev/null is symlink
+if (is_link($devnull)) {
+    $devnull = readlink($devnull);
+    if ($devnull[0] != '/') $devnull = dirname("/dev/null") . '/' . $devnull;
+}
 echo "-- Checking for char --\n";
-print( filetype("/dev/null") )."\n";
+print(filetype($devnull)) . "\n";
 ?>
 --EXPECT--
 -- Checking for char --
diff --git a/ext/standard/tests/file/flock.phpt b/ext/standard/tests/file/flock.phpt
index a3c18045840..0e07114f9cd 100644
--- a/ext/standard/tests/file/flock.phpt
+++ b/ext/standard/tests/file/flock.phpt
@@ -14,7 +14,13 @@
     echo $e->getMessage(), "\n";
 }

-$fp = fopen($file, "w");
+/*
+ On Solaris, flock() is emulated via fcntl(). A shared lock (LOCK_SH) maps to
+ F_RDLCK, which requires the file descriptor to be open for reading. Using "w"
+ opens write-only and causes EBADF on Solaris. Open with "w+" so LOCK_SH works
+ portably across platforms.
+*/
+$fp = fopen($file, "w+");

 var_dump(flock($fp, LOCK_SH|LOCK_NB));
 var_dump(flock($fp, LOCK_UN));
diff --git a/ext/standard/tests/file/flock_basic.phpt b/ext/standard/tests/file/flock_basic.phpt
index 8b4ae30e0fd..4fd4ea1e931 100644
--- a/ext/standard/tests/file/flock_basic.phpt
+++ b/ext/standard/tests/file/flock_basic.phpt
@@ -11,7 +11,13 @@

 $lock_file = preg_replace("~\.phpt?$~", '', __FILE__);

-$file_handle = fopen($lock_file, "w");
+/*
+ On Solaris, flock() is emulated via fcntl(). A shared lock (LOCK_SH) maps to
+ F_RDLCK, which requires the file descriptor to be open for reading. Using "w"
+ opens write-only and causes EBADF on Solaris. Open with "w+" so LOCK_SH works
+ portably across platforms.
+*/
+$file_handle = fopen($lock_file, "w+");
 var_dump(flock($file_handle, LOCK_SH|LOCK_NB));
 var_dump(flock($file_handle, LOCK_UN));
 var_dump(flock($file_handle, LOCK_EX));
diff --git a/ext/standard/tests/file/flock_variation.phpt b/ext/standard/tests/file/flock_variation.phpt
index 1d73e90d254..1b17635db1c 100644
--- a/ext/standard/tests/file/flock_variation.phpt
+++ b/ext/standard/tests/file/flock_variation.phpt
@@ -6,7 +6,13 @@
     wouldblock values                                ***\n";

 $file = preg_replace("~\.phpt?$~", '', __FILE__);
-$fp = fopen($file, "w");
+/*
+ On Solaris, flock() is emulated via fcntl(). A shared lock (LOCK_SH) maps to
+ F_RDLCK, which requires the file descriptor to be open for reading. Using "w"
+ opens write-only and causes EBADF on Solaris. Open with "w+" so LOCK_SH works
+ portably across platforms.
+*/
+$fp = fopen($file, "w+");

 /* array of operations */
 $operations = array(
diff --git a/ext/standard/tests/file/fread_variation2.phpt b/ext/standard/tests/file/fread_variation2.phpt
index a16c97a745a..1fee493c4b6 100644
--- a/ext/standard/tests/file/fread_variation2.phpt
+++ b/ext/standard/tests/file/fread_variation2.phpt
@@ -104,7 +104,7 @@ function check_read($file_handle, $read_size, $expect_size) {
 int(0)
 bool(false)
 Reading 1024 bytes from file, expecting 0 bytes ...
-Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file %r(descriptor|number)%r in %s on line %d
 OK
 int(0)
 bool(false)
@@ -113,7 +113,7 @@ function check_read($file_handle, $read_size, $expect_size) {
 int(0)
 bool(false)
 Reading 1000 bytes from file, expecting 0 bytes ...
-Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file %r(descriptor|number)%r in %s on line %d
 OK
 int(0)
 bool(false)
@@ -123,7 +123,7 @@ function check_read($file_handle, $read_size, $expect_size) {
 int(0)
 bool(false)
 Reading 1024 bytes from file, expecting 0 bytes ...
-Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file %r(descriptor|number)%r in %s on line %d
 OK
 int(0)
 bool(false)
@@ -132,7 +132,7 @@ function check_read($file_handle, $read_size, $expect_size) {
 int(0)
 bool(false)
 Reading 1000 bytes from file, expecting 0 bytes ...
-Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file %r(descriptor|number)%r in %s on line %d
 OK
 int(0)
 bool(false)
@@ -142,7 +142,7 @@ function check_read($file_handle, $read_size, $expect_size) {
 int(0)
 bool(false)
 Reading 1024 bytes from file, expecting 0 bytes ...
-Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file %r(descriptor|number)%r in %s on line %d
 OK
 int(0)
 bool(false)
@@ -151,7 +151,7 @@ function check_read($file_handle, $read_size, $expect_size) {
 int(0)
 bool(false)
 Reading 1000 bytes from file, expecting 0 bytes ...
-Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file %r(descriptor|number)%r in %s on line %d
 OK
 int(0)
 bool(false)
@@ -161,7 +161,7 @@ function check_read($file_handle, $read_size, $expect_size) {
 int(0)
 bool(false)
 Reading 1024 bytes from file, expecting 0 bytes ...
-Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file %r(descriptor|number)%r in %s on line %d
 OK
 int(0)
 bool(false)
@@ -170,7 +170,7 @@ function check_read($file_handle, $read_size, $expect_size) {
 int(0)
 bool(false)
 Reading 1000 bytes from file, expecting 0 bytes ...
-Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file %r(descriptor|number)%r in %s on line %d
 OK
 int(0)
 bool(false)
@@ -180,7 +180,7 @@ function check_read($file_handle, $read_size, $expect_size) {
 int(0)
 bool(false)
 Reading 1024 bytes from file, expecting 0 bytes ...
-Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file %r(descriptor|number)%r in %s on line %d
 OK
 int(0)
 bool(false)
@@ -189,7 +189,7 @@ function check_read($file_handle, $read_size, $expect_size) {
 int(0)
 bool(false)
 Reading 1000 bytes from file, expecting 0 bytes ...
-Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file %r(descriptor|number)%r in %s on line %d
 OK
 int(0)
 bool(false)
@@ -199,7 +199,7 @@ function check_read($file_handle, $read_size, $expect_size) {
 int(0)
 bool(false)
 Reading 1024 bytes from file, expecting 0 bytes ...
-Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file %r(descriptor|number)%r in %s on line %d
 OK
 int(0)
 bool(false)
@@ -208,7 +208,7 @@ function check_read($file_handle, $read_size, $expect_size) {
 int(0)
 bool(false)
 Reading 1000 bytes from file, expecting 0 bytes ...
-Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file %r(descriptor|number)%r in %s on line %d
 OK
 int(0)
 bool(false)
@@ -218,7 +218,7 @@ function check_read($file_handle, $read_size, $expect_size) {
 int(0)
 bool(false)
 Reading 1024 bytes from file, expecting 0 bytes ...
-Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file %r(descriptor|number)%r in %s on line %d
 OK
 int(0)
 bool(false)
@@ -227,7 +227,7 @@ function check_read($file_handle, $read_size, $expect_size) {
 int(0)
 bool(false)
 Reading 1000 bytes from file, expecting 0 bytes ...
-Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file %r(descriptor|number)%r in %s on line %d
 OK
 int(0)
 bool(false)
@@ -237,7 +237,7 @@ function check_read($file_handle, $read_size, $expect_size) {
 int(0)
 bool(false)
 Reading 1024 bytes from file, expecting 0 bytes ...
-Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file %r(descriptor|number)%r in %s on line %d
 OK
 int(0)
 bool(false)
@@ -246,7 +246,7 @@ function check_read($file_handle, $read_size, $expect_size) {
 int(0)
 bool(false)
 Reading 1000 bytes from file, expecting 0 bytes ...
-Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file %r(descriptor|number)%r in %s on line %d
 OK
 int(0)
 bool(false)
@@ -256,7 +256,7 @@ function check_read($file_handle, $read_size, $expect_size) {
 int(0)
 bool(false)
 Reading 1024 bytes from file, expecting 0 bytes ...
-Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file %r(descriptor|number)%r in %s on line %d
 OK
 int(0)
 bool(false)
@@ -265,7 +265,7 @@ function check_read($file_handle, $read_size, $expect_size) {
 int(0)
 bool(false)
 Reading 1000 bytes from file, expecting 0 bytes ...
-Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file %r(descriptor|number)%r in %s on line %d
 OK
 int(0)
 bool(false)
@@ -277,7 +277,7 @@ function check_read($file_handle, $read_size, $expect_size) {
 int(0)
 bool(false)
 Reading 1024 bytes from file, expecting 0 bytes ...
-Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file %r(descriptor|number)%r in %s on line %d
 OK
 int(0)
 bool(false)
@@ -286,7 +286,7 @@ function check_read($file_handle, $read_size, $expect_size) {
 int(0)
 bool(false)
 Reading 1000 bytes from file, expecting 0 bytes ...
-Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file %r(descriptor|number)%r in %s on line %d
 OK
 int(0)
 bool(false)
@@ -296,7 +296,7 @@ function check_read($file_handle, $read_size, $expect_size) {
 int(0)
 bool(false)
 Reading 1024 bytes from file, expecting 0 bytes ...
-Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file %r(descriptor|number)%r in %s on line %d
 OK
 int(0)
 bool(false)
@@ -305,7 +305,7 @@ function check_read($file_handle, $read_size, $expect_size) {
 int(0)
 bool(false)
 Reading 1000 bytes from file, expecting 0 bytes ...
-Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file %r(descriptor|number)%r in %s on line %d
 OK
 int(0)
 bool(false)
@@ -315,7 +315,7 @@ function check_read($file_handle, $read_size, $expect_size) {
 int(0)
 bool(false)
 Reading 1024 bytes from file, expecting 0 bytes ...
-Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file %r(descriptor|number)%r in %s on line %d
 OK
 int(0)
 bool(false)
@@ -324,7 +324,7 @@ function check_read($file_handle, $read_size, $expect_size) {
 int(0)
 bool(false)
 Reading 1000 bytes from file, expecting 0 bytes ...
-Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file %r(descriptor|number)%r in %s on line %d
 OK
 int(0)
 bool(false)
@@ -334,7 +334,7 @@ function check_read($file_handle, $read_size, $expect_size) {
 int(0)
 bool(false)
 Reading 1024 bytes from file, expecting 0 bytes ...
-Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file %r(descriptor|number)%r in %s on line %d
 OK
 int(0)
 bool(false)
@@ -343,7 +343,7 @@ function check_read($file_handle, $read_size, $expect_size) {
 int(0)
 bool(false)
 Reading 1000 bytes from file, expecting 0 bytes ...
-Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file %r(descriptor|number)%r in %s on line %d
 OK
 int(0)
 bool(false)
@@ -353,7 +353,7 @@ function check_read($file_handle, $read_size, $expect_size) {
 int(0)
 bool(false)
 Reading 1024 bytes from file, expecting 0 bytes ...
-Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file %r(descriptor|number)%r in %s on line %d
 OK
 int(0)
 bool(false)
@@ -362,7 +362,7 @@ function check_read($file_handle, $read_size, $expect_size) {
 int(0)
 bool(false)
 Reading 1000 bytes from file, expecting 0 bytes ...
-Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file %r(descriptor|number)%r in %s on line %d
 OK
 int(0)
 bool(false)
@@ -372,7 +372,7 @@ function check_read($file_handle, $read_size, $expect_size) {
 int(0)
 bool(false)
 Reading 1024 bytes from file, expecting 0 bytes ...
-Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file %r(descriptor|number)%r in %s on line %d
 OK
 int(0)
 bool(false)
@@ -381,7 +381,7 @@ function check_read($file_handle, $read_size, $expect_size) {
 int(0)
 bool(false)
 Reading 1000 bytes from file, expecting 0 bytes ...
-Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file %r(descriptor|number)%r in %s on line %d
 OK
 int(0)
 bool(false)
@@ -391,7 +391,7 @@ function check_read($file_handle, $read_size, $expect_size) {
 int(0)
 bool(false)
 Reading 1024 bytes from file, expecting 0 bytes ...
-Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file %r(descriptor|number)%r in %s on line %d
 OK
 int(0)
 bool(false)
@@ -400,7 +400,7 @@ function check_read($file_handle, $read_size, $expect_size) {
 int(0)
 bool(false)
 Reading 1000 bytes from file, expecting 0 bytes ...
-Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file %r(descriptor|number)%r in %s on line %d
 OK
 int(0)
 bool(false)
@@ -410,7 +410,7 @@ function check_read($file_handle, $read_size, $expect_size) {
 int(0)
 bool(false)
 Reading 1024 bytes from file, expecting 0 bytes ...
-Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file %r(descriptor|number)%r in %s on line %d
 OK
 int(0)
 bool(false)
@@ -419,7 +419,7 @@ function check_read($file_handle, $read_size, $expect_size) {
 int(0)
 bool(false)
 Reading 1000 bytes from file, expecting 0 bytes ...
-Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file %r(descriptor|number)%r in %s on line %d
 OK
 int(0)
 bool(false)
@@ -429,7 +429,7 @@ function check_read($file_handle, $read_size, $expect_size) {
 int(0)
 bool(false)
 Reading 1024 bytes from file, expecting 0 bytes ...
-Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file %r(descriptor|number)%r in %s on line %d
 OK
 int(0)
 bool(false)
@@ -438,7 +438,7 @@ function check_read($file_handle, $read_size, $expect_size) {
 int(0)
 bool(false)
 Reading 1000 bytes from file, expecting 0 bytes ...
-Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file %r(descriptor|number)%r in %s on line %d
 OK
 int(0)
 bool(false)
@@ -450,7 +450,7 @@ function check_read($file_handle, $read_size, $expect_size) {
 int(0)
 bool(false)
 Reading 1024 bytes from file, expecting 0 bytes ...
-Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file %r(descriptor|number)%r in %s on line %d
 OK
 int(0)
 bool(false)
@@ -459,7 +459,7 @@ function check_read($file_handle, $read_size, $expect_size) {
 int(0)
 bool(false)
 Reading 1000 bytes from file, expecting 0 bytes ...
-Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file %r(descriptor|number)%r in %s on line %d
 OK
 int(0)
 bool(false)
@@ -469,7 +469,7 @@ function check_read($file_handle, $read_size, $expect_size) {
 int(0)
 bool(false)
 Reading 1024 bytes from file, expecting 0 bytes ...
-Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file %r(descriptor|number)%r in %s on line %d
 OK
 int(0)
 bool(false)
@@ -478,7 +478,7 @@ function check_read($file_handle, $read_size, $expect_size) {
 int(0)
 bool(false)
 Reading 1000 bytes from file, expecting 0 bytes ...
-Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file %r(descriptor|number)%r in %s on line %d
 OK
 int(0)
 bool(false)
@@ -488,7 +488,7 @@ function check_read($file_handle, $read_size, $expect_size) {
 int(0)
 bool(false)
 Reading 1024 bytes from file, expecting 0 bytes ...
-Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file %r(descriptor|number)%r in %s on line %d
 OK
 int(0)
 bool(false)
@@ -497,7 +497,7 @@ function check_read($file_handle, $read_size, $expect_size) {
 int(0)
 bool(false)
 Reading 1000 bytes from file, expecting 0 bytes ...
-Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file %r(descriptor|number)%r in %s on line %d
 OK
 int(0)
 bool(false)
@@ -507,7 +507,7 @@ function check_read($file_handle, $read_size, $expect_size) {
 int(0)
 bool(false)
 Reading 1024 bytes from file, expecting 0 bytes ...
-Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file %r(descriptor|number)%r in %s on line %d
 OK
 int(0)
 bool(false)
@@ -516,7 +516,7 @@ function check_read($file_handle, $read_size, $expect_size) {
 int(0)
 bool(false)
 Reading 1000 bytes from file, expecting 0 bytes ...
-Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file %r(descriptor|number)%r in %s on line %d
 OK
 int(0)
 bool(false)
@@ -526,7 +526,7 @@ function check_read($file_handle, $read_size, $expect_size) {
 int(0)
 bool(false)
 Reading 1024 bytes from file, expecting 0 bytes ...
-Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file %r(descriptor|number)%r in %s on line %d
 OK
 int(0)
 bool(false)
@@ -535,7 +535,7 @@ function check_read($file_handle, $read_size, $expect_size) {
 int(0)
 bool(false)
 Reading 1000 bytes from file, expecting 0 bytes ...
-Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file %r(descriptor|number)%r in %s on line %d
 OK
 int(0)
 bool(false)
@@ -545,7 +545,7 @@ function check_read($file_handle, $read_size, $expect_size) {
 int(0)
 bool(false)
 Reading 1024 bytes from file, expecting 0 bytes ...
-Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file %r(descriptor|number)%r in %s on line %d
 OK
 int(0)
 bool(false)
@@ -554,7 +554,7 @@ function check_read($file_handle, $read_size, $expect_size) {
 int(0)
 bool(false)
 Reading 1000 bytes from file, expecting 0 bytes ...
-Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file %r(descriptor|number)%r in %s on line %d
 OK
 int(0)
 bool(false)
@@ -564,7 +564,7 @@ function check_read($file_handle, $read_size, $expect_size) {
 int(0)
 bool(false)
 Reading 1024 bytes from file, expecting 0 bytes ...
-Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file %r(descriptor|number)%r in %s on line %d
 OK
 int(0)
 bool(false)
@@ -573,7 +573,7 @@ function check_read($file_handle, $read_size, $expect_size) {
 int(0)
 bool(false)
 Reading 1000 bytes from file, expecting 0 bytes ...
-Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file %r(descriptor|number)%r in %s on line %d
 OK
 int(0)
 bool(false)
@@ -583,7 +583,7 @@ function check_read($file_handle, $read_size, $expect_size) {
 int(0)
 bool(false)
 Reading 1024 bytes from file, expecting 0 bytes ...
-Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file %r(descriptor|number)%r in %s on line %d
 OK
 int(0)
 bool(false)
@@ -592,7 +592,7 @@ function check_read($file_handle, $read_size, $expect_size) {
 int(0)
 bool(false)
 Reading 1000 bytes from file, expecting 0 bytes ...
-Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file %r(descriptor|number)%r in %s on line %d
 OK
 int(0)
 bool(false)
@@ -602,7 +602,7 @@ function check_read($file_handle, $read_size, $expect_size) {
 int(0)
 bool(false)
 Reading 1024 bytes from file, expecting 0 bytes ...
-Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file %r(descriptor|number)%r in %s on line %d
 OK
 int(0)
 bool(false)
@@ -611,7 +611,7 @@ function check_read($file_handle, $read_size, $expect_size) {
 int(0)
 bool(false)
 Reading 1000 bytes from file, expecting 0 bytes ...
-Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file %r(descriptor|number)%r in %s on line %d
 OK
 int(0)
 bool(false)
@@ -623,7 +623,7 @@ function check_read($file_handle, $read_size, $expect_size) {
 int(0)
 bool(false)
 Reading 1024 bytes from file, expecting 0 bytes ...
-Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file %r(descriptor|number)%r in %s on line %d
 OK
 int(0)
 bool(false)
@@ -632,7 +632,7 @@ function check_read($file_handle, $read_size, $expect_size) {
 int(0)
 bool(false)
 Reading 1000 bytes from file, expecting 0 bytes ...
-Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file %r(descriptor|number)%r in %s on line %d
 OK
 int(0)
 bool(false)
@@ -642,7 +642,7 @@ function check_read($file_handle, $read_size, $expect_size) {
 int(0)
 bool(false)
 Reading 1024 bytes from file, expecting 0 bytes ...
-Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file %r(descriptor|number)%r in %s on line %d
 OK
 int(0)
 bool(false)
@@ -651,7 +651,7 @@ function check_read($file_handle, $read_size, $expect_size) {
 int(0)
 bool(false)
 Reading 1000 bytes from file, expecting 0 bytes ...
-Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file %r(descriptor|number)%r in %s on line %d
 OK
 int(0)
 bool(false)
@@ -661,7 +661,7 @@ function check_read($file_handle, $read_size, $expect_size) {
 int(0)
 bool(false)
 Reading 1024 bytes from file, expecting 0 bytes ...
-Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file %r(descriptor|number)%r in %s on line %d
 OK
 int(0)
 bool(false)
@@ -670,7 +670,7 @@ function check_read($file_handle, $read_size, $expect_size) {
 int(0)
 bool(false)
 Reading 1000 bytes from file, expecting 0 bytes ...
-Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file %r(descriptor|number)%r in %s on line %d
 OK
 int(0)
 bool(false)
@@ -680,7 +680,7 @@ function check_read($file_handle, $read_size, $expect_size) {
 int(0)
 bool(false)
 Reading 1024 bytes from file, expecting 0 bytes ...
-Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file %r(descriptor|number)%r in %s on line %d
 OK
 int(0)
 bool(false)
@@ -689,7 +689,7 @@ function check_read($file_handle, $read_size, $expect_size) {
 int(0)
 bool(false)
 Reading 1000 bytes from file, expecting 0 bytes ...
-Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file %r(descriptor|number)%r in %s on line %d
 OK
 int(0)
 bool(false)
@@ -699,7 +699,7 @@ function check_read($file_handle, $read_size, $expect_size) {
 int(0)
 bool(false)
 Reading 1024 bytes from file, expecting 0 bytes ...
-Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file %r(descriptor|number)%r in %s on line %d
 OK
 int(0)
 bool(false)
@@ -708,7 +708,7 @@ function check_read($file_handle, $read_size, $expect_size) {
 int(0)
 bool(false)
 Reading 1000 bytes from file, expecting 0 bytes ...
-Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file %r(descriptor|number)%r in %s on line %d
 OK
 int(0)
 bool(false)
@@ -718,7 +718,7 @@ function check_read($file_handle, $read_size, $expect_size) {
 int(0)
 bool(false)
 Reading 1024 bytes from file, expecting 0 bytes ...
-Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file %r(descriptor|number)%r in %s on line %d
 OK
 int(0)
 bool(false)
@@ -727,7 +727,7 @@ function check_read($file_handle, $read_size, $expect_size) {
 int(0)
 bool(false)
 Reading 1000 bytes from file, expecting 0 bytes ...
-Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file %r(descriptor|number)%r in %s on line %d
 OK
 int(0)
 bool(false)
@@ -737,7 +737,7 @@ function check_read($file_handle, $read_size, $expect_size) {
 int(0)
 bool(false)
 Reading 1024 bytes from file, expecting 0 bytes ...
-Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file %r(descriptor|number)%r in %s on line %d
 OK
 int(0)
 bool(false)
@@ -746,7 +746,7 @@ function check_read($file_handle, $read_size, $expect_size) {
 int(0)
 bool(false)
 Reading 1000 bytes from file, expecting 0 bytes ...
-Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file %r(descriptor|number)%r in %s on line %d
 OK
 int(0)
 bool(false)
@@ -756,7 +756,7 @@ function check_read($file_handle, $read_size, $expect_size) {
 int(0)
 bool(false)
 Reading 1024 bytes from file, expecting 0 bytes ...
-Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file %r(descriptor|number)%r in %s on line %d
 OK
 int(0)
 bool(false)
@@ -765,7 +765,7 @@ function check_read($file_handle, $read_size, $expect_size) {
 int(0)
 bool(false)
 Reading 1000 bytes from file, expecting 0 bytes ...
-Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file %r(descriptor|number)%r in %s on line %d
 OK
 int(0)
 bool(false)
@@ -775,7 +775,7 @@ function check_read($file_handle, $read_size, $expect_size) {
 int(0)
 bool(false)
 Reading 1024 bytes from file, expecting 0 bytes ...
-Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file %r(descriptor|number)%r in %s on line %d
 OK
 int(0)
 bool(false)
@@ -784,7 +784,7 @@ function check_read($file_handle, $read_size, $expect_size) {
 int(0)
 bool(false)
 Reading 1000 bytes from file, expecting 0 bytes ...
-Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file %r(descriptor|number)%r in %s on line %d
 OK
 int(0)
 bool(false)
diff --git a/ext/standard/tests/file/fread_variation4.phpt b/ext/standard/tests/file/fread_variation4.phpt
index 97c6c39f9c8..1ed43464f88 100644
--- a/ext/standard/tests/file/fread_variation4.phpt
+++ b/ext/standard/tests/file/fread_variation4.phpt
@@ -102,7 +102,7 @@ function check_read($file_handle, $read_size, $expect_size) {
 int(0)
 bool(false)
 Reading 1030 bytes from file, expecting 0 bytes ...
-Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file %r(descriptor|number)%r in %s on line %d
 OK
 int(0)
 bool(false)
@@ -110,7 +110,7 @@ function check_read($file_handle, $read_size, $expect_size) {
 int(1024)
 bool(false)
 Reading 10 bytes from file, expecting 0 bytes ...
-Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file %r(descriptor|number)%r in %s on line %d
 OK
 int(1024)
 bool(false)
@@ -119,7 +119,7 @@ function check_read($file_handle, $read_size, $expect_size) {
 int(0)
 bool(false)
 Reading 1030 bytes from file, expecting 0 bytes ...
-Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file %r(descriptor|number)%r in %s on line %d
 OK
 int(0)
 bool(false)
@@ -127,7 +127,7 @@ function check_read($file_handle, $read_size, $expect_size) {
 int(1024)
 bool(false)
 Reading 10 bytes from file, expecting 0 bytes ...
-Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file %r(descriptor|number)%r in %s on line %d
 OK
 int(1024)
 bool(false)
@@ -136,7 +136,7 @@ function check_read($file_handle, $read_size, $expect_size) {
 int(0)
 bool(false)
 Reading 1030 bytes from file, expecting 0 bytes ...
-Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file %r(descriptor|number)%r in %s on line %d
 OK
 int(0)
 bool(false)
@@ -144,7 +144,7 @@ function check_read($file_handle, $read_size, $expect_size) {
 int(1024)
 bool(false)
 Reading 10 bytes from file, expecting 0 bytes ...
-Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file %r(descriptor|number)%r in %s on line %d
 OK
 int(1024)
 bool(false)
@@ -153,7 +153,7 @@ function check_read($file_handle, $read_size, $expect_size) {
 int(0)
 bool(false)
 Reading 1030 bytes from file, expecting 0 bytes ...
-Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file %r(descriptor|number)%r in %s on line %d
 OK
 int(0)
 bool(false)
@@ -161,7 +161,7 @@ function check_read($file_handle, $read_size, $expect_size) {
 int(1024)
 bool(false)
 Reading 10 bytes from file, expecting 0 bytes ...
-Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file %r(descriptor|number)%r in %s on line %d
 OK
 int(1024)
 bool(false)
@@ -170,7 +170,7 @@ function check_read($file_handle, $read_size, $expect_size) {
 int(0)
 bool(false)
 Reading 1030 bytes from file, expecting 0 bytes ...
-Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file %r(descriptor|number)%r in %s on line %d
 OK
 int(0)
 bool(false)
@@ -178,7 +178,7 @@ function check_read($file_handle, $read_size, $expect_size) {
 int(1024)
 bool(false)
 Reading 10 bytes from file, expecting 0 bytes ...
-Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file %r(descriptor|number)%r in %s on line %d
 OK
 int(1024)
 bool(false)
@@ -187,7 +187,7 @@ function check_read($file_handle, $read_size, $expect_size) {
 int(0)
 bool(false)
 Reading 1030 bytes from file, expecting 0 bytes ...
-Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file %r(descriptor|number)%r in %s on line %d
 OK
 int(0)
 bool(false)
@@ -195,7 +195,7 @@ function check_read($file_handle, $read_size, $expect_size) {
 int(1024)
 bool(false)
 Reading 10 bytes from file, expecting 0 bytes ...
-Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file %r(descriptor|number)%r in %s on line %d
 OK
 int(1024)
 bool(false)
@@ -204,7 +204,7 @@ function check_read($file_handle, $read_size, $expect_size) {
 int(0)
 bool(false)
 Reading 1030 bytes from file, expecting 0 bytes ...
-Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file %r(descriptor|number)%r in %s on line %d
 OK
 int(0)
 bool(false)
@@ -212,7 +212,7 @@ function check_read($file_handle, $read_size, $expect_size) {
 int(1024)
 bool(false)
 Reading 10 bytes from file, expecting 0 bytes ...
-Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file %r(descriptor|number)%r in %s on line %d
 OK
 int(1024)
 bool(false)
@@ -221,7 +221,7 @@ function check_read($file_handle, $read_size, $expect_size) {
 int(0)
 bool(false)
 Reading 1030 bytes from file, expecting 0 bytes ...
-Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file %r(descriptor|number)%r in %s on line %d
 OK
 int(0)
 bool(false)
@@ -229,7 +229,7 @@ function check_read($file_handle, $read_size, $expect_size) {
 int(1024)
 bool(false)
 Reading 10 bytes from file, expecting 0 bytes ...
-Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file %r(descriptor|number)%r in %s on line %d
 OK
 int(1024)
 bool(false)
@@ -238,7 +238,7 @@ function check_read($file_handle, $read_size, $expect_size) {
 int(0)
 bool(false)
 Reading 1030 bytes from file, expecting 0 bytes ...
-Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file %r(descriptor|number)%r in %s on line %d
 OK
 int(0)
 bool(false)
@@ -246,7 +246,7 @@ function check_read($file_handle, $read_size, $expect_size) {
 int(1024)
 bool(false)
 Reading 10 bytes from file, expecting 0 bytes ...
-Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file %r(descriptor|number)%r in %s on line %d
 OK
 int(1024)
 bool(false)
@@ -257,7 +257,7 @@ function check_read($file_handle, $read_size, $expect_size) {
 int(0)
 bool(false)
 Reading 1030 bytes from file, expecting 0 bytes ...
-Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file %r(descriptor|number)%r in %s on line %d
 OK
 int(0)
 bool(false)
@@ -265,7 +265,7 @@ function check_read($file_handle, $read_size, $expect_size) {
 int(1024)
 bool(false)
 Reading 10 bytes from file, expecting 0 bytes ...
-Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file %r(descriptor|number)%r in %s on line %d
 OK
 int(1024)
 bool(false)
@@ -274,7 +274,7 @@ function check_read($file_handle, $read_size, $expect_size) {
 int(0)
 bool(false)
 Reading 1030 bytes from file, expecting 0 bytes ...
-Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file %r(descriptor|number)%r in %s on line %d
 OK
 int(0)
 bool(false)
@@ -282,7 +282,7 @@ function check_read($file_handle, $read_size, $expect_size) {
 int(1024)
 bool(false)
 Reading 10 bytes from file, expecting 0 bytes ...
-Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file %r(descriptor|number)%r in %s on line %d
 OK
 int(1024)
 bool(false)
@@ -291,7 +291,7 @@ function check_read($file_handle, $read_size, $expect_size) {
 int(0)
 bool(false)
 Reading 1030 bytes from file, expecting 0 bytes ...
-Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file %r(descriptor|number)%r in %s on line %d
 OK
 int(0)
 bool(false)
@@ -299,7 +299,7 @@ function check_read($file_handle, $read_size, $expect_size) {
 int(1024)
 bool(false)
 Reading 10 bytes from file, expecting 0 bytes ...
-Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file %r(descriptor|number)%r in %s on line %d
 OK
 int(1024)
 bool(false)
@@ -308,7 +308,7 @@ function check_read($file_handle, $read_size, $expect_size) {
 int(0)
 bool(false)
 Reading 1030 bytes from file, expecting 0 bytes ...
-Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file %r(descriptor|number)%r in %s on line %d
 OK
 int(0)
 bool(false)
@@ -316,7 +316,7 @@ function check_read($file_handle, $read_size, $expect_size) {
 int(1024)
 bool(false)
 Reading 10 bytes from file, expecting 0 bytes ...
-Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file %r(descriptor|number)%r in %s on line %d
 OK
 int(1024)
 bool(false)
@@ -325,7 +325,7 @@ function check_read($file_handle, $read_size, $expect_size) {
 int(0)
 bool(false)
 Reading 1030 bytes from file, expecting 0 bytes ...
-Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file %r(descriptor|number)%r in %s on line %d
 OK
 int(0)
 bool(false)
@@ -333,7 +333,7 @@ function check_read($file_handle, $read_size, $expect_size) {
 int(1024)
 bool(false)
 Reading 10 bytes from file, expecting 0 bytes ...
-Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file %r(descriptor|number)%r in %s on line %d
 OK
 int(1024)
 bool(false)
@@ -342,7 +342,7 @@ function check_read($file_handle, $read_size, $expect_size) {
 int(0)
 bool(false)
 Reading 1030 bytes from file, expecting 0 bytes ...
-Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file %r(descriptor|number)%r in %s on line %d
 OK
 int(0)
 bool(false)
@@ -350,7 +350,7 @@ function check_read($file_handle, $read_size, $expect_size) {
 int(1024)
 bool(false)
 Reading 10 bytes from file, expecting 0 bytes ...
-Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file %r(descriptor|number)%r in %s on line %d
 OK
 int(1024)
 bool(false)
@@ -359,7 +359,7 @@ function check_read($file_handle, $read_size, $expect_size) {
 int(0)
 bool(false)
 Reading 1030 bytes from file, expecting 0 bytes ...
-Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file %r(descriptor|number)%r in %s on line %d
 OK
 int(0)
 bool(false)
@@ -367,7 +367,7 @@ function check_read($file_handle, $read_size, $expect_size) {
 int(1024)
 bool(false)
 Reading 10 bytes from file, expecting 0 bytes ...
-Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file %r(descriptor|number)%r in %s on line %d
 OK
 int(1024)
 bool(false)
@@ -376,7 +376,7 @@ function check_read($file_handle, $read_size, $expect_size) {
 int(0)
 bool(false)
 Reading 1030 bytes from file, expecting 0 bytes ...
-Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file %r(descriptor|number)%r in %s on line %d
 OK
 int(0)
 bool(false)
@@ -384,7 +384,7 @@ function check_read($file_handle, $read_size, $expect_size) {
 int(1024)
 bool(false)
 Reading 10 bytes from file, expecting 0 bytes ...
-Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file %r(descriptor|number)%r in %s on line %d
 OK
 int(1024)
 bool(false)
@@ -393,7 +393,7 @@ function check_read($file_handle, $read_size, $expect_size) {
 int(0)
 bool(false)
 Reading 1030 bytes from file, expecting 0 bytes ...
-Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file %r(descriptor|number)%r in %s on line %d
 OK
 int(0)
 bool(false)
@@ -401,7 +401,7 @@ function check_read($file_handle, $read_size, $expect_size) {
 int(1024)
 bool(false)
 Reading 10 bytes from file, expecting 0 bytes ...
-Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file %r(descriptor|number)%r in %s on line %d
 OK
 int(1024)
 bool(false)
@@ -412,7 +412,7 @@ function check_read($file_handle, $read_size, $expect_size) {
 int(0)
 bool(false)
 Reading 1030 bytes from file, expecting 0 bytes ...
-Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file %r(descriptor|number)%r in %s on line %d
 OK
 int(0)
 bool(false)
@@ -420,7 +420,7 @@ function check_read($file_handle, $read_size, $expect_size) {
 int(1024)
 bool(false)
 Reading 10 bytes from file, expecting 0 bytes ...
-Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file %r(descriptor|number)%r in %s on line %d
 OK
 int(1024)
 bool(false)
@@ -429,7 +429,7 @@ function check_read($file_handle, $read_size, $expect_size) {
 int(0)
 bool(false)
 Reading 1030 bytes from file, expecting 0 bytes ...
-Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file %r(descriptor|number)%r in %s on line %d
 OK
 int(0)
 bool(false)
@@ -437,7 +437,7 @@ function check_read($file_handle, $read_size, $expect_size) {
 int(1024)
 bool(false)
 Reading 10 bytes from file, expecting 0 bytes ...
-Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file %r(descriptor|number)%r in %s on line %d
 OK
 int(1024)
 bool(false)
@@ -446,7 +446,7 @@ function check_read($file_handle, $read_size, $expect_size) {
 int(0)
 bool(false)
 Reading 1030 bytes from file, expecting 0 bytes ...
-Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file %r(descriptor|number)%r in %s on line %d
 OK
 int(0)
 bool(false)
@@ -454,7 +454,7 @@ function check_read($file_handle, $read_size, $expect_size) {
 int(1024)
 bool(false)
 Reading 10 bytes from file, expecting 0 bytes ...
-Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file %r(descriptor|number)%r in %s on line %d
 OK
 int(1024)
 bool(false)
@@ -463,7 +463,7 @@ function check_read($file_handle, $read_size, $expect_size) {
 int(0)
 bool(false)
 Reading 1030 bytes from file, expecting 0 bytes ...
-Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file %r(descriptor|number)%r in %s on line %d
 OK
 int(0)
 bool(false)
@@ -471,7 +471,7 @@ function check_read($file_handle, $read_size, $expect_size) {
 int(1024)
 bool(false)
 Reading 10 bytes from file, expecting 0 bytes ...
-Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file %r(descriptor|number)%r in %s on line %d
 OK
 int(1024)
 bool(false)
@@ -480,7 +480,7 @@ function check_read($file_handle, $read_size, $expect_size) {
 int(0)
 bool(false)
 Reading 1030 bytes from file, expecting 0 bytes ...
-Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file %r(descriptor|number)%r in %s on line %d
 OK
 int(0)
 bool(false)
@@ -488,7 +488,7 @@ function check_read($file_handle, $read_size, $expect_size) {
 int(1024)
 bool(false)
 Reading 10 bytes from file, expecting 0 bytes ...
-Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file %r(descriptor|number)%r in %s on line %d
 OK
 int(1024)
 bool(false)
@@ -497,7 +497,7 @@ function check_read($file_handle, $read_size, $expect_size) {
 int(0)
 bool(false)
 Reading 1030 bytes from file, expecting 0 bytes ...
-Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file %r(descriptor|number)%r in %s on line %d
 OK
 int(0)
 bool(false)
@@ -505,7 +505,7 @@ function check_read($file_handle, $read_size, $expect_size) {
 int(%r1024|1137%r)
 bool(false)
 Reading 10 bytes from file, expecting 0 bytes ...
-Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file %r(descriptor|number)%r in %s on line %d
 OK
 int(%r1024|1137%r)
 bool(false)
@@ -514,7 +514,7 @@ function check_read($file_handle, $read_size, $expect_size) {
 int(0)
 bool(false)
 Reading 1030 bytes from file, expecting 0 bytes ...
-Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file %r(descriptor|number)%r in %s on line %d
 OK
 int(0)
 bool(false)
@@ -522,7 +522,7 @@ function check_read($file_handle, $read_size, $expect_size) {
 int(1024)
 bool(false)
 Reading 10 bytes from file, expecting 0 bytes ...
-Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file %r(descriptor|number)%r in %s on line %d
 OK
 int(1024)
 bool(false)
@@ -531,7 +531,7 @@ function check_read($file_handle, $read_size, $expect_size) {
 int(0)
 bool(false)
 Reading 1030 bytes from file, expecting 0 bytes ...
-Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file %r(descriptor|number)%r in %s on line %d
 OK
 int(0)
 bool(false)
@@ -539,7 +539,7 @@ function check_read($file_handle, $read_size, $expect_size) {
 int(1024)
 bool(false)
 Reading 10 bytes from file, expecting 0 bytes ...
-Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file %r(descriptor|number)%r in %s on line %d
 OK
 int(1024)
 bool(false)
@@ -548,7 +548,7 @@ function check_read($file_handle, $read_size, $expect_size) {
 int(0)
 bool(false)
 Reading 1030 bytes from file, expecting 0 bytes ...
-Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file %r(descriptor|number)%r in %s on line %d
 OK
 int(0)
 bool(false)
@@ -556,7 +556,7 @@ function check_read($file_handle, $read_size, $expect_size) {
 int(%r1024|1137%r)
 bool(false)
 Reading 10 bytes from file, expecting 0 bytes ...
-Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file %r(descriptor|number)%r in %s on line %d
 OK
 int(%r1024|1137%r)
 bool(false)
diff --git a/ext/standard/tests/file/fscanf_variation51.phpt b/ext/standard/tests/file/fscanf_variation51.phpt
index fad61327482..97e56c1bab8 100644
--- a/ext/standard/tests/file/fscanf_variation51.phpt
+++ b/ext/standard/tests/file/fscanf_variation51.phpt
@@ -65,209 +65,209 @@

 -- iteration 1 --

-Notice: fscanf(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fscanf(): Read of 8192 bytes failed with errno=9 Bad file %r(descriptor|number)%r in %s on line %d
 bool(false)

-Notice: fscanf(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fscanf(): Read of 8192 bytes failed with errno=9 Bad file %r(descriptor|number)%r in %s on line %d
 bool(false)

-Notice: fscanf(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fscanf(): Read of 8192 bytes failed with errno=9 Bad file %r(descriptor|number)%r in %s on line %d
 bool(false)

-Notice: fscanf(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fscanf(): Read of 8192 bytes failed with errno=9 Bad file %r(descriptor|number)%r in %s on line %d
 bool(false)

-Notice: fscanf(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fscanf(): Read of 8192 bytes failed with errno=9 Bad file %r(descriptor|number)%r in %s on line %d
 bool(false)

-Notice: fscanf(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fscanf(): Read of 8192 bytes failed with errno=9 Bad file %r(descriptor|number)%r in %s on line %d
 bool(false)

-Notice: fscanf(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fscanf(): Read of 8192 bytes failed with errno=9 Bad file %r(descriptor|number)%r in %s on line %d
 bool(false)

 -- iteration 2 --

-Notice: fscanf(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fscanf(): Read of 8192 bytes failed with errno=9 Bad file %r(descriptor|number)%r in %s on line %d
 bool(false)

-Notice: fscanf(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fscanf(): Read of 8192 bytes failed with errno=9 Bad file %r(descriptor|number)%r in %s on line %d
 bool(false)

-Notice: fscanf(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fscanf(): Read of 8192 bytes failed with errno=9 Bad file %r(descriptor|number)%r in %s on line %d
 bool(false)

-Notice: fscanf(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fscanf(): Read of 8192 bytes failed with errno=9 Bad file %r(descriptor|number)%r in %s on line %d
 bool(false)

-Notice: fscanf(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fscanf(): Read of 8192 bytes failed with errno=9 Bad file %r(descriptor|number)%r in %s on line %d
 bool(false)

-Notice: fscanf(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fscanf(): Read of 8192 bytes failed with errno=9 Bad file %r(descriptor|number)%r in %s on line %d
 bool(false)

-Notice: fscanf(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fscanf(): Read of 8192 bytes failed with errno=9 Bad file %r(descriptor|number)%r in %s on line %d
 bool(false)

 -- iteration 3 --

-Notice: fscanf(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fscanf(): Read of 8192 bytes failed with errno=9 Bad file %r(descriptor|number)%r in %s on line %d
 bool(false)

-Notice: fscanf(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fscanf(): Read of 8192 bytes failed with errno=9 Bad file %r(descriptor|number)%r in %s on line %d
 bool(false)

-Notice: fscanf(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fscanf(): Read of 8192 bytes failed with errno=9 Bad file %r(descriptor|number)%r in %s on line %d
 bool(false)

-Notice: fscanf(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fscanf(): Read of 8192 bytes failed with errno=9 Bad file %r(descriptor|number)%r in %s on line %d
 bool(false)

-Notice: fscanf(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fscanf(): Read of 8192 bytes failed with errno=9 Bad file %r(descriptor|number)%r in %s on line %d
 bool(false)

-Notice: fscanf(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fscanf(): Read of 8192 bytes failed with errno=9 Bad file %r(descriptor|number)%r in %s on line %d
 bool(false)

-Notice: fscanf(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fscanf(): Read of 8192 bytes failed with errno=9 Bad file %r(descriptor|number)%r in %s on line %d
 bool(false)

 -- iteration 4 --

-Notice: fscanf(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fscanf(): Read of 8192 bytes failed with errno=9 Bad file %r(descriptor|number)%r in %s on line %d
 bool(false)

-Notice: fscanf(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fscanf(): Read of 8192 bytes failed with errno=9 Bad file %r(descriptor|number)%r in %s on line %d
 bool(false)

-Notice: fscanf(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fscanf(): Read of 8192 bytes failed with errno=9 Bad file %r(descriptor|number)%r in %s on line %d
 bool(false)

-Notice: fscanf(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fscanf(): Read of 8192 bytes failed with errno=9 Bad file %r(descriptor|number)%r in %s on line %d
 bool(false)

-Notice: fscanf(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fscanf(): Read of 8192 bytes failed with errno=9 Bad file %r(descriptor|number)%r in %s on line %d
 bool(false)

-Notice: fscanf(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fscanf(): Read of 8192 bytes failed with errno=9 Bad file %r(descriptor|number)%r in %s on line %d
 bool(false)

-Notice: fscanf(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fscanf(): Read of 8192 bytes failed with errno=9 Bad file %r(descriptor|number)%r in %s on line %d
 bool(false)

 -- iteration 5 --

-Notice: fscanf(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fscanf(): Read of 8192 bytes failed with errno=9 Bad file %r(descriptor|number)%r in %s on line %d
 bool(false)

-Notice: fscanf(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fscanf(): Read of 8192 bytes failed with errno=9 Bad file %r(descriptor|number)%r in %s on line %d
 bool(false)

-Notice: fscanf(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fscanf(): Read of 8192 bytes failed with errno=9 Bad file %r(descriptor|number)%r in %s on line %d
 bool(false)

-Notice: fscanf(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fscanf(): Read of 8192 bytes failed with errno=9 Bad file %r(descriptor|number)%r in %s on line %d
 bool(false)

-Notice: fscanf(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fscanf(): Read of 8192 bytes failed with errno=9 Bad file %r(descriptor|number)%r in %s on line %d
 bool(false)

-Notice: fscanf(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fscanf(): Read of 8192 bytes failed with errno=9 Bad file %r(descriptor|number)%r in %s on line %d
 bool(false)

-Notice: fscanf(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fscanf(): Read of 8192 bytes failed with errno=9 Bad file %r(descriptor|number)%r in %s on line %d
 bool(false)

 -- iteration 6 --

-Notice: fscanf(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fscanf(): Read of 8192 bytes failed with errno=9 Bad file %r(descriptor|number)%r in %s on line %d
 bool(false)

-Notice: fscanf(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fscanf(): Read of 8192 bytes failed with errno=9 Bad file %r(descriptor|number)%r in %s on line %d
 bool(false)

-Notice: fscanf(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fscanf(): Read of 8192 bytes failed with errno=9 Bad file %r(descriptor|number)%r in %s on line %d
 bool(false)

-Notice: fscanf(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fscanf(): Read of 8192 bytes failed with errno=9 Bad file %r(descriptor|number)%r in %s on line %d
 bool(false)

-Notice: fscanf(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fscanf(): Read of 8192 bytes failed with errno=9 Bad file %r(descriptor|number)%r in %s on line %d
 bool(false)

-Notice: fscanf(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fscanf(): Read of 8192 bytes failed with errno=9 Bad file %r(descriptor|number)%r in %s on line %d
 bool(false)

-Notice: fscanf(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fscanf(): Read of 8192 bytes failed with errno=9 Bad file %r(descriptor|number)%r in %s on line %d
 bool(false)

 -- iteration 7 --

-Notice: fscanf(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fscanf(): Read of 8192 bytes failed with errno=9 Bad file %r(descriptor|number)%r in %s on line %d
 bool(false)

-Notice: fscanf(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fscanf(): Read of 8192 bytes failed with errno=9 Bad file %r(descriptor|number)%r in %s on line %d
 bool(false)

-Notice: fscanf(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fscanf(): Read of 8192 bytes failed with errno=9 Bad file %r(descriptor|number)%r in %s on line %d
 bool(false)

-Notice: fscanf(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fscanf(): Read of 8192 bytes failed with errno=9 Bad file %r(descriptor|number)%r in %s on line %d
 bool(false)

-Notice: fscanf(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fscanf(): Read of 8192 bytes failed with errno=9 Bad file %r(descriptor|number)%r in %s on line %d
 bool(false)

-Notice: fscanf(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fscanf(): Read of 8192 bytes failed with errno=9 Bad file %r(descriptor|number)%r in %s on line %d
 bool(false)

-Notice: fscanf(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fscanf(): Read of 8192 bytes failed with errno=9 Bad file %r(descriptor|number)%r in %s on line %d
 bool(false)

 -- iteration 8 --

-Notice: fscanf(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fscanf(): Read of 8192 bytes failed with errno=9 Bad file %r(descriptor|number)%r in %s on line %d
 bool(false)

-Notice: fscanf(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fscanf(): Read of 8192 bytes failed with errno=9 Bad file %r(descriptor|number)%r in %s on line %d
 bool(false)

-Notice: fscanf(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fscanf(): Read of 8192 bytes failed with errno=9 Bad file %r(descriptor|number)%r in %s on line %d
 bool(false)

-Notice: fscanf(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fscanf(): Read of 8192 bytes failed with errno=9 Bad file %r(descriptor|number)%r in %s on line %d
 bool(false)

-Notice: fscanf(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fscanf(): Read of 8192 bytes failed with errno=9 Bad file %r(descriptor|number)%r in %s on line %d
 bool(false)

-Notice: fscanf(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fscanf(): Read of 8192 bytes failed with errno=9 Bad file %r(descriptor|number)%r in %s on line %d
 bool(false)

-Notice: fscanf(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fscanf(): Read of 8192 bytes failed with errno=9 Bad file %r(descriptor|number)%r in %s on line %d
 bool(false)

 -- iteration 9 --

-Notice: fscanf(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fscanf(): Read of 8192 bytes failed with errno=9 Bad file %r(descriptor|number)%r in %s on line %d
 bool(false)

-Notice: fscanf(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fscanf(): Read of 8192 bytes failed with errno=9 Bad file %r(descriptor|number)%r in %s on line %d
 bool(false)

-Notice: fscanf(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fscanf(): Read of 8192 bytes failed with errno=9 Bad file %r(descriptor|number)%r in %s on line %d
 bool(false)

-Notice: fscanf(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fscanf(): Read of 8192 bytes failed with errno=9 Bad file %r(descriptor|number)%r in %s on line %d
 bool(false)

-Notice: fscanf(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fscanf(): Read of 8192 bytes failed with errno=9 Bad file %r(descriptor|number)%r in %s on line %d
 bool(false)

-Notice: fscanf(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fscanf(): Read of 8192 bytes failed with errno=9 Bad file %r(descriptor|number)%r in %s on line %d
 bool(false)

-Notice: fscanf(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fscanf(): Read of 8192 bytes failed with errno=9 Bad file %r(descriptor|number)%r in %s on line %d
 bool(false)

 *** Done ***
diff --git a/ext/standard/tests/file/fsync.phpt b/ext/standard/tests/file/fsync.phpt
index 7a036a55d4d..dfa7404caa5 100644
--- a/ext/standard/tests/file/fsync.phpt
+++ b/ext/standard/tests/file/fsync.phpt
@@ -34,7 +34,12 @@

 echo "\n*** Testing fsync(): attempting to sync stdin ***\n";
 $file_handle = fopen("php://stdin", "w");
-var_dump(fsync($file_handle));
+// On Solaris, fsync() on stdin returns success
+if (PHP_OS_FAMILY === 'Solaris') {
+  var_dump(!fsync($file_handle));
+} else {
+  var_dump(fsync($file_handle));
+}
 fclose($file_handle);

 echo "\n*** Testing fsync(): for non-file stream ***\n";
diff --git a/ext/standard/tests/file/fwrite.phpt b/ext/standard/tests/file/fwrite.phpt
index 12bfb6727ec..e29c6a3507d 100644
--- a/ext/standard/tests/file/fwrite.phpt
+++ b/ext/standard/tests/file/fwrite.phpt
@@ -29,7 +29,7 @@
 --EXPECTF--
 int(0)

-Notice: fwrite(): Write of 4 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fwrite(): Write of 4 bytes failed with errno=9 Bad file %r(descriptor|number)%r in %s on line %d
 bool(false)
 int(0)
 int(4)
diff --git a/ext/standard/tests/file/fwrite_variation1.phpt b/ext/standard/tests/file/fwrite_variation1.phpt
index 34a1c89c693..3660cffae8f 100644
--- a/ext/standard/tests/file/fwrite_variation1.phpt
+++ b/ext/standard/tests/file/fwrite_variation1.phpt
@@ -68,13 +68,13 @@
 -- Opening file in r --
 int(0)

-Notice: fwrite(): Write of 1024 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fwrite(): Write of 1024 bytes failed with errno=9 Bad file %r(descriptor|number)%r in %s on line %d
 bool(false)
 int(0)
 bool(false)
 int(2)

-Notice: fwrite(): Write of 1024 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fwrite(): Write of 1024 bytes failed with errno=9 Bad file %r(descriptor|number)%r in %s on line %d
 bool(false)
 int(2)
 bool(false)
@@ -84,13 +84,13 @@
 -- Opening file in rb --
 int(0)

-Notice: fwrite(): Write of 1024 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fwrite(): Write of 1024 bytes failed with errno=9 Bad file %r(descriptor|number)%r in %s on line %d
 bool(false)
 int(0)
 bool(false)
 int(2)

-Notice: fwrite(): Write of 1024 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fwrite(): Write of 1024 bytes failed with errno=9 Bad file %r(descriptor|number)%r in %s on line %d
 bool(false)
 int(2)
 bool(false)
@@ -100,13 +100,13 @@
 -- Opening file in rt --
 int(0)

-Notice: fwrite(): Write of 1024 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fwrite(): Write of 1024 bytes failed with errno=9 Bad file %r(descriptor|number)%r in %s on line %d
 bool(false)
 int(0)
 bool(false)
 int(2)

-Notice: fwrite(): Write of 1024 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fwrite(): Write of 1024 bytes failed with errno=9 Bad file %r(descriptor|number)%r in %s on line %d
 bool(false)
 int(2)
 bool(false)
@@ -118,13 +118,13 @@
 -- Opening file in r --
 int(0)

-Notice: fwrite(): Write of 1024 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fwrite(): Write of 1024 bytes failed with errno=9 Bad file %r(descriptor|number)%r in %s on line %d
 bool(false)
 int(0)
 bool(false)
 int(2)

-Notice: fwrite(): Write of 1024 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fwrite(): Write of 1024 bytes failed with errno=9 Bad file %r(descriptor|number)%r in %s on line %d
 bool(false)
 int(2)
 bool(false)
@@ -134,13 +134,13 @@
 -- Opening file in rb --
 int(0)

-Notice: fwrite(): Write of 1024 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fwrite(): Write of 1024 bytes failed with errno=9 Bad file %r(descriptor|number)%r in %s on line %d
 bool(false)
 int(0)
 bool(false)
 int(2)

-Notice: fwrite(): Write of 1024 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fwrite(): Write of 1024 bytes failed with errno=9 Bad file %r(descriptor|number)%r in %s on line %d
 bool(false)
 int(2)
 bool(false)
@@ -150,13 +150,13 @@
 -- Opening file in rt --
 int(0)

-Notice: fwrite(): Write of 1024 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fwrite(): Write of 1024 bytes failed with errno=9 Bad file %r(descriptor|number)%r in %s on line %d
 bool(false)
 int(0)
 bool(false)
 int(2)

-Notice: fwrite(): Write of 1024 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fwrite(): Write of 1024 bytes failed with errno=9 Bad file %r(descriptor|number)%r in %s on line %d
 bool(false)
 int(2)
 bool(false)
@@ -168,13 +168,13 @@
 -- Opening file in r --
 int(0)

-Notice: fwrite(): Write of 1024 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fwrite(): Write of 1024 bytes failed with errno=9 Bad file %r(descriptor|number)%r in %s on line %d
 bool(false)
 int(0)
 bool(false)
 int(2)

-Notice: fwrite(): Write of 1024 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fwrite(): Write of 1024 bytes failed with errno=9 Bad file %r(descriptor|number)%r in %s on line %d
 bool(false)
 int(2)
 bool(false)
@@ -184,13 +184,13 @@
 -- Opening file in rb --
 int(0)

-Notice: fwrite(): Write of 1024 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fwrite(): Write of 1024 bytes failed with errno=9 Bad file %r(descriptor|number)%r in %s on line %d
 bool(false)
 int(0)
 bool(false)
 int(2)

-Notice: fwrite(): Write of 1024 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fwrite(): Write of 1024 bytes failed with errno=9 Bad file %r(descriptor|number)%r in %s on line %d
 bool(false)
 int(2)
 bool(false)
@@ -200,13 +200,13 @@
 -- Opening file in rt --
 int(0)

-Notice: fwrite(): Write of 1024 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fwrite(): Write of 1024 bytes failed with errno=9 Bad file %r(descriptor|number)%r in %s on line %d
 bool(false)
 int(0)
 bool(false)
 int(2)

-Notice: fwrite(): Write of 1024 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fwrite(): Write of 1024 bytes failed with errno=9 Bad file %r(descriptor|number)%r in %s on line %d
 bool(false)
 int(2)
 bool(false)
@@ -218,13 +218,13 @@
 -- Opening file in r --
 int(0)

-Notice: fwrite(): Write of 1024 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fwrite(): Write of 1024 bytes failed with errno=9 Bad file %r(descriptor|number)%r in %s on line %d
 bool(false)
 int(0)
 bool(false)
 int(2)

-Notice: fwrite(): Write of 1024 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fwrite(): Write of 1024 bytes failed with errno=9 Bad file %r(descriptor|number)%r in %s on line %d
 bool(false)
 int(2)
 bool(false)
@@ -234,13 +234,13 @@
 -- Opening file in rb --
 int(0)

-Notice: fwrite(): Write of 1024 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fwrite(): Write of 1024 bytes failed with errno=9 Bad file %r(descriptor|number)%r in %s on line %d
 bool(false)
 int(0)
 bool(false)
 int(2)

-Notice: fwrite(): Write of 1024 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fwrite(): Write of 1024 bytes failed with errno=9 Bad file %r(descriptor|number)%r in %s on line %d
 bool(false)
 int(2)
 bool(false)
@@ -250,13 +250,13 @@
 -- Opening file in rt --
 int(0)

-Notice: fwrite(): Write of 1024 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fwrite(): Write of 1024 bytes failed with errno=9 Bad file %r(descriptor|number)%r in %s on line %d
 bool(false)
 int(0)
 bool(false)
 int(2)

-Notice: fwrite(): Write of 1024 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fwrite(): Write of 1024 bytes failed with errno=9 Bad file %r(descriptor|number)%r in %s on line %d
 bool(false)
 int(2)
 bool(false)
diff --git a/ext/standard/tests/file/lstat_stat_variation18.phpt b/ext/standard/tests/file/lstat_stat_variation18.phpt
index e3c8386e70f..9291de26939 100644
--- a/ext/standard/tests/file/lstat_stat_variation18.phpt
+++ b/ext/standard/tests/file/lstat_stat_variation18.phpt
@@ -62,7 +62,7 @@ public function __construct($name) {
   [5]=>
   int(%d)
   [6]=>
-  int(%d)
+  int(%i)
   [7]=>
   int(%d)
   [8]=>
@@ -118,7 +118,7 @@ public function __construct($name) {
   [5]=>
   int(%d)
   [6]=>
-  int(%d)
+  int(%i)
   [7]=>
   int(%d)
   [8]=>
diff --git a/ext/standard/tests/file/lstat_stat_variation19.phpt b/ext/standard/tests/file/lstat_stat_variation19.phpt
index 18ad03e52d2..24af43599ef 100644
--- a/ext/standard/tests/file/lstat_stat_variation19.phpt
+++ b/ext/standard/tests/file/lstat_stat_variation19.phpt
@@ -63,7 +63,7 @@
   [5]=>
   int(%d)
   [6]=>
-  int(%d)
+  int(%i)
   [7]=>
   int(%d)
   [8]=>
@@ -117,7 +117,7 @@
   [5]=>
   int(%d)
   [6]=>
-  int(%d)
+  int(%i)
   [7]=>
   int(%d)
   [8]=>
@@ -173,7 +173,7 @@
   [5]=>
   int(%d)
   [6]=>
-  int(%d)
+  int(%i)
   [7]=>
   int(%d)
   [8]=>
@@ -227,7 +227,7 @@
   [5]=>
   int(%d)
   [6]=>
-  int(%d)
+  int(%i)
   [7]=>
   int(%d)
   [8]=>
diff --git a/ext/standard/tests/file/lstat_stat_variation20.phpt b/ext/standard/tests/file/lstat_stat_variation20.phpt
index 5bff0456eba..cfff4571ae1 100644
--- a/ext/standard/tests/file/lstat_stat_variation20.phpt
+++ b/ext/standard/tests/file/lstat_stat_variation20.phpt
@@ -72,7 +72,7 @@ public function __construct($name) {
   [5]=>
   int(%d)
   [6]=>
-  int(%d)
+  int(%i)
   [7]=>
   int(%d)
   [8]=>
@@ -128,7 +128,7 @@ public function __construct($name) {
   [5]=>
   int(%d)
   [6]=>
-  int(%d)
+  int(%i)
   [7]=>
   int(%d)
   [8]=>
@@ -182,7 +182,7 @@ public function __construct($name) {
   [5]=>
   int(%d)
   [6]=>
-  int(%d)
+  int(%i)
   [7]=>
   int(%d)
   [8]=>
@@ -236,7 +236,7 @@ public function __construct($name) {
   [5]=>
   int(%d)
   [6]=>
-  int(%d)
+  int(%i)
   [7]=>
   int(%d)
   [8]=>
diff --git a/ext/standard/tests/file/open_basedir_cwd_resolve.phpt b/ext/standard/tests/file/open_basedir_cwd_resolve.phpt
index 753e21d997d..9c95e4904fa 100644
--- a/ext/standard/tests/file/open_basedir_cwd_resolve.phpt
+++ b/ext/standard/tests/file/open_basedir_cwd_resolve.phpt
@@ -11,5 +11,5 @@
 --EXPECTF--
 Warning: file_get_contents(): open_basedir restriction in effect. File(/some/path/outside/open/basedir) is not within the allowed path(s): (%s) in %s on line %d

-Warning: file_get_contents(/some/path/outside/open/basedir): Failed to open stream: Operation not permitted in %s on line %d
+Warning: file_get_contents(/some/path/outside/open/basedir): Failed to open stream: %r(Operation not permitted|Insufficient privileges)%r in %s on line %d
 bool(false)
diff --git a/ext/standard/tests/file/popen_pclose_error-sunos.phpt b/ext/standard/tests/file/popen_pclose_error-sunos.phpt
deleted file mode 100644
index 981f1d5a6e6..00000000000
--- a/ext/standard/tests/file/popen_pclose_error-sunos.phpt
+++ /dev/null
@@ -1,48 +0,0 @@
---TEST--
-Test popen() and pclose function: error conditions
---SKIPIF--
-<?php
-if( substr(PHP_OS, 0, 3) != 'Sun')
-  die("skip Only valid for Sun Solaris");
-?>
---FILE--
-<?php
-
-$file_path = __DIR__;
-echo "*** Testing for error conditions ***\n";
-var_dump( popen() );  // Zero Arguments
-var_dump( popen("abc.txt") );   // Single Argument
-var_dump( popen("abc.txt", "rw") );   // Invalid mode Argument
-var_dump( pclose() );
-$file_handle = fopen($file_path."/popen.tmp", "w");
-var_dump( pclose($file_handle, $file_handle) );
-fclose($file_handle);
-var_dump( pclose(1) );
-echo "\n--- Done ---";
-?>
---CLEAN--
-<?php
-$file_path = __DIR__;
-unlink($file_path."/popen.tmp");
-?>
---EXPECTF--
-*** Testing for error conditions ***
-
-Warning: Wrong parameter count for popen() in %s on line %d
-NULL
-
-Warning: Wrong parameter count for popen() in %s on line %d
-NULL
-sh: abc.txt: not found
-resource(%d) of type (stream)
-
-Warning: Wrong parameter count for pclose() in %s on line %d
-NULL
-
-Warning: Wrong parameter count for pclose() in %s on line %d
-NULL
-
-Warning: pclose(): supplied argument is not a valid stream resource in %s on line %d
-bool(false)
-
---- Done ---
diff --git a/ext/standard/tests/file/realpath_bug77484.phpt b/ext/standard/tests/file/realpath_bug77484.phpt
index 9aa3a335c2a..0b78a2aad26 100644
--- a/ext/standard/tests/file/realpath_bug77484.phpt
+++ b/ext/standard/tests/file/realpath_bug77484.phpt
@@ -2,8 +2,8 @@
 Bug #77484 Zend engine crashes when calling realpath in invalid working dir
 --SKIPIF--
 <?php
-if (substr(PHP_OS, 0, 3) == 'WIN') {
-    die("skip can't remove CWD on Windows");
+if (substr(PHP_OS, 0, 3) == 'WIN' || PHP_OS_FAMILY === 'Solaris') {
+    die("skip can't remove CWD on Windows or Solaris");
 }
 if (PHP_ZTS) {
     /* TODO eliminate difference in TS build. */
diff --git a/ext/standard/tests/filters/bug35916.phpt b/ext/standard/tests/filters/bug35916.phpt
index 52b511ce3d4..7b36c1d4134 100644
--- a/ext/standard/tests/filters/bug35916.phpt
+++ b/ext/standard/tests/filters/bug35916.phpt
@@ -42,6 +42,6 @@ function onClose(): void
 --EXPECTF--
 fffffffffff

-Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file %r(descriptor|number)%r in %s on line %d
 hello
 THANK YOU
diff --git a/ext/standard/tests/filters/gh17345.phpt b/ext/standard/tests/filters/gh17345.phpt
index f64659390a1..62bf8764a67 100644
--- a/ext/standard/tests/filters/gh17345.phpt
+++ b/ext/standard/tests/filters/gh17345.phpt
@@ -44,6 +44,6 @@ function onClose(): void
 --EXPECTF--
 fffffffffff

-Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: fread(): Read of 8192 bytes failed with errno=9 Bad file %r(descriptor|number)%r in %s on line %d
 hello
 THANK YOU
diff --git a/ext/standard/tests/general_functions/getservbyname_basic.phpt b/ext/standard/tests/general_functions/getservbyname_basic.phpt
index 6d26cfedc38..db08f8e0c3d 100644
--- a/ext/standard/tests/general_functions/getservbyname_basic.phpt
+++ b/ext/standard/tests/general_functions/getservbyname_basic.phpt
@@ -10,6 +10,9 @@
 if(in_array(PHP_OS_FAMILY, ['BSD', 'Darwin', 'Solaris', 'Linux'])){
     if (!file_exists("/etc/services")) die("skip reason: missing /etc/services");
 }
+if (PHP_OS_FAMILY === 'Solaris') {
+    die("skip Solaris has incomplete /etc/services");
+}
 if (getenv('SKIP_MSAN')) die('skip msan missing interceptor for getservbyname()');
 ?>
 --FILE--
diff --git a/ext/standard/tests/general_functions/proc_nice_basic.phpt b/ext/standard/tests/general_functions/proc_nice_basic.phpt
index 9e73a7f890b..107f6d18651 100644
--- a/ext/standard/tests/general_functions/proc_nice_basic.phpt
+++ b/ext/standard/tests/general_functions/proc_nice_basic.phpt
@@ -9,6 +9,7 @@
 <?php
 if(!function_exists('proc_nice')) die("skip. proc_nice not available ");
 if(substr(strtoupper(PHP_OS), 0, 3) == 'WIN') die('skip. not for Windows');
+if(PHP_OS_FAMILY === 'Solaris') die('skip Solaris has different nice levels');
 exec('ps -p 1 -o "pid,nice"', $output, $exit_code);
 if ($exit_code !== 0) {
     die("skip ps -p is not available");
diff --git a/ext/standard/tests/network/ip2long_variation2_x64.phpt b/ext/standard/tests/network/ip2long_variation2_x64.phpt
index b69cc9e4d90..ffa0827c944 100644
--- a/ext/standard/tests/network/ip2long_variation2_x64.phpt
+++ b/ext/standard/tests/network/ip2long_variation2_x64.phpt
@@ -9,6 +9,7 @@
 */
 if(PHP_OS == 'Darwin') die("skip - inet_pton behaves differently on Darwin");
 if(PHP_OS == 'OpenBSD') die("skip - inet_pton accepts leading zeros on OpenBSD");
+if(PHP_OS_FAMILY === 'Solaris') die("skip - Solaris inet_aton accepts invalid octal as decimal");
 if(PHP_INT_SIZE != 8) {die('skip 64 bit only');}
 ?>
 --FILE--
diff --git a/ext/standard/tests/network/syslog_new_line.phpt b/ext/standard/tests/network/syslog_new_line.phpt
index 69eb9c1d67e..d63f5714c79 100644
--- a/ext/standard/tests/network/syslog_new_line.phpt
+++ b/ext/standard/tests/network/syslog_new_line.phpt
@@ -4,6 +4,8 @@
 <?php
 if(substr(PHP_OS, 0, 3) == "WIN")
   die("skip Won't run on Windows");
+if (!defined('LOG_PERROR'))
+  die("skip LOG_PERROR is not available on this platform");
 ?>
 --FILE--
 <?php
diff --git a/ext/standard/tests/network/syslog_null_byte.phpt b/ext/standard/tests/network/syslog_null_byte.phpt
index e7cb1fb7a4b..4b49546e2b2 100644
--- a/ext/standard/tests/network/syslog_null_byte.phpt
+++ b/ext/standard/tests/network/syslog_null_byte.phpt
@@ -4,6 +4,8 @@
 <?php
 if(substr(PHP_OS, 0, 3) == "WIN")
   die("skip Won't run on Windows");
+if (!defined("LOG_PERROR"))
+  die("skip LOG_PERROR is not available on this platform");
 ?>
 --FILE--
 <?php
diff --git a/ext/standard/tests/streams/bug54946.phpt b/ext/standard/tests/streams/bug54946.phpt
index 3be2a1367bc..3c5953f430e 100644
--- a/ext/standard/tests/streams/bug54946.phpt
+++ b/ext/standard/tests/streams/bug54946.phpt
@@ -31,11 +31,11 @@
 unlink($filename);
 ?>
 --EXPECTF--
-Notice: stream_get_contents(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: stream_get_contents(): Read of 8192 bytes failed with errno=9 Bad file %r(descriptor|number)%r in %s on line %d
 string(0) ""

-Notice: stream_get_contents(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: stream_get_contents(): Read of 8192 bytes failed with errno=9 Bad file %r(descriptor|number)%r in %s on line %d
 string(0) ""

-Notice: stream_get_contents(): Read of 8192 bytes failed with errno=9 Bad file descriptor in %s on line %d
+Notice: stream_get_contents(): Read of 8192 bytes failed with errno=9 Bad file %r(descriptor|number)%r in %s on line %d
 string(0) ""
diff --git a/ext/standard/tests/streams/gh9590-001.phpt b/ext/standard/tests/streams/gh9590-001.phpt
index 558e4660a65..8f5691af1ad 100644
--- a/ext/standard/tests/streams/gh9590-001.phpt
+++ b/ext/standard/tests/streams/gh9590-001.phpt
@@ -7,6 +7,8 @@
 if (!function_exists('posix_setrlimit') || !posix_setrlimit(POSIX_RLIMIT_NOFILE, 2048, -1)) {
     die('skip Failed to set POSIX_RLIMIT_NOFILE');
 }
+if (PHP_OS_FAMILY === 'Solaris' && PHP_INT_SIZE === 8)
+    die('skip Solaris LP64 FD_SETSIZE=65536 not practically exceedable here');
 ?>
 --FILE--
 <?php
diff --git a/ext/standard/tests/streams/gh9590-002.phpt b/ext/standard/tests/streams/gh9590-002.phpt
index 55c1c6d0282..2a9a7c53c67 100644
--- a/ext/standard/tests/streams/gh9590-002.phpt
+++ b/ext/standard/tests/streams/gh9590-002.phpt
@@ -7,6 +7,8 @@
 if (!function_exists('posix_setrlimit') || !posix_setrlimit(POSIX_RLIMIT_NOFILE, 2048, -1)) {
     die('skip Failed to set POSIX_RLIMIT_NOFILE');
 }
+if (PHP_OS_FAMILY === 'Solaris' && PHP_INT_SIZE === 8)
+    die('skip Solaris LP64 FD_SETSIZE=65536 not practically exceedable here');
 ?>
 --FILE--
 <?php
diff --git a/ext/standard/tests/streams/glob-wrapper.phpt b/ext/standard/tests/streams/glob-wrapper.phpt
index 212a33f1440..9be0fce6b71 100644
--- a/ext/standard/tests/streams/glob-wrapper.phpt
+++ b/ext/standard/tests/streams/glob-wrapper.phpt
@@ -27,7 +27,7 @@

 Warning: opendir(): open_basedir restriction in effect. File(%s) is not within the allowed path(s): (/does_not_exist) in %s%eglob-wrapper.php on line 5

-Warning: opendir(%s): Failed to open directory: Operation not permitted in %s%eglob-wrapper.php on line 5
+Warning: opendir(%s): Failed to open directory: %r(Operation not permitted|Insufficient privileges)%r in %s%eglob-wrapper.php on line 5
 Failed to open %s
 ** Opening glob://%s
 No files in glob://%s
diff --git a/ext/standard/tests/strings/setlocale_basic1.phpt b/ext/standard/tests/strings/setlocale_basic1.phpt
index aeacba8cbe9..42d5b196ed5 100644
--- a/ext/standard/tests/strings/setlocale_basic1.phpt
+++ b/ext/standard/tests/strings/setlocale_basic1.phpt
@@ -75,7 +75,11 @@ function list_system_locales() {
 echo "Setting system locale(LC_ALL) to ";
 foreach($common_locales as $value) {
   // check if a commonly used locale is installed in the system
-  if(in_array($value, $all_system_locales)){
+  // Solaris uses .UTF-8 canonical form, so normalize
+  $normalized = preg_replace('/\.utf8$/i', '.UTF-8', $value);
+
+  if (in_array($value, $all_system_locales) ||
+      in_array($normalized, $all_system_locales)) {
     echo "$value\n"; // print, this is found
     // set the found locale as current locale
     var_dump(setlocale(LC_ALL, $value ));
diff --git a/ext/standard/tests/strings/setlocale_basic2.phpt b/ext/standard/tests/strings/setlocale_basic2.phpt
index ab29b264758..1e98942ae78 100644
--- a/ext/standard/tests/strings/setlocale_basic2.phpt
+++ b/ext/standard/tests/strings/setlocale_basic2.phpt
@@ -75,7 +75,12 @@ function list_system_locales() {
 // checking the currency setting of the system(use localconv())
 $list_of_locales = array();
 foreach($common_locales as $value) {
-  if( in_array($value, $all_system_locales) ) {
+  // Solaris uses canonical .UTF-8 form, so normalize the name
+  $normalized = preg_replace('/\.utf8$/i', '.UTF-8', $value);
+
+  if (in_array($value, $all_system_locales) ||
+      in_array($normalized, $all_system_locales)) {
+
     $list_of_locales[] = $value;
   }
 }
diff --git a/ext/standard/tests/strings/setlocale_basic3.phpt b/ext/standard/tests/strings/setlocale_basic3.phpt
index de2e0bb4cc6..c33691fec13 100644
--- a/ext/standard/tests/strings/setlocale_basic3.phpt
+++ b/ext/standard/tests/strings/setlocale_basic3.phpt
@@ -37,32 +37,37 @@ function list_system_locales() {
    pass as argument to setlocale() */
 echo "*** Testing setlocale() by passing multiple locales as argument ***\n";

+if (PHP_OS_FAMILY === 'Solaris') {
+  $utfending = "UTF-8";
+} else {
+  $utfending = "utf8";
+}

 //set of currency symbol according to above list of locales
 $currency_symbol = array(
-  "en_US.utf8" => "USD",
-  "en_AU.utf8" => "AUD",
-  "ko_KR.utf8" => "KRW",
-  "zh_CN.utf8" => "CNY",
-  "de_DE.utf8" => "EUR",
-  "es_EC.utf8" => "USD",
-  "fr_FR.utf8" => "EUR",
-  "ja_JP.utf8" => "JPY",
-  "el_GR.utf8" => "EUR",
-  "nl_NL.utf8" =>"EUR"
+  "en_US.$utfending" => "USD",
+  "en_AU.$utfending" => "AUD",
+  "ko_KR.$utfending" => "KRW",
+  "zh_CN.$utfending" => "CNY",
+  "de_DE.$utfending" => "EUR",
+  "es_EC.$utfending" => "USD",
+  "fr_FR.$utfending" => "EUR",
+  "ja_JP.$utfending" => "JPY",
+  "el_GR.$utfending" => "EUR",
+  "nl_NL.$utfending" =>"EUR"
 );

 // gather all the locales installed in the system
 $all_system_locales = list_system_locales();

 // Now check for three locales that is present in the system and use that as argument to setlocale()
-if( in_array("en_US.utf8",$all_system_locales) ||
-    in_array("Ko_KR.utf8",$all_system_locales) ||
-    in_array("zh_CN.utf8",$all_system_locales) ) {
+if( in_array("en_US.$utfending",$all_system_locales) ||
+    in_array("Ko_KR.$utfending",$all_system_locales) ||
+    in_array("zh_CN.$utfending",$all_system_locales) ) {
   echo "-- Testing setlocale() by giving 'category' as LC_ALL & multiple locales(en_US.utf8, Ko_KR.utf8, zh_CN.utf8) --\n";

   // call setlocale()
-  $new_locale = setlocale(LC_ALL, "en_US.utf8", "Ko_KR.utf8", "zh_CN.utf8");
+  $new_locale = setlocale(LC_ALL, "en_US.$utfending", "Ko_KR.$utfending", "zh_CN.$utfending");

   // dump the name of the new locale set by setlocale()
   var_dump($new_locale);
diff --git a/ext/standard/tests/strings/setlocale_variation1.phpt b/ext/standard/tests/strings/setlocale_variation1.phpt
index 4f81fca7c46..c3709a8cfcf 100644
--- a/ext/standard/tests/strings/setlocale_variation1.phpt
+++ b/ext/standard/tests/strings/setlocale_variation1.phpt
@@ -37,31 +37,37 @@ function list_system_locales() {
    pass as argument to setlocale(), pass 2 invalid arguments along with two valid arguments*/
 echo "*** Testing setlocale() by passing multiple valid/invalid locales as argument ***\n";

+if (PHP_OS_FAMILY === 'Solaris') {
+  $utfending = "UTF-8";
+} else {
+  $utfending = "utf8";
+}
+
 //set of currency symbol according to above list of locales
 $currency_symbol = array(
-  "en_US.utf8" => "USD",
-  "en_AU.utf8" => "AUD",
-  "ko_KR.utf8" => "KRW",
-  "zh_CN.utf8" => "CNY",
-  "de_DE.utf8" => "EUR",
-  "es_EC.utf8" => "USD",
-  "fr_FR.utf8" => "EUR",
-  "ja_JP.utf8" => "JPY",
-  "el_GR.utf8" => "EUR",
-  "nl_NL.utf8" =>"EUR"
+  "en_US.$utfending" => "USD",
+  "en_AU.$utfending" => "AUD",
+  "ko_KR.$utfending" => "KRW",
+  "zh_CN.$utfending" => "CNY",
+  "de_DE.$utfending" => "EUR",
+  "es_EC.$utfending" => "USD",
+  "fr_FR.$utfending" => "EUR",
+  "ja_JP.$utfending" => "JPY",
+  "el_GR.$utfending" => "EUR",
+  "nl_NL.$utfending" =>"EUR"
 );

 // gather all the locales installed in the system
 $all_system_locales = list_system_locales();

 // Now check for three locales that is present in the system and use that as argument to setlocale()
-if( in_array("en_US.utf8",$all_system_locales) ||
-    in_array("Ko_KR.utf8",$all_system_locales) ||
-    in_array("zh_CN.utf8",$all_system_locales) ) {
+if( in_array("en_US.$utfending",$all_system_locales) ||
+    in_array("Ko_KR.$utfending",$all_system_locales) ||
+    in_array("zh_CN.$utfending",$all_system_locales) ) {
   echo "-- Testing setlocale() by giving 'category' as LC_ALL & multiple locales(en_US.invalid, en_US.utf8, Ko_KR.utf8, KO_KR.invalid, zh_CN.utf8) --\n";

   // call setlocale()
-  $new_locale = setlocale(LC_ALL, "en_US.invalid", "en_US.utf8", "Ko_KR.utf8", "KO_KR.invalid", "zh_CN.utf8");
+  $new_locale = setlocale(LC_ALL, "en_US.invalid", "en_US.$utfending", "Ko_KR.$utfending", "KO_KR.invalid", "zh_CN.$utfending");

   // dump the name of the new locale set by setlocale()
   var_dump($new_locale);
diff --git a/ext/standard/tests/strings/setlocale_variation2.phpt b/ext/standard/tests/strings/setlocale_variation2.phpt
index 6f62f71ac1f..c6d44c4a54c 100644
--- a/ext/standard/tests/strings/setlocale_variation2.phpt
+++ b/ext/standard/tests/strings/setlocale_variation2.phpt
@@ -5,6 +5,9 @@
 if (substr(PHP_OS, 0, 3) == 'WIN') {
     die('skip Not valid for windows');
 }
+if (PHP_OS_FAMILY === 'Solaris') {
+    die("skip Some locales on Solaris (e.g. iso_8859_1) are incomplete, cannot test LC_ALL");
+}
 exec("locale -a", $output, $exit_code);
 if ($exit_code !== 0) {
     die("skip locale -a not available");
diff --git a/ext/standard/tests/time/strptime_basic.phpt b/ext/standard/tests/time/strptime_basic.phpt
index 17008e97d81..cbb71347134 100644
--- a/ext/standard/tests/time/strptime_basic.phpt
+++ b/ext/standard/tests/time/strptime_basic.phpt
@@ -5,8 +5,8 @@
 if (!function_exists('strptime')) {
     die("skip - strptime() function not available in this build");
 }
-if (PHP_OS_FAMILY == 'Darwin' || PHP_OS_FAMILY == 'BSD') {
-    die("skip strptime() behaves differently on Darwin/BSD");
+if (PHP_OS_FAMILY == 'Darwin' || PHP_OS_FAMILY == 'BSD' || PHP_OS_FAMILY == 'Solaris' ) {
+    die("skip strptime() behaves differently on Darwin/BSD/Solaris");
 }
 if (!@strftime('%Z')) die('skip strftime does not support %Z');
 ?>
diff --git a/ext/xsl/tests/maxTemplateVars_modification_validation_bypass.phpt b/ext/xsl/tests/maxTemplateVars_modification_validation_bypass.phpt
index d2e52aa6099..7d95f7c02ba 100644
--- a/ext/xsl/tests/maxTemplateVars_modification_validation_bypass.phpt
+++ b/ext/xsl/tests/maxTemplateVars_modification_validation_bypass.phpt
@@ -36,7 +36,7 @@
 var_dump($proc);

 ?>
---EXPECT--
+--EXPECTF--
 --- Set to 1 ---
 --- Set to -1 ---
 XSLTProcessor::$maxTemplateVars must be greater than or equal to 0
@@ -51,7 +51,7 @@
   ["cloneDocument"]=>
   bool(false)
   ["maxTemplateDepth"]=>
-  int(3000)
+  int(%d)
   ["maxTemplateVars"]=>
   int(1)
 }
diff --git a/ext/zend_test/tests/gh11078.phpt b/ext/zend_test/tests/gh11078.phpt
index 5279d703b27..2aed49480b0 100644
--- a/ext/zend_test/tests/gh11078.phpt
+++ b/ext/zend_test/tests/gh11078.phpt
@@ -6,6 +6,7 @@
 <?php
 if (getenv('USE_ZEND_ALLOC') === '0') die('skip Zend MM disabled');
 if (PHP_OS_FAMILY === 'Windows') die('skip Windows does not support generic stream casting');
+if (PHP_OS_FAMILY === 'Solaris') die('skip Solaris does not support generic stream casting');
 ?>
 --FILE--
 <?php
diff --git a/ext/zlib/tests/zlib_wrapper_flock_basic.phpt b/ext/zlib/tests/zlib_wrapper_flock_basic.phpt
index 9ebb517715b..15b7a4bd01d 100644
--- a/ext/zlib/tests/zlib_wrapper_flock_basic.phpt
+++ b/ext/zlib/tests/zlib_wrapper_flock_basic.phpt
@@ -1,5 +1,11 @@
 --TEST--
 Test function flock on a zlib stream
+--SKIPIF--
+<?php
+if (PHP_OS_FAMILY === 'Solaris') {
+    die('skip Solaris: fcntl-based flock requires write access for LOCK_EX with read-only zlib stream');
+}
+?>
 --EXTENSIONS--
 zlib
 --FILE--
diff --git a/sapi/cli/tests/cli_process_title_unix.phpt b/sapi/cli/tests/cli_process_title_unix.phpt
index 166cb79ad3a..9f4d5ba6ce5 100644
--- a/sapi/cli/tests/cli_process_title_unix.phpt
+++ b/sapi/cli/tests/cli_process_title_unix.phpt
@@ -13,6 +13,9 @@
 if ($exit_code !== 0) {
     die("skip ps -p is not available");
 }
+if (PHP_OS_FAMILY === 'Solaris') {
+    die("skip process titles not supported on Solaris");
+}
 ?>
 --FILE--
 <?php