Skip to content

Commit 9ca1cf6

Browse files
committed
Optimize reading from util.Bytes, iterables and strings in Blob class
1 parent a4c519e commit 9ca1cf6

2 files changed

Lines changed: 7 additions & 3 deletions

File tree

ChangeLog.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ XP Framework Core ChangeLog
33

44
## ?.?.? / ????-??-??
55

6+
## 12.10.0 / 2026-04-23
7+
68
### Bugfixes
79

810
* Fixed `io.streams.StreamTransfer::transferAll()` not correctly returning
@@ -11,6 +13,8 @@ XP Framework Core ChangeLog
1113

1214
### Features
1315

16+
* Optimized reading from util.Bytes, iterables and strings in `io.Blob` class
17+
(@thekid)
1418
* Merged PR #362: Add a seekable input stream which spools to a temporary
1519
file: `io.streams.SpooledInputStream`
1620
(@thekid)

src/main/php/io/Blob.class.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,13 +31,13 @@ public function __construct($parts= [], array $meta= []) {
3131
})();
3232
};
3333
} else if ($parts instanceof Bytes || is_string($parts)) {
34-
$this->iterator= fn() => (function() { yield (string)$this->parts; })();
34+
$this->iterator= function() { yield (string)$this->parts; };
3535
} else if (is_iterable($parts)) {
36-
$this->iterator= fn() => (function() {
36+
$this->iterator= function() {
3737
foreach ($this->parts as $part) {
3838
yield (string)$part;
3939
}
40-
})();
40+
};
4141
} else {
4242
throw new IllegalArgumentException(sprintf(
4343
'Expected iterable|string|util.Bytes|io.streams.InputStream, have %s',

0 commit comments

Comments
 (0)