File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -652,12 +652,11 @@ func go_read_cookies(threadIndex C.uintptr_t) *C.char {
652652//export go_log
653653func go_log (threadIndex C.uintptr_t , message * C.char , level C.int ) {
654654 ctx := phpThreads [threadIndex ].context ()
655+
655656 m := C .GoString (message )
657+ le := syslogLevelInfo
656658
657- var le syslogLevel
658- if level < C .int (syslogLevelEmerg ) || level > C .int (syslogLevelDebug ) {
659- le = syslogLevelInfo
660- } else {
659+ if level >= C .int (syslogLevelEmerg ) && level <= C .int (syslogLevelDebug ) {
661660 le = syslogLevel (level )
662661 }
663662
Original file line number Diff line number Diff line change @@ -82,10 +82,12 @@ func (thread *phpThread) shutdown() {
8282func (thread * phpThread ) setHandler (handler threadHandler ) {
8383 thread .handlerMu .Lock ()
8484 defer thread .handlerMu .Unlock ()
85+
8586 if ! thread .state .requestSafeStateChange (stateTransitionRequested ) {
8687 // no state change allowed == shutdown or done
8788 return
8889 }
90+
8991 close (thread .drainChan )
9092 thread .state .waitFor (stateTransitionInProgress )
9193 thread .handler = handler
@@ -108,6 +110,11 @@ func (thread *phpThread) frankenPHPContext() *frankenPHPContext {
108110}
109111
110112func (thread * phpThread ) context () context.Context {
113+ if thread .handler == nil {
114+ // handler can be nil when using opcache.preload
115+ return globalCtx
116+ }
117+
111118 return thread .handler .context ()
112119}
113120
Original file line number Diff line number Diff line change @@ -48,7 +48,7 @@ func (handler *inactiveThread) frankenPHPContext() *frankenPHPContext {
4848}
4949
5050func (handler * inactiveThread ) context () context.Context {
51- return nil
51+ return globalCtx
5252}
5353
5454func (handler * inactiveThread ) name () string {
You can’t perform that action at this time.
0 commit comments