@@ -141,8 +141,8 @@ func TestMain(m *testing.M) {
141141 slog .SetDefault (slog .New (slog .DiscardHandler ))
142142 }
143143
144- // setup custom environment var for TestWorkerHasOSEnvironmentVariableInSERVER
145- if os .Setenv ("CUSTOM_OS_ENV_VARIABLE" , "custom_env_variable_value" ) != nil {
144+ // setup custom environment var for TestWorkerHasOSEnvironmentVariableInSERVER and TestPhpIni
145+ if os .Setenv ("CUSTOM_OS_ENV_VARIABLE" , "custom_env_variable_value" ) != nil || os . Setenv ( "LITERAL_ZERO" , "0" ) != nil {
146146 fmt .Println ("Failed to set environment variable for tests" )
147147 os .Exit (1 )
148148 }
@@ -162,14 +162,12 @@ func testHelloWorld(t *testing.T, opts *testOptions) {
162162}
163163
164164func TestEnvVarsInPhpIni (t * testing.T ) {
165- t .Setenv ("OPCACHE_ENABLE" , "0" )
166-
167165 runTest (t , func (handler func (http.ResponseWriter , * http.Request ), _ * httptest.Server , _ int ) {
168166 body , _ := testGet ("http://example.com/ini.php?key=opcache.enable" , handler , t )
169167 assert .Equal (t , "opcache.enable:0" , body )
170168 }, & testOptions {
171169 phpIni : map [string ]string {
172- "opcache.enable" : "${OPCACHE_ENABLE }" ,
170+ "opcache.enable" : "${LITERAL_ZERO }" ,
173171 },
174172 })
175173}
@@ -1305,20 +1303,26 @@ func TestSessionNoLeakAfterExit_worker(t *testing.T) {
13051303}
13061304
13071305func TestOpcachePreload_module (t * testing.T ) {
1308- testOpcachePreload (t , & testOptions {env : map [string ]string {"TEST" : "123" }})
1306+ testOpcachePreload (t , & testOptions {env : map [string ]string {"TEST" : "123" }, realServer : true })
13091307}
13101308
13111309func TestOpcachePreload_worker (t * testing.T ) {
1312- testOpcachePreload (t , & testOptions {workerScript : "preload-check.php" , nbWorkers : 1 , nbParallelRequests : 1 , env : map [string ]string {"TEST" : "123" }})
1310+ testOpcachePreload (t , & testOptions {workerScript : "preload-check.php" , env : map [string ]string {"TEST" : "123" }, realServer : true })
13131311}
13141312
13151313func testOpcachePreload (t * testing.T , opts * testOptions ) {
1314+ if frankenphp .Version ().VersionID <= 80300 {
1315+ t .Skip ("This test is only supported in PHP 8.3 and above" )
1316+ return
1317+ }
1318+
13161319 cwd , _ := os .Getwd ()
13171320 preloadScript := cwd + "/testdata/preload.php"
13181321
13191322 u , err := user .Current ()
13201323 require .NoError (t , err )
13211324
1325+ // use opcache.log_verbosity_level:4 for debugging
13221326 opts .phpIni = map [string ]string {
13231327 "opcache.enable" : "1" ,
13241328 "opcache.preload" : preloadScript ,
0 commit comments