This release adds an immutable date/time class, makes file writes safer, background processes possible, and Finder masks smarter. Plus a couple of bug fixes worth picking up.
β¨ New Features
- DateTimeImmutable β a new immutable counterpart to
Nette\Utils\DateTime. It extends PHP's\DateTimeImmutablewith strict validation (invalid dates and times throw instead of being silently rolled over), convenient factoriesfrom()andfromParts(), DST-safe relative modifications, and JSON serialization. - FileSystem::writeAtomic() β writes a file atomically via a temporary file and rename, so a concurrent reader never sees it partially written or truncated. Ideal for caches and generated configs.
- Process::detach() β lets a process keep running in the background after the
Processobject is destroyed, instead of being killed by the destructor. Output must go to a file or be discarded, since nobody reads the pipes after detaching. - Process β on Windows with PHP 8.5, captured output now flows through real pipes instead of temporary files, thanks to the fixed
stream_select(). - Html::fragment() and add() β create a nameless element pre-filled with children, or append children to an existing element. Unlike
addHtml(), plain strings are escaped by default and nulls are skipped. - Html::text() and Html::html() β new static factories replacing
fromText()andfromHtml(), which are now deprecated. - Finder β the mask now fully drives recursion:
**/footogether within()searches recursively, and the**short form expands like in zsh, sotest/**meanstest/**/*and**.cmeans**/*.c(previously such masks silently degraded to a single*). - Finder β a trailing slash in a
find()mask matches directories only:find('temp/'). - Finder::exclude() β now uses the same mask grammar as
find():**.txtworks,./anchors to the search root, and a trailing/,/*or/**controls whether the directory itself, its contents, or both are excluded. - Finder β paths are no longer normalized to forward slashes; they stay in their native form, which also fixes corruption of backslashes in POSIX file names. Note: on Windows, returned paths may now contain backslashes where they used to be unified.
π Bug Fixes
- ArrayList::prepend() β no longer misbehaves on an empty list.
- Validators::isUrl() β now rejects malformed IPv4 addresses with octets above 255, so nonsense like
http://999.1.1.1no longer passes as a valid URL. - Strings::compare() β tolerates invalid UTF-8 instead of failing when the Normalizer gives up.
- Strings::length() β the fallback used when neither
mbstringnoriconvis available no longer relies on the deprecatedutf8_decode(), so it stays quiet on PHP 8.2+. - Finder::exclude() β
exclude('subdir/')silently excluded nothing due to a greedy regex; the trailing/,/*and/**variants now work as documented.