]> granicus.if.org Git - php/commitdiff
Remove support for preloading on Windows
authorNikita Popov <nikita.ppv@gmail.com>
Tue, 10 Dec 2019 13:29:58 +0000 (14:29 +0100)
committerNikita Popov <nikita.ppv@gmail.com>
Mon, 6 Jan 2020 21:41:55 +0000 (22:41 +0100)
Due to ASLR restrictions, preloading on Windows does not work with
any code that has preloading dependencies on internal classes.
This effectively makes it unusable for any non-trivial codebase.

Instead of pretending like preloading is going to work, only to
make people realize that it really doesn't once they get beyond
a dummy example, we disable support for preloading on Windows
entirely.

Closes GH-4999.

37 files changed:
NEWS
ext/ffi/tests/300-win32.phpt [deleted file]
ext/ffi/tests/bug78761.phpt
ext/opcache/ZendAccelerator.c
ext/opcache/tests/bug78014.phpt
ext/opcache/tests/bug78175.phpt
ext/opcache/tests/bug78175_2.phpt
ext/opcache/tests/bug78376.phpt
ext/opcache/tests/bug78937_1.phpt
ext/opcache/tests/bug78937_2.phpt
ext/opcache/tests/bug78937_3.phpt
ext/opcache/tests/bug78937_4.phpt
ext/opcache/tests/bug78937_5.phpt
ext/opcache/tests/bug78937_6.phpt
ext/opcache/tests/preload_001.phpt
ext/opcache/tests/preload_002.phpt
ext/opcache/tests/preload_003.phpt
ext/opcache/tests/preload_004.phpt
ext/opcache/tests/preload_005.phpt
ext/opcache/tests/preload_006.phpt
ext/opcache/tests/preload_007.phpt
ext/opcache/tests/preload_008.phpt
ext/opcache/tests/preload_009.phpt
ext/opcache/tests/preload_010.phpt
ext/opcache/tests/preload_011.phpt
ext/opcache/tests/preload_012.phpt
ext/opcache/tests/preload_013.phpt
ext/opcache/tests/preload_class_alias.phpt
ext/opcache/tests/preload_class_alias_2.phpt
ext/opcache/tests/preload_loadable_classes_1.phpt
ext/opcache/tests/preload_loadable_classes_2.phpt
ext/opcache/tests/preload_loadable_classes_3.phpt
ext/opcache/tests/preload_loadable_classes_4.inc [deleted file]
ext/opcache/tests/preload_loadable_classes_4.phpt [deleted file]
ext/opcache/tests/preload_trait_static.phpt
ext/opcache/tests/preload_unresolved_prop_type.phpt
ext/opcache/tests/preload_windows.phpt [new file with mode: 0644]

diff --git a/NEWS b/NEWS
index 9a28926ff666f5ec26945d77e658a136fbb13b06..fc7cf905d4ec7668a1fc4bb3d843c2850271f836 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -4,6 +4,7 @@ PHP                                                                        NEWS
 ?? ??? ????, PHP 7.4.2
 
 - Core:
+  . Preloading support on Windows has been disabled. (Nikita)
   . Fixed bug #79022 (class_exists returns True for classes that are not ready
     to be used). (Laruence)
   . Fixed bug #78929 (plus signs in cookie values are converted to spaces).
diff --git a/ext/ffi/tests/300-win32.phpt b/ext/ffi/tests/300-win32.phpt
deleted file mode 100644 (file)
index 9fd9fac..0000000
+++ /dev/null
@@ -1,24 +0,0 @@
---TEST--
-FFI 300: FFI preloading on Windows
---SKIPIF--
-<?php require_once('skipif.inc'); ?>
-<?php if (!extension_loaded('Zend OPcache')) die('skip Zend OPcache extension not available'); ?>
-<?php if (substr(PHP_OS, 0, 3) != 'WIN') die('skip for Windows only'); ?>
---INI--
-ffi.enable=1
-opcache.enable=1
-opcache.enable_cli=1
-opcache.optimization_level=-1
-opcache.preload={PWD}/preload.inc
---FILE--
-<?php
-$ffi = FFI::scope("TEST_300_WIN32");
-$ffi->php_printf("Hello World from %s!\n", "PHP");
-?>
---CLEAN--
-<?php
-       $fn = __DIR__ . "/300-win32.h";
-       unlink($fn);
-?>
---EXPECT--
-Hello World from PHP!
index 1db977a841c3e6e37479e091006c341c0e568294..0e6ae1b3b84f19a01e883e85d307800ecf067e75 100644 (file)
@@ -1,7 +1,10 @@
 --TEST--
 Bug #78761 (Zend memory heap corruption with preload and casting)
 --SKIPIF--
-<?php require_once('skipif.inc'); ?>
+<?php
+require_once('skipif.inc');
+if (PHP_OS_FAMILY == 'Windows') die('skip Preloading is not supported on Windows');
+?>
 --INI--
 opcache.enable_cli=1
 opcache.preload={PWD}/bug78761_preload.php
index 1cb21cd13031dc77a479c6780d2fbbbe5a12a2ea..e19980ab05bd8452a34d160800d4318677d4665a 100644 (file)
@@ -3397,13 +3397,6 @@ static void get_unlinked_dependency(zend_class_entry *ce, const char **kind, con
                        *name = ZSTR_VAL(ce->parent_name);
                        return;
                }
-#ifdef ZEND_WIN32
-               if (p->type == ZEND_INTERNAL_CLASS) {
-                       *kind = "Windows can't link to internal parent ";
-                       *name = ZSTR_VAL(ce->parent_name);
-                       return;
-               }
-#endif
                if (!(p->ce_flags & ZEND_ACC_CONSTANTS_UPDATED)) {
                        *kind = "Parent with unresolved initializers ";
                        *name = ZSTR_VAL(ce->parent_name);
@@ -3523,13 +3516,6 @@ static zend_bool preload_try_resolve_property_types(zend_class_entry *ce)
                                continue;
                        }
                        if (p != ce) {
-#ifdef ZEND_WIN32
-                               /* On Windows we can't link with internal class, because of ASLR */
-                               if (p->type == ZEND_INTERNAL_CLASS) {
-                                       ok = 0;
-                                       continue;
-                               }
-#endif
                                if (!(p->ce_flags & ZEND_ACC_CONSTANTS_UPDATED)) {
                                        ok = 0;
                                        continue;
@@ -3666,10 +3652,6 @@ static void preload_link(void)
                                        parent = zend_hash_find_ptr(EG(class_table), key);
                                        zend_string_release(key);
                                        if (!parent) continue;
-#ifdef ZEND_WIN32
-                                       /* On Windows we can't link with internal class, because of ASLR */
-                                       if (parent->type == ZEND_INTERNAL_CLASS) continue;
-#endif
                                        if (!(parent->ce_flags & ZEND_ACC_CONSTANTS_UPDATED)) {
                                                continue;
                                        }
@@ -3686,13 +3668,6 @@ static void preload_link(void)
                                                        found = 0;
                                                        break;
                                                }
-#ifdef ZEND_WIN32
-                                               /* On Windows we can't link with internal class, because of ASLR */
-                                               if (p->type == ZEND_INTERNAL_CLASS) {
-                                                       found = 0;
-                                                       break;
-                                               }
-#endif
                                                if (!(p->ce_flags & ZEND_ACC_CONSTANTS_UPDATED)) {
                                                        found = 0;
                                                        break;
@@ -3709,13 +3684,6 @@ static void preload_link(void)
                                                        found = 0;
                                                        break;
                                                }
-#ifdef ZEND_WIN32
-                                               /* On Windows we can't link with internal class, because of ASLR */
-                                               if (p->type == ZEND_INTERNAL_CLASS) {
-                                                       found = 0;
-                                                       break;
-                                               }
-#endif
                                        }
                                        if (!found) continue;
                                }
@@ -3859,26 +3827,6 @@ static void preload_link(void)
        } ZEND_HASH_FOREACH_END();
 }
 
-#ifdef ZEND_WIN32
-static void preload_check_windows_restriction(zend_class_entry *scope, zend_class_entry *ce) {
-       if (ce && ce->type == ZEND_INTERNAL_CLASS) {
-               zend_error_noreturn(E_ERROR,
-                       "Class %s uses internal class %s during preloading, which is not supported on Windows",
-                       ZSTR_VAL(scope->name), ZSTR_VAL(ce->name));
-       }
-}
-
-static void preload_check_windows_restrictions(zend_class_entry *scope) {
-       uint32_t i;
-
-       preload_check_windows_restriction(scope, scope->parent);
-
-       for (i = 0; i < scope->num_interfaces; i++) {
-               preload_check_windows_restriction(scope, scope->interfaces[i]);
-       }
-}
-#endif
-
 static inline int preload_update_class_constants(zend_class_entry *ce) {
        /* This is a separate function to work around what appears to be a bug in GCC
         * maybe-uninitialized analysis. */
@@ -3931,10 +3879,6 @@ static void preload_ensure_classes_loadable() {
                                continue;
                        }
 
-#ifdef ZEND_WIN32
-                       preload_check_windows_restrictions(ce);
-#endif
-
                        if (!(ce->ce_flags & ZEND_ACC_CONSTANTS_UPDATED)) {
                                if (preload_update_class_constants(ce) == FAILURE) {
                                        zend_error_noreturn(E_ERROR,
@@ -4601,9 +4545,11 @@ static int accel_finish_startup(void)
        }
 
        if (ZCG(accel_directives).preload && *ZCG(accel_directives).preload) {
-#ifndef ZEND_WIN32
+#ifdef ZEND_WIN32
+               zend_accel_error(ACCEL_LOG_ERROR, "Preloading is not supported on Windows");
+               return FAILURE;
+#else
                int in_child = 0;
-#endif
                int ret = SUCCESS;
                int rc;
                int orig_error_reporting;
@@ -4637,7 +4583,6 @@ static int accel_finish_startup(void)
                        return SUCCESS;
                }
 
-#ifndef ZEND_WIN32
                if (geteuid() == 0) {
                        pid_t pid;
                        struct passwd *pw;
@@ -4701,7 +4646,6 @@ static int accel_finish_startup(void)
                                zend_accel_error(ACCEL_LOG_WARNING, "\"opcache.preload_user\" is ignored");
                        }
                }
-#endif
 
                sapi_module.activate = NULL;
                sapi_module.deactivate = NULL;
@@ -4713,11 +4657,9 @@ static int accel_finish_startup(void)
                sapi_module.ub_write = preload_ub_write;
                sapi_module.flush = preload_flush;
 
-#ifndef ZEND_WIN32
                if (in_child) {
                        CG(compiler_options) |= ZEND_COMPILE_PRELOAD_IN_CHILD;
                }
-#endif
                CG(compiler_options) |= ZEND_COMPILE_PRELOAD;
                CG(compiler_options) |= ZEND_COMPILE_HANDLE_OP_ARRAY;
                CG(compiler_options) |= ZEND_COMPILE_IGNORE_INTERNAL_CLASSES;
@@ -4792,7 +4734,6 @@ static int accel_finish_startup(void)
 
                sapi_activate();
 
-#ifndef ZEND_WIN32
                if (in_child) {
                        if (ret == SUCCESS) {
                                exit(0);
@@ -4800,9 +4741,9 @@ static int accel_finish_startup(void)
                                exit(2);
                        }
                }
-#endif
 
                return ret;
+#endif
        }
 
        return SUCCESS;
index 14f205e7b890e121935a70e3164517083e877aea..47ec05977c9ce1c6b85267d3f50115e73b6981fa 100644 (file)
@@ -6,7 +6,10 @@ opcache.enable_cli=1
 opcache.optimization_level=-1
 opcache.preload={PWD}/preload_bug78014.inc
 --SKIPIF--
-<?php require_once('skipif.inc'); ?>
+<?php
+require_once('skipif.inc');
+if (PHP_OS_FAMILY == 'Windows') die('skip Preloading is not supported on Windows');
+?>
 --FILE--
 <?php
 class B extends A {
index eb513e3f01706b5f9a7335e336fb6ce24b6f0cb5..b477e04fe654d55ae51cdae5a6dd6da342898517 100644 (file)
@@ -6,7 +6,10 @@ opcache.enable_cli=1
 opcache.optimization_level=-1
 opcache.preload={PWD}/preload_bug78175.inc
 --SKIPIF--
-<?php require_once('skipif.inc'); ?>
+<?php
+require_once('skipif.inc');
+if (PHP_OS_FAMILY == 'Windows') die('skip Preloading is not supported on Windows');
+?>
 --FILE--
 OK
 --EXPECT--
index 1d736f6e106e340daea01ab27e900dc45df5a282..7b5ad850ae2ccb467ada1aef66feac227d2cc2c2 100644 (file)
@@ -6,7 +6,10 @@ opcache.enable_cli=1
 opcache.optimization_level=-1
 opcache.preload={PWD}/preload_bug78175_2.inc
 --SKIPIF--
-<?php require_once('skipif.inc'); ?>
+<?php
+require_once('skipif.inc');
+if (PHP_OS_FAMILY == 'Windows') die('skip Preloading is not supported on Windows');
+?>
 --FILE--
 <?php
 var_dump(get_class(Loader::getLoader()));
index efc69c927e41cc08ebec5cc174f30d9eb015d363..5a8ed8b15a1dbf1a588ca4d79ce4f5860c71a269 100644 (file)
@@ -6,10 +6,13 @@ opcache.enable_cli=1
 opcache.optimization_level=-1
 opcache.preload={PWD}/preload_bug78376.inc
 --SKIPIF--
-<?php require_once('skipif.inc'); ?>
+<?php
+require_once('skipif.inc');
+if (PHP_OS_FAMILY == 'Windows') die('skip Preloading is not supported on Windows');
+?>
 --FILE--
 <?php
 var_dump(\A::$a);
 ?>
 --EXPECT--
-string(4) "aaaa"
\ No newline at end of file
+string(4) "aaaa"
index 1125ad4eb0436fb811c6551869eaf5108ec769b2..bc285f107b98d504381b0aab281ddb723b237926 100644 (file)
@@ -6,7 +6,10 @@ opcache.enable_cli=1
 opcache.optimization_level=-1
 opcache.preload={PWD}/preload_bug78937.inc
 --SKIPIF--
-<?php require_once('skipif.inc'); ?>
+<?php
+require_once('skipif.inc');
+if (PHP_OS_FAMILY == 'Windows') die('skip Preloading is not supported on Windows');
+?>
 --FILE--
 <?php
 class Bar {
index 880063298bf66eeec4b7d42cc0d1615f1f58fd93..a20c07d231e3f8e19b07157452184f1cccb1ae42 100644 (file)
@@ -6,7 +6,10 @@ opcache.enable_cli=1
 opcache.optimization_level=-1
 opcache.preload={PWD}/preload_bug78937.inc
 --SKIPIF--
-<?php require_once('skipif.inc'); ?>
+<?php
+require_once('skipif.inc');
+if (PHP_OS_FAMILY == 'Windows') die('skip Preloading is not supported on Windows');
+?>
 --FILE--
 <?php
 include(__DIR__ . "/preload_bug78937.inc");
@@ -19,4 +22,4 @@ Warning: Can't preload unlinked class Foo: Unknown parent Bar in %spreload_bug78
 
 Warning: Can't preload unlinked class class@anonymous: Unknown parent Bar in %spreload_bug78937.inc on line 3
 object(class@anonymous)#%d (0) {
-}
\ No newline at end of file
+}
index 1c706e237dc7ae7580e547e150bd9ca95ea3eb36..16f7b80a4035f1b5cd691b68888eab8810b043bb 100644 (file)
@@ -6,7 +6,10 @@ opcache.enable_cli=1
 opcache.optimization_level=-1
 opcache.preload={PWD}/preload_bug78937.inc
 --SKIPIF--
-<?php require_once('skipif.inc'); ?>
+<?php
+require_once('skipif.inc');
+if (PHP_OS_FAMILY == 'Windows') die('skip Preloading is not supported on Windows');
+?>
 --FILE--
 <?php
 include(__DIR__ . "/preload_bug78937.inc");
index b555516d008660157324e40069bb673e8f6d5174..2ad86870de85bf9425eb2a547f28637ec1b66f63 100644 (file)
@@ -6,7 +6,10 @@ opcache.enable_cli=1
 opcache.optimization_level=-1
 opcache.preload={PWD}/preload_bug78937.inc
 --SKIPIF--
-<?php require_once('skipif.inc'); ?>
+<?php
+require_once('skipif.inc');
+if (PHP_OS_FAMILY == 'Windows') die('skip Preloading is not supported on Windows');
+?>
 --FILE--
 <?php
 class Bar {
@@ -19,4 +22,4 @@ Warning: Can't preload unlinked class Foo: Unknown parent Bar in %spreload_bug78
 
 Warning: Can't preload unlinked class class@anonymous: Unknown parent Bar in %spreload_bug78937.inc on line 3
 
-Fatal error: Class foo wasn't preloaded in %spreload_bug78937.inc on line 6
\ No newline at end of file
+Fatal error: Class foo wasn't preloaded in %spreload_bug78937.inc on line 6
index f9f01a2a261810a41b18a7b391a3a86580df9130..3502699750e39cf9e4ff5b2b522a043343aee0dc 100644 (file)
@@ -6,7 +6,10 @@ opcache.enable_cli=1
 opcache.optimization_level=-1
 opcache.preload={PWD}/preload_bug78937.inc
 --SKIPIF--
-<?php require_once('skipif.inc'); ?>
+<?php
+require_once('skipif.inc');
+if (PHP_OS_FAMILY == 'Windows') die('skip Preloading is not supported on Windows');
+?>
 --FILE--
 <?php
 include(__DIR__ . "/preload_bug78937.inc");
@@ -20,4 +23,4 @@ Warning: Can't preload unlinked class Foo: Unknown parent Bar in %spreload_bug78
 
 Warning: Can't preload unlinked class class@anonymous: Unknown parent Bar in %spreload_bug78937.inc on line 3
 object(Foo)#%d (0) {
-}
\ No newline at end of file
+}
index 28dcb0ce53831d18422b36733e82863145f0c17c..ec1cc2d2772a52c147877d0cfc6814bc819ecb7f 100644 (file)
@@ -6,7 +6,10 @@ opcache.enable_cli=1
 opcache.optimization_level=-1
 opcache.preload={PWD}/preload_bug78937.inc
 --SKIPIF--
-<?php require_once('skipif.inc'); ?>
+<?php
+require_once('skipif.inc');
+if (PHP_OS_FAMILY == 'Windows') die('skip Preloading is not supported on Windows');
+?>
 --FILE--
 <?php
 include(__DIR__ . "/preload_bug78937.inc");
index 8b1fa1ff31cab101c7890e49911c7277e3f30008..56ed196e99e96dce7aeceefbe80e0dd0f3b798a5 100644 (file)
@@ -6,7 +6,10 @@ opcache.enable_cli=1
 opcache.optimization_level=-1
 opcache.preload={PWD}/preload.inc
 --SKIPIF--
-<?php require_once('skipif.inc'); ?>
+<?php
+require_once('skipif.inc');
+if (PHP_OS_FAMILY == 'Windows') die('skip Preloading is not supported on Windows');
+?>
 --FILE--
 <?php
 var_dump(function_exists("f1"));
index 18fe56d4ba4238ac4ec2b815c79f637525ee2d19..0115ff05649923b2730a1cbbb85cfb87654c868e 100644 (file)
@@ -6,7 +6,10 @@ opcache.enable_cli=1
 opcache.optimization_level=-1
 opcache.preload={PWD}/preload.inc
 --SKIPIF--
-<?php require_once('skipif.inc'); ?>
+<?php
+require_once('skipif.inc');
+if (PHP_OS_FAMILY == 'Windows') die('skip Preloading is not supported on Windows');
+?>
 --FILE--
 <?php
 var_dump((new ReflectionMethod('x', 'foo'))->getPrototype()->class);
index b8083879670abb38f78d0ea9eda3063211adb72a..9ecec31aaed37930680125efdd6c6f14a0079fd1 100644 (file)
@@ -6,7 +6,10 @@ opcache.enable_cli=1
 opcache.optimization_level=-1
 opcache.preload={PWD}/preload.inc
 --SKIPIF--
-<?php require_once('skipif.inc'); ?>
+<?php
+require_once('skipif.inc');
+if (PHP_OS_FAMILY == 'Windows') die('skip Preloading is not supported on Windows');
+?>
 --FILE--
 <?php
 Y::foo();
index 7242d071cb10be48e77c80b21da109193984e754..be83c45369a1603f56e64616678cb51d81ae776e 100644 (file)
@@ -6,7 +6,10 @@ opcache.enable_cli=1
 opcache.optimization_level=-1
 opcache.preload={PWD}/preload_undef_const.inc
 --SKIPIF--
-<?php require_once('skipif.inc'); ?>
+<?php
+require_once('skipif.inc');
+if (PHP_OS_FAMILY == 'Windows') die('skip Preloading is not supported on Windows');
+?>
 --FILE--
 <?php
 var_dump(class_exists('Foo'));
index 1bcfae4d79971f5eae88dfb0c3e172d235b96de9..67e44610bc6563fbdcbae40dd25fe216679c49f8 100644 (file)
@@ -6,7 +6,10 @@ opcache.enable_cli=1
 opcache.optimization_level=-1
 opcache.preload={PWD}/preload_globals.inc
 --SKIPIF--
-<?php require_once('skipif.inc'); ?>
+<?php
+require_once('skipif.inc');
+if (PHP_OS_FAMILY == 'Windows') die('skip Preloading is not supported on Windows');
+?>
 --FILE--
 <?php
 $x = 123;
index b597d8eff8afca7da03e940646a2ecc0a44a6b11..76d962977460c9f4af81e2d6af7e00714f42cbe6 100644 (file)
@@ -8,6 +8,7 @@ opcache.preload={PWD}/preload_inheritance_error_ind.inc
 --SKIPIF--
 <?php
 require_once('skipif.inc');
+if (PHP_OS_FAMILY == 'Windows') die('skip Preloading is not supported on Windows');
 if (getenv('SKIP_ASAN')) die('xfail Startup failure leak');
 ?>
 --FILE--
index 2054cd8740d731d636344465bddaec424ff2f9ce..79c2a6737a4de20c818f69ace79f92350e535132 100644 (file)
@@ -6,7 +6,10 @@ opcache.enable_cli=1
 opcache.optimization_level=-1
 opcache.preload={PWD}/preload_include.inc
 --SKIPIF--
-<?php require_once('skipif.inc'); ?>
+<?php
+require_once('skipif.inc');
+if (PHP_OS_FAMILY == 'Windows') die('skip Preloading is not supported on Windows');
+?>
 --FILE--
 <?php
 echo "Foobar";
index 2e630be9a0598444969735fb67420a49a589d7bc..8d7b42cab5bafbdbe82cd87cc7a04f980ec5ac18 100644 (file)
@@ -6,7 +6,10 @@ opcache.enable_cli=1
 opcache.optimization_level=-1
 opcache.preload={PWD}/preload.inc
 --SKIPIF--
-<?php require_once('skipif.inc'); ?>
+<?php
+require_once('skipif.inc');
+if (PHP_OS_FAMILY == 'Windows') die('skip Preloading is not supported on Windows');
+?>
 --FILE--
 <?php
 var_dump(get_anon());
index 1adbf5b00649f53b4640575a4c1e07081fd3ae74..f3a28675e3453115fed905adadbe23bf50cd88db 100644 (file)
@@ -6,7 +6,10 @@ opcache.enable_cli=1
 opcache.optimization_level=-1
 opcache.preload={PWD}/preload_undef_const_2.inc
 --SKIPIF--
-<?php require_once('skipif.inc'); ?>
+<?php
+require_once('skipif.inc');
+if (PHP_OS_FAMILY == 'Windows') die('skip Preloading is not supported on Windows');
+?>
 --FILE--
 <?php
 var_dump(trait_exists('T'));
index 80967f64a6978b10b79789bceed754cb7200cec2..4e5121f23c73d736ce18163acf01f1c66232b340 100644 (file)
@@ -6,7 +6,10 @@ opcache.enable_cli=1
 opcache.optimization_level=-1
 opcache.preload={PWD}/preload_overwritten_prop_init.inc
 --SKIPIF--
-<?php require_once('skipif.inc'); ?>
+<?php
+require_once('skipif.inc');
+if (PHP_OS_FAMILY == 'Windows') die('skip Preloading is not supported on Windows');
+?>
 --FILE--
 <?php
 var_dump((new Bar)->prop);
index 32863398a952f2fefb48678f6210162e85e8eef5..59be0493b48b4a16d1309df29e169f82bc893ed5 100644 (file)
@@ -6,7 +6,10 @@ opcache.enable_cli=1
 opcache.optimization_level=-1
 opcache.preload={PWD}/preload_variance_ind.inc
 --SKIPIF--
-<?php require_once('skipif.inc'); ?>
+<?php
+require_once('skipif.inc');
+if (PHP_OS_FAMILY == 'Windows') die('skip Preloading is not supported on Windows');
+?>
 --FILE--
 <?php
 interface K {}
index 0883064ff4525c27a0a0501998857f4f87ba68fc..bd3fd81bbd7b0cd8edaf02d5025992fd76ada447 100644 (file)
@@ -6,7 +6,10 @@ opcache.enable_cli=1
 opcache.optimization_level=-1
 opcache.preload={PWD}/preload_const_autoload.inc
 --SKIPIF--
-<?php require_once('skipif.inc'); ?>
+<?php
+require_once('skipif.inc');
+if (PHP_OS_FAMILY == 'Windows') die('skip Preloading is not supported on Windows');
+?>
 --FILE--
 ===DONE===
 --EXPECTF--
index f6387c08e1238d307ba99b82a51cb832be9dfcf6..925a1fc5ef9a90866c76c3e807a2c89a6cc49afb 100644 (file)
@@ -7,7 +7,10 @@ opcache.optimization_level=-1
 opcache.preload={PWD}/preload_nested_function.inc
 opcache.interned_strings_buffer=0
 --SKIPIF--
-<?php require_once('skipif.inc'); ?>
+<?php
+require_once('skipif.inc');
+if (PHP_OS_FAMILY == 'Windows') die('skip Preloading is not supported on Windows');
+?>
 --FILE--
 <?php
 test();
index aee94426d0dba541c924b0bb84a84d7f598717e5..3c615c409ac68630fc5541fe0b0d835dec83f295 100644 (file)
@@ -6,7 +6,10 @@ opcache.enable_cli=1
 opcache.optimization_level=-1
 opcache.preload={PWD}/preload_class_alias.inc
 --SKIPIF--
-<?php require_once('skipif.inc'); ?>
+<?php
+require_once('skipif.inc');
+if (PHP_OS_FAMILY == 'Windows') die('skip Preloading is not supported on Windows');
+?>
 --FILE--
 <?php
 var_dump(class_exists('A'));
index 6dc2c21a8a24b4df45bba2b6f194ce62ff6bc948..82167afa9b317236097a0134033e1aad7532e907 100644 (file)
@@ -6,7 +6,10 @@ opcache.enable_cli=1
 opcache.optimization_level=-1
 opcache.preload={PWD}/preload_class_alias_2.inc
 --SKIPIF--
-<?php require_once('skipif.inc'); ?>
+<?php
+require_once('skipif.inc');
+if (PHP_OS_FAMILY == 'Windows') die('skip Preloading is not supported on Windows');
+?>
 --FILE--
 <?php
 var_dump(class_exists('B'));
index 8673814403357f1c744387accec7f85871e2b9f9..c89633343cd838728589a2bbf48e80fe11039ac2 100644 (file)
@@ -6,7 +6,10 @@ opcache.enable_cli=1
 opcache.optimization_level=-1
 opcache.preload={PWD}/preload_loadable_classes_1.inc
 --SKIPIF--
-<?php require_once('skipif.inc'); ?>
+<?php
+require_once('skipif.inc');
+if (PHP_OS_FAMILY == 'Windows') die('skip Preloading is not supported on Windows');
+?>
 --FILE--
 <?php
 var_dump(class_exists('Test'));
index fc3fb1dc40ab7e227eaf7965472bca94b1055696..d561837bd0c4753d5c3625cc524b64f0c2ce821c 100644 (file)
@@ -6,7 +6,10 @@ opcache.enable_cli=1
 opcache.optimization_level=-1
 opcache.preload={PWD}/preload_loadable_classes_2.inc
 --SKIPIF--
-<?php require_once('skipif.inc'); ?>
+<?php
+require_once('skipif.inc');
+if (PHP_OS_FAMILY == 'Windows') die('skip Preloading is not supported on Windows');
+?>
 --FILE--
 Unreachable
 --EXPECTF--
index a48692960a68308d780a60d5c001c29b77b09c24..78efb1680469cbe2b601bcea12c16c9a4b01cfb8 100644 (file)
@@ -6,7 +6,10 @@ opcache.enable_cli=1
 opcache.optimization_level=-1
 opcache.preload={PWD}/preload_loadable_classes_3.inc
 --SKIPIF--
-<?php require_once('skipif.inc'); ?>
+<?php
+require_once('skipif.inc');
+if (PHP_OS_FAMILY == 'Windows') die('skip Preloading is not supported on Windows');
+?>
 --FILE--
 Unreachable
 --EXPECTF--
diff --git a/ext/opcache/tests/preload_loadable_classes_4.inc b/ext/opcache/tests/preload_loadable_classes_4.inc
deleted file mode 100644 (file)
index 162de6e..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-<?php
-
-class Test extends Exception {}
diff --git a/ext/opcache/tests/preload_loadable_classes_4.phpt b/ext/opcache/tests/preload_loadable_classes_4.phpt
deleted file mode 100644 (file)
index 07f0d09..0000000
+++ /dev/null
@@ -1,16 +0,0 @@
---TEST--
-Preloading: Loadable class checking (4)
---INI--
-opcache.enable=1
-opcache.enable_cli=1
-opcache.optimization_level=-1
-opcache.preload={PWD}/preload_loadable_classes_4.inc
---SKIPIF--
-<?php
-require_once('skipif.inc');
-if (PHP_OS_FAMILY != 'Windows') die('skip Windows only');
-?>
---FILE--
-Unreachable
---EXPECTF--
-Fatal error: Class Test uses internal class Exception during preloading, which is not supported on Windows in Unknown on line 0
index 55e3a2cd8a4fe38bf0ee51eb9b10ada663d87949..c767ad6a9b36a67e09d0669945dc3ad4cbff6af6 100644 (file)
@@ -6,7 +6,10 @@ opcache.enable_cli=1
 opcache.optimization_level=-1
 opcache.preload={PWD}/preload_trait_static.inc
 --SKIPIF--
-<?php require_once('skipif.inc'); ?>
+<?php
+require_once('skipif.inc');
+if (PHP_OS_FAMILY == 'Windows') die('skip Preloading is not supported on Windows');
+?>
 --FILE--
 <?php
 $bar = new Bar;
index 117f36692a527a9261c815cd64540fd7dda3c89a..3e2accd19ecdc128c00d2d964d6dfeed1462a93c 100644 (file)
@@ -6,7 +6,10 @@ opcache.enable_cli=1
 opcache.optimization_level=-1
 opcache.preload={PWD}/preload_unresolved_prop_type.inc
 --SKIPIF--
-<?php require_once('skipif.inc'); ?>
+<?php
+require_once('skipif.inc');
+if (PHP_OS_FAMILY == 'Windows') die('skip Preloading is not supported on Windows');
+?>
 --FILE--
 ===DONE===
 --EXPECTF--
diff --git a/ext/opcache/tests/preload_windows.phpt b/ext/opcache/tests/preload_windows.phpt
new file mode 100644 (file)
index 0000000..0414cfa
--- /dev/null
@@ -0,0 +1,16 @@
+--TEST--
+Preloading is not supported on Windows
+--INI--
+opcache.enable=1
+opcache.enable_cli=1
+opcache.optimization_level=-1
+opcache.preload={PWD}/preload.inc
+--SKIPIF--
+<?php
+require_once('skipif.inc');
+if (PHP_OS_FAMILY != 'Windows') die('skip Windows only test');
+?>
+--FILE--
+Unreachable
+--EXPECTF--
+%s: Error Preloading is not supported on Windows