Skip to content

Commit 66322f8

Browse files
committed
add test
1 parent 8e3f5c2 commit 66322f8

File tree

3 files changed

+6
-1
lines changed

3 files changed

+6
-1
lines changed

frankenphp_test.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -649,6 +649,8 @@ func TestEnvWorker(t *testing.T) {
649649
testEnv(t, &testOptions{workerScript: "test-env.php"})
650650
}
651651
func testEnv(t *testing.T, opts *testOptions) {
652+
assert.NoError(t, os.Setenv("EMPTY", ""))
653+
652654
runTest(t, func(handler func(http.ResponseWriter, *http.Request), _ *httptest.Server, i int) {
653655
req := httptest.NewRequest("GET", fmt.Sprintf("http://example.com/test-env.php?var=%d", i), nil)
654656
w := httptest.NewRecorder()

phpthread.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ func newPHPThread(threadIndex int) *phpThread {
4141
}
4242

4343
// change the thread handler safely
44-
// must be called from outside of the PHP thread
44+
// must be called from outside the PHP thread
4545
func (thread *phpThread) setHandler(handler threadHandler) {
4646
logger.Debug("setHandler")
4747
thread.handlerMu.Lock()
@@ -79,6 +79,7 @@ func (thread *phpThread) pinString(s string) *C.char {
7979

8080
sData := unsafe.StringData(s)
8181
thread.Pin(sData)
82+
8283
return (*C.char)(unsafe.Pointer(sData))
8384
}
8485

testdata/test-env.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,4 +47,6 @@
4747
} else {
4848
echo "Failed to unset NON_EXISTING_VAR.\n";
4949
}
50+
51+
getenv();
5052
};

0 commit comments

Comments
 (0)