?? ??? ????, 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).
+++ /dev/null
---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!
--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
*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);
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;
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;
}
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;
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;
}
} 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. */
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,
}
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;
return SUCCESS;
}
-#ifndef ZEND_WIN32
if (geteuid() == 0) {
pid_t pid;
struct passwd *pw;
zend_accel_error(ACCEL_LOG_WARNING, "\"opcache.preload_user\" is ignored");
}
}
-#endif
sapi_module.activate = NULL;
sapi_module.deactivate = NULL;
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;
sapi_activate();
-#ifndef ZEND_WIN32
if (in_child) {
if (ret == SUCCESS) {
exit(0);
exit(2);
}
}
-#endif
return ret;
+#endif
}
return SUCCESS;
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 {
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--
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()));
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"
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 {
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");
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
+}
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");
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 {
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
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");
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
+}
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");
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"));
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);
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();
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'));
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;
--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--
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";
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());
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'));
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);
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 {}
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--
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();
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'));
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'));
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'));
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--
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--
+++ /dev/null
-<?php
-
-class Test extends Exception {}
+++ /dev/null
---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
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;
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--
--- /dev/null
+--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