Skip to content
This repository was archived by the owner on Oct 1, 2023. It is now read-only.

v4.52.0: IO\ and OS\ progress

Compare
Choose a tag to compare
@fredemmott fredemmott released this 05 May 19:38

This release contains many improvements to IO\ and OS\, some of which are backwards-incompatible changes.

  • Added OS\Errno enum
  • Removed OS\ErrorCode enum
  • renamed OS\Exception to OS\ErrnoException
  • removed OS\ErrnoException::getErrorCode() - use OS\ErrnoException::getErrno() instead
  • added OS\FileDescriptor class, OS\close(), OS\fcntl(), OS\flock(), OS\lseek(), OS\open(), OS\pipe(), OS\read(), and OS\write() functions to support several operations without PHP resources; these functions throw OS\ErrnoException on failure.
  • renamed IO\ReadHandle::rawReadBlocking() to read() and IO\WriteHandle::rawWriteBlocking() to write()
  • IO\ReadHandle::readAsync() will now return after one successful read(), waiting if necessary, instead of reading until end of file
  • IO\WriteHandle::writeAsync() will now return after one successful write(), waiting if necessary, instead of waiting until all data is written; this means it may now partially succeed
  • IO\ReadHandle::readAsync() and IO\WriteHandle::writeAsync() now take ?int $timeout_ns = null, instead of ?int $timeout_seconds = null
  • An exception is now raised if 0 is specified as the timeout; provide a positive integer, or null for no timeout.
  • removed IO\ReadHandle::readLineAsync(); it is likely to be reintroduced in a separate abstraction providing buffered reads in the future
  • IO\pipe() and File\ are now implemented with OS\FileDescriptor's instead of PHP resources; they should now reliably through correct OS\ErrnoExceptions, rather than only in standalone CLI mode