Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,6 @@ opcache.preload={PWD}/opcache_validator_errors.inc
opcache.file_cache_only=0
--EXTENSIONS--
opcache
--SKIPIF--
<?php
if (PHP_OS_FAMILY == 'Windows') die('skip Preloading is not supported on Windows');
?>
--FILE--
<?php
$r = new ReflectionClass('DemoTrait');
Expand Down
1 change: 0 additions & 1 deletion ext/ffi/tests/bug78761.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ ffi
posix
--SKIPIF--
<?php
if (PHP_OS_FAMILY == 'Windows') die('skip Preloading is not supported on Windows');
if (posix_geteuid() == 0) die('skip Cannot run test as root.');
?>
--INI--
Expand Down
27 changes: 6 additions & 21 deletions ext/opcache/ZendAccelerator.c
Original file line number Diff line number Diff line change
Expand Up @@ -139,15 +139,9 @@ static zend_result (*orig_post_startup_cb)(void);
static zend_result accel_post_startup(void);
static zend_result accel_finish_startup(void);

#ifndef ZEND_WIN32
# define PRELOAD_SUPPORT
#endif

#ifdef PRELOAD_SUPPORT
static void preload_shutdown(void);
static void preload_activate(void);
static void preload_restart(void);
#endif

#ifdef ZEND_WIN32
# define INCREMENT(v) InterlockedIncrement64(&ZCSG(v))
Expand Down Expand Up @@ -2731,11 +2725,9 @@ ZEND_RINIT_FUNCTION(zend_accelerator)
}

zend_shared_alloc_restore_state();
#ifdef PRELOAD_SUPPORT
if (ZCSG(preload_script)) {
preload_restart();
}
#endif

#ifdef HAVE_JIT
zend_jit_restart();
Expand Down Expand Up @@ -2777,11 +2769,9 @@ ZEND_RINIT_FUNCTION(zend_accelerator)
zend_jit_activate();
#endif

#ifdef PRELOAD_SUPPORT
if (ZCSG(preload_script)) {
preload_activate();
}
#endif

return SUCCESS;
}
Expand Down Expand Up @@ -3482,11 +3472,9 @@ void accel_shutdown(void)
return;
}

#ifdef PRELOAD_SUPPORT
if (ZCSG(preload_script)) {
preload_shutdown();
}
#endif

_file_cache_only = file_cache_only;

Expand Down Expand Up @@ -3599,7 +3587,6 @@ void accelerator_shm_read_unlock(void)
}

/* Preloading */
#ifdef PRELOAD_SUPPORT
static HashTable *preload_scripts = NULL;
static zend_op_array *(*preload_orig_compile_file)(zend_file_handle *file_handle, int type);

Expand Down Expand Up @@ -4972,6 +4959,7 @@ static zend_result accel_finish_startup_preload(bool in_child)
return ret;
}

#ifndef ZEND_WIN32
static zend_result accel_finish_startup_preload_subprocess(pid_t *pid)
{
uid_t euid = geteuid();
Expand Down Expand Up @@ -5038,7 +5026,7 @@ static zend_result accel_finish_startup_preload_subprocess(pid_t *pid)

return SUCCESS;
}
#endif /* ZEND_WIN32 */
#endif /* !ZEND_WIN32 */

static zend_result accel_finish_startup(void)
{
Expand All @@ -5050,11 +5038,6 @@ static zend_result accel_finish_startup(void)
return SUCCESS;
}

#ifdef ZEND_WIN32
zend_accel_error_noreturn(ACCEL_LOG_ERROR, "Preloading is not supported on Windows");
return FAILURE;
#else /* ZEND_WIN32 */

Comment on lines -5053 to -5057
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't you check for a "good" SAPI and/or disable "attaching" for "bad" ones?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

8ba10b8 disables reattachment in all SAPIs when ASLR is enabled

if (UNEXPECTED(file_cache_only)) {
zend_accel_error(ACCEL_LOG_WARNING, "Preloading doesn't work in \"file_cache_only\" mode");
return SUCCESS;
Expand All @@ -5070,7 +5053,9 @@ static zend_result accel_finish_startup(void)
return SUCCESS;
}


#ifdef ZEND_WIN32
return accel_finish_startup_preload(false);
#else
pid_t pid;
if (accel_finish_startup_preload_subprocess(&pid) == FAILURE) {
zend_shared_alloc_unlock();
Expand Down Expand Up @@ -5104,7 +5089,7 @@ static zend_result accel_finish_startup(void)
return FAILURE;
}
}
#endif /* ZEND_WIN32 */
#endif /* !ZEND_WIN32 */
}

static void accel_activate(void) {
Expand Down
4 changes: 0 additions & 4 deletions ext/opcache/tests/api/opcache_preloading_001.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,6 @@ zend_test
opcache.enable=1
opcache.enable_cli=1
opcache.preload={PWD}/opcache_preloading.inc
--SKIPIF--
<?php
if (PHP_OS_FAMILY == 'Windows') die('skip Preloading is not supported on Windows');
?>
--FILE--
<?php

Expand Down
2 changes: 1 addition & 1 deletion ext/opcache/tests/api/opcache_preloading_002.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ posix
zend_test
--SKIPIF--
<?php
if (PHP_OS_FAMILY == 'Windows') die('skip Preloading is not supported on Windows');
if (PHP_OS_FAMILY == 'Windows') die('skip opcache.preload_user is not supported on Windows');
if (posix_geteuid() !== 0) die('skip Test needs root user');
?>
--FILE--
Expand Down
4 changes: 0 additions & 4 deletions ext/opcache/tests/bug78014.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,6 @@ opcache.optimization_level=-1
opcache.preload={PWD}/preload_bug78014.inc
--EXTENSIONS--
opcache
--SKIPIF--
<?php
if (PHP_OS_FAMILY == 'Windows') die('skip Preloading is not supported on Windows');
?>
--FILE--
<?php
$c = new C;
Expand Down
4 changes: 0 additions & 4 deletions ext/opcache/tests/bug78175.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,6 @@ opcache.optimization_level=-1
opcache.preload={PWD}/preload_bug78175.inc
--EXTENSIONS--
opcache
--SKIPIF--
<?php
if (PHP_OS_FAMILY == 'Windows') die('skip Preloading is not supported on Windows');
?>
--FILE--
OK
--EXPECT--
Expand Down
4 changes: 0 additions & 4 deletions ext/opcache/tests/bug78175_2.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,6 @@ opcache.optimization_level=-1
opcache.preload={PWD}/preload_bug78175_2.inc
--EXTENSIONS--
opcache
--SKIPIF--
<?php
if (PHP_OS_FAMILY == 'Windows') die('skip Preloading is not supported on Windows');
?>
--FILE--
<?php
var_dump(get_class(Loader::getLoader()));
Expand Down
4 changes: 0 additions & 4 deletions ext/opcache/tests/bug78376.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,6 @@ opcache.optimization_level=-1
opcache.preload={PWD}/preload_bug78376.inc
--EXTENSIONS--
opcache
--SKIPIF--
<?php
if (PHP_OS_FAMILY == 'Windows') die('skip Preloading is not supported on Windows');
?>
--FILE--
<?php
const CNST = 'bbbb';
Expand Down
4 changes: 0 additions & 4 deletions ext/opcache/tests/bug78937_1.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,6 @@ opcache.optimization_level=-1
opcache.preload={PWD}/preload_bug78937.inc
--EXTENSIONS--
opcache
--SKIPIF--
<?php
if (PHP_OS_FAMILY == 'Windows') die('skip Preloading is not supported on Windows');
?>
--FILE--
<?php
class Bar {
Expand Down
4 changes: 0 additions & 4 deletions ext/opcache/tests/bug78937_2.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,6 @@ opcache.optimization_level=-1
opcache.preload={PWD}/preload_bug78937.inc
--EXTENSIONS--
opcache
--SKIPIF--
<?php
if (PHP_OS_FAMILY == 'Windows') die('skip Preloading is not supported on Windows');
?>
--FILE--
<?php
include(__DIR__ . "/preload_bug78937.inc");
Expand Down
4 changes: 0 additions & 4 deletions ext/opcache/tests/bug78937_3.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,6 @@ opcache.optimization_level=-1
opcache.preload={PWD}/preload_bug78937.inc
--EXTENSIONS--
opcache
--SKIPIF--
<?php
if (PHP_OS_FAMILY == 'Windows') die('skip Preloading is not supported on Windows');
?>
--FILE--
<?php
include(__DIR__ . "/preload_bug78937.inc");
Expand Down
4 changes: 0 additions & 4 deletions ext/opcache/tests/bug78937_4.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,6 @@ opcache.optimization_level=-1
opcache.preload={PWD}/preload_bug78937.inc
--EXTENSIONS--
opcache
--SKIPIF--
<?php
if (PHP_OS_FAMILY == 'Windows') die('skip Preloading is not supported on Windows');
?>
--FILE--
<?php
class Bar {
Expand Down
4 changes: 0 additions & 4 deletions ext/opcache/tests/bug78937_5.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,6 @@ opcache.optimization_level=-1
opcache.preload={PWD}/preload_bug78937.inc
--EXTENSIONS--
opcache
--SKIPIF--
<?php
if (PHP_OS_FAMILY == 'Windows') die('skip Preloading is not supported on Windows');
?>
--FILE--
<?php
include(__DIR__ . "/preload_bug78937.inc");
Expand Down
4 changes: 0 additions & 4 deletions ext/opcache/tests/bug78937_6.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,6 @@ opcache.optimization_level=-1
opcache.preload={PWD}/preload_bug78937.inc
--EXTENSIONS--
opcache
--SKIPIF--
<?php
if (PHP_OS_FAMILY == 'Windows') die('skip Preloading is not supported on Windows');
?>
--FILE--
<?php
include(__DIR__ . "/preload_bug78937.inc");
Expand Down
2 changes: 1 addition & 1 deletion ext/opcache/tests/gh10405.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ opcache
posix
--SKIPIF--
<?php
if (PHP_OS_FAMILY == 'Windows') die('skip Preloading is not supported on Windows');
if (PHP_OS_FAMILY == 'Windows') die('skip opcache.preload_user is not supported on Windows');
if (posix_geteuid() !== 0) die('skip Test needs root user');
?>
--FILE--
Expand Down
4 changes: 0 additions & 4 deletions ext/opcache/tests/gh10914.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,6 @@ opcache.protect_memory=1
opcache.preload={PWD}/preload_gh10914.inc
--EXTENSIONS--
opcache
--SKIPIF--
<?php
if (PHP_OS_FAMILY == 'Windows') die('skip Preloading is not supported on Windows');
?>
--FILE--
<?php
$x = new ReflectionEnum(ExampleEnum::class);
Expand Down
4 changes: 0 additions & 4 deletions ext/opcache/tests/gh13433/gh13433.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,6 @@ opcache.optimization_level=0
opcache.preload={PWD}/preload.inc
--EXTENSIONS--
opcache
--SKIPIF--
<?php
if (PHP_OS_FAMILY == 'Windows') die('skip Preloading is not supported on Windows');
?>
--FILE--
<?php
$instance = new TheClass;
Expand Down
4 changes: 0 additions & 4 deletions ext/opcache/tests/gh15021.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,6 @@ opcache.enable_cli=1
opcache.preload={PWD}/gh15021_preload.inc
--EXTENSIONS--
opcache
--SKIPIF--
<?php
if (PHP_OS_FAMILY == 'Windows') die('skip Preloading is not supported on Windows');
?>
--FILE--
<?php
putenv('RUNTIME=1');
Expand Down
4 changes: 0 additions & 4 deletions ext/opcache/tests/gh16577.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,6 @@ opcache.optimization_level=-1
opcache.preload={PWD}/gh16577.inc
--EXTENSIONS--
opcache
--SKIPIF--
<?php
if (PHP_OS_FAMILY == 'Windows') die('skip Preloading is not supported on Windows');
?>
--FILE--
<?php
echo "Done\n";
Expand Down
4 changes: 0 additions & 4 deletions ext/opcache/tests/gh18567.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,6 @@ opcache.enable_cli=1
opcache.preload={PWD}/preload_gh18567.inc
--EXTENSIONS--
opcache
--SKIPIF--
<?php
if (PHP_OS_FAMILY == 'Windows') die('skip Preloading is not supported on Windows');
?>
--FILE--
<?php
abstract class Test implements MyStringable {
Expand Down
4 changes: 0 additions & 4 deletions ext/opcache/tests/gh18639.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,6 @@ opcache.jit_buffer_size=16M
opcache.preload={PWD}/preload_gh18567.inc
--EXTENSIONS--
opcache
--SKIPIF--
<?php
if (PHP_OS_FAMILY == 'Windows') die('skip Preloading is not supported on Windows');
?>
--FILE--
<?php
echo "ok\n";
Expand Down
4 changes: 0 additions & 4 deletions ext/opcache/tests/gh8133.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,6 @@ opcache.enable=1
opcache.enable_cli=1
opcache.optimization_level=-1
opcache.preload={PWD}/gh8133.inc
--SKIPIF--
<?php
if (PHP_OS_FAMILY == 'Windows') die('skip Preloading is not supported on Windows');
?>
--FILE--
<?php

Expand Down
4 changes: 0 additions & 4 deletions ext/opcache/tests/gh9968.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,6 @@ opcache.optimization_level=-1
opcache.preload={PWD}/gh9968-1.inc
--EXTENSIONS--
opcache
--SKIPIF--
<?php
if (PHP_OS_FAMILY == 'Windows') die('skip Preloading is not supported on Windows');
?>
--FILE--
<?php

Expand Down
4 changes: 0 additions & 4 deletions ext/opcache/tests/jit/bug80634.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,6 @@ opcache.jit=function
opcache.preload={PWD}/preload_bug80634.inc
--EXTENSIONS--
opcache
--SKIPIF--
<?php
if (PHP_OS_FAMILY == 'Windows') die('skip Preloading is not supported on Windows');
?>
--FILE--
<?php
$v = new SomeClass(5);
Expand Down
4 changes: 0 additions & 4 deletions ext/opcache/tests/jit/bug81256.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,6 @@
Bug #81256: Assertion `zv != ((void *)0)' failed for "preload" with JIT
--EXTENSIONS--
opcache
--SKIPIF--
<?php
if (PHP_OS_FAMILY === "Windows") die("skip Windows does not support preloading");
?>
--INI--
opcache.enable=1
opcache.enable_cli=1
Expand Down
4 changes: 0 additions & 4 deletions ext/opcache/tests/jit/gh14082.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,6 @@ opcache.jit_buffer_size=16M
opcache.preload={PWD}/preload_gh14082.inc
--EXTENSIONS--
opcache
--SKIPIF--
<?php
if (PHP_OS_FAMILY == 'Windows') die('skip Preloading is not supported on Windows');
?>
--FILE--
<?php
Foo::test();
Expand Down
4 changes: 0 additions & 4 deletions ext/opcache/tests/jit/gh15490.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,6 @@ opcache.enable_cli=1
opcache.file_update_protection=0
opcache.preload={PWD}/gh15490.inc
opcache.jit=1235
--SKIPIF--
<?php
if (PHP_OS_FAMILY == 'Windows') die('skip Preloading is not supported on Windows');
?>
--FILE--
<?php
foo();
Expand Down
Loading
Loading