-
-
Notifications
You must be signed in to change notification settings - Fork 9.8k
Closed
Closed
Copy link
Description
Symfony version(s) affected
7.3.4,main
Description
In
| if ($this->data) { |
if ($this->data) this will be false for '' and for '0'. That results in an empty event if you try to sent '0'.
Possible fix would be:
if (is_iterable($this->data)) {
foreach ($this->data as $data) {
yield \sprintf('data: %s', $data)."\n";
}
} elseif ($this->data !== null || $this->data !== '') {
yield \sprintf('data: %s', $this->data)."\n";
}
A possible workaround is to wrap the '0' in an array.
How to reproduce
$event = new ServerEvent('0');
foreach ($event as $line) {
echo $line;
}
This should produce data: 0 but produces nothing
Possible Solution
No response
Additional Context
No response