Pin a string that is not null-terminated PHP's zend_string may contain null-bytes
(s string)
| 191 | // Pin a string that is not null-terminated |
| 192 | // PHP's zend_string may contain null-bytes |
| 193 | func (thread *phpThread) pinString(s string) *C.char { |
| 194 | sData := unsafe.StringData(s) |
| 195 | if sData == nil { |
| 196 | return nil |
| 197 | } |
| 198 | |
| 199 | thread.Pin(sData) |
| 200 | |
| 201 | return (*C.char)(unsafe.Pointer(sData)) |
| 202 | } |
| 203 | |
| 204 | // C strings must be null-terminated |
| 205 | func (thread *phpThread) pinCString(s string) *C.char { |