Skip to content

Releases: reactphp/promise

v2.6.0

11 Jun 12:57
Compare
Choose a tag to compare
  • Feature: Significantly improve memory consumption and performance by only passing resolver args
    to resolver and canceller if callback requires them. Also use static callbacks without
    binding to promise, clean up canceller function reference when they are no longer
    needed and hide resolver and canceller references from call stack on PHP 7+.
    (#113, #115, #116, #117, #118, #119 and #123 by @clue)

    These changes combined mean that rejecting promises with an Exception should
    no longer cause any internal circular references which could cause some unexpected
    memory growth in previous versions. By explicitly avoiding and explicitly
    cleaning up said references, we can avoid relying on PHP's circular garbage collector
    to kick in which significantly improves performance when rejecting many promises.

  • Mark legacy progress support / notification API as deprecated
    (#112 by @clue)

  • Recommend rejecting promises by throwing an exception
    (#114 by @jsor)

  • Improve documentation to properly instantiate LazyPromise
    (#121 by @holtkamp)

  • Follower cancellation propagation was originally planned for this release
    but has been reverted for now and is planned for a future release.
    (#99 by @jsor and #122 by @clue)

v2.5.1

25 Mar 12:15
v2.5.1
62785ae
Compare
Choose a tag to compare
  • Fix circular references when resolving with a promise which follows itself (#94).

v2.5.0

22 Dec 14:11
v2.5.0
2760f38
Compare
Choose a tag to compare
  • Revert automatic cancellation of pending collection promises once the output promise resolves. This was introduced in 42d86b7 (PR #36, released in v2.3.0) and was both unintended and backward incompatible.

    If you need automatic cancellation, you can use something like:

    function allAndCancel(array $promises)
    {
         return \React\Promise\all($promises)
             ->always(function() use ($promises) {
                 foreach ($promises as $promise) {
                     if ($promise instanceof \React\Promise\CancellablePromiseInterface) {
                         $promise->cancel();
                     }
                 }
            });
    }
  • all() and map() functions now preserve the order of the array (#77).

  • Fix circular references when resolving a promise with itself (#71).

v2.4.1

03 May 17:53
v2.4.1
8025426
Compare
Choose a tag to compare
  • Fix some() not cancelling pending promises when too much input promises reject (16ff799).

2.4.0

31 Mar 13:14
v2.4.0
Compare
Choose a tag to compare
  • Support foreign thenables in resolve().
    Any object that provides a then() method is now assimilated to a trusted promise that follows the state of this thenable (#52).
  • Fix some() and any() for input arrays containing not enough items (#34).

2.3.0

31 Mar 13:29
v2.3.0
Compare
Choose a tag to compare
  • Allow cancellation of promises returned by functions working on promise collections (#36).
  • Handle \Throwable in the same way as \Exception (#51 by @joshdifabio).

1.2.1

07 Mar 13:48
v1.2.1
Compare
Choose a tag to compare
  • Fix DeferredPromise to also implement the CancellablePromiseInterface.

1.2.0

27 Feb 19:23
v1.2.0
Compare
Choose a tag to compare

This release makes the API more compatible with 2.0 while preserving full backward compatibility.

  • Introduce new CancellablePromiseInterface implemented by all promises.
  • Add new .cancel() method (part of the CancellablePromiseInterface).

2.2.2

26 Feb 19:11
v2.2.2
Compare
Choose a tag to compare
  • Fix cancellation handlers called multiple times (#47 by @clue).

2.2.1

03 Jul 13:50
v2.2.1
Compare
Choose a tag to compare
  • Fix stack error when resolving a promise in its own fulfillment or rejection handlers.