Commit ae973f6
committed
fix: apply Options service fallback when event service is unset
Client::prepareEvent used `$event->getService() ?: $options->getService()`,
but Event::__construct defaults `$service` to the string `'unknown'`, which
is truthy — so the Elvis operator never fell through to the option. Calls
like `LogtideSdk::init(['service' => 'my-php-app'])` followed by
`captureLog(...)` therefore always shipped `service: "unknown"`.
The fallback now triggers when the event service is `''` or `'unknown'`.
Updated `testCaptureEventFallsToOptionsServiceWhenUnknown`, which had been
written to assert the broken behavior.
Closes logtide-dev/logtide-php#7.1 parent 0bfa7c6 commit ae973f6
File tree
3 files changed
+11
-9
lines changed- packages/logtide
- src
- tests/Unit
3 files changed
+11
-9
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
8 | 14 | | |
9 | 15 | | |
10 | 16 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
124 | 124 | | |
125 | 125 | | |
126 | 126 | | |
127 | | - | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
128 | 131 | | |
129 | 132 | | |
130 | 133 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
74 | 74 | | |
75 | 75 | | |
76 | 76 | | |
77 | | - | |
78 | | - | |
79 | 77 | | |
80 | 78 | | |
81 | 79 | | |
| |||
99 | 97 | | |
100 | 98 | | |
101 | 99 | | |
102 | | - | |
103 | | - | |
104 | | - | |
105 | 100 | | |
106 | 101 | | |
107 | | - | |
108 | | - | |
109 | | - | |
| 102 | + | |
110 | 103 | | |
111 | 104 | | |
112 | 105 | | |
| |||
0 commit comments