Code Monkey home page Code Monkey logo

event's People

Contributors

ahackschmitz avatar cedric-anne avatar davidprevot avatar deepdiver1975 avatar dependabot[bot] avatar dominikto avatar evert avatar felixfbecker avatar hywan avatar phil-davis avatar sammousa avatar staabm avatar sunverwerth avatar tysonandre avatar vinkla avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

event's Issues

Possible issue with then() being called when triggering $promise->reject();

Hi there!,

I was looking trough your promise implementation and was building my own class form it. I have a call back on then() that echo's hello world and when i run $promise->reject(new Exception('...')); on the promise instance also then() it triggered first.

This might lead to potential bugs right? This might be the case if you change any state of your app in a then() function.

https://github.com/fruux/sabre-event/blob/master/lib/Promise.php#L263

error in coroutine.php

I have just downloaded sabre/event 5.0.2 through composer, but now everytime i try to use it, i get the following 2 errors:

Warning: Unsupported declare 'strict_types' in vendor/sabre/event/lib/coroutine.php on line 1

Parse error: syntax error, unexpected ':', expecting '{' in vendor/sabre/event/lib/coroutine.php on line 48

Any idea, how to fix this?

stream_select() can emit a notice if pcntl_signal handler is set up by a caller

Observed: Sabre emits a notice.
Desired: Prevent that notice, or add a configurable way for applications using sabre\event to suppress that notice

Context: This was seen in an application calling pcntl_signal() to listen for signals, then calling pcntl_fork() to create child processes (it would get signalled from within the sabre event loop)

reactphp/reactphp#296 mentions a similar issue.
See the note in https://secure.php.net/manual/en/function.stream-select.php#refsect1-function.stream-select-returnvalues

This happens in 5.0.3, probably also in master: https://github.com/sabre-io/event/blob/5.0.3/lib/Loop/Loop.php#L305

The approach taken by reactphp looks like it was to call set_error_handler before the stream operation (e.g. stream_select()), and call restore_error_handler immediately after (and check if the error was caused by pcntl in that handler)

/path/to/vendor/sabre/event/lib/Loop/Loop.php:305 [2] stream_select(): unable to select [4]: Interrupted system call (max_fd=0)

#0  my_custom_error_handler()
#1  stream_select() called at [/path/to/vendor/sabre/event/lib/Loop/Loop.php:305]
#2  Sabre\Event\Loop\Loop->runStreams() called at [/path/to/vendor/sabre/event/lib/Loop/Loop.php:233]
#3  Sabre\Event\Loop\Loop->tick() called at [/path/to/vendor/sabre/event/lib/Loop/Loop.php:194]
#4  Sabre\Event\Loop\Loop->run() called at [/path/to/vendor/sabre/event/lib/Loop/functions.php:122]
#5  Sabre\Event\Loop\run() called at ...

I can work around this by changing my_custom_error_handler

sabre/event 4.0 release

  • PHP 7 support.
  • PHP 7 typehints everywhere. (be strict everywhere too)
  • Remove phpdoc typehints, but only in places where the exact typehint can be inferred from the php7 type hint.
  • Remove deprecated functions.
  • Add wildcard support to event emmitter
  • Force all promise rejections to be of the type Exception.

change project url

atm this repositories project url points to http://sabre.io but http://sabre.io/event/ would be more appropriate?

Typo in the documentation

Hello :-),

In the Section "The innovation: chaining”, there is a typo in the code. The example is:

$multiHttp = new MultiHttp();

$multiHttp->addRequest('DELETE', '/blogpost2.txt', '...')
    ->then(
        function($value) {
            // The DELETE request was successful!
            return $multiHttp->addRequest('PUT', '/blogpost2.txt', '...');
        }
    )
…

However, the $multiHttp variable inside the first anonymous function is not syntactically closed (out of the scope). The example might be the following:

        function($value) use ($multiHttp) {
            // The DELETE request was successful!
            return $multiHttp->addRequest('PUT', '/blogpost2.txt', '...');
        }

Thoughts?

Php 5.6 requirement

Hi, this library should requite php 5.5, but In one of the examples a function is imported using "use function" that is only supported from php 5.6 onwards.
This is a minor problem since it only targets one of the examples scripts, and i only noticed it when running a php5.5-based ioncube version on the code.

php 5.3 compatible EventEmitter

just created a stripped down version of the EventEmitter which is PHP 5.3 compatible and shares the same public API.

This was required for a project which runs on a lot of systems, so we are bound to php 5.3 for the next 6 months or so until all are finally upgraded. Until then I use this EventEmitter as a drop-in replacement.

Maybe its helpfull for some others for the time beeing.

https://gist.github.com/staabm/4102ab7f30d337b3b311

What if I refuse using Composer ?

Have gone through this library and want to give it a try BUT I have always avoided using Composer mainly because I love to know what's being loaded and what extra dependence gets installed.

not using Composer means I never get lazy.

Going through https://github.com/sabre-io/event/blob/master/composer.json , I see the only dependency is PHP . I know that means I could do manual installation BUT I just want to ask to be super extra sure.

Asking also because I'm actually more interested in your HTTP library which requires this library as dependency so I checked this out so I could install both manually

Coroutines should resolve with the generator return value

PHP 7 has Generator::getReturn() to get the return value of a generator. That means code like this is possible:

coroutine(function () {
  $x = yield someAsync();
  if ($x->whatever) {
    return 'thisvalue';
  }
  $y = yield someOtherAsync();
  if ($y->whatever) {
    return 'thatvalue';
  }
  return yield $y->whatelse();

But currently coroutines will always use the last yield value, which makes control flow like above weird.

Publishing a 5.x release?

5.1.0...master doesn't seem to have any breaking changes to the source code that would affect applications using this library - just changes to documentation, supported versions, tools for local developement, and supported php versions.

  • PHP 8.0 is supported in composer.json, making sabre/event installable without --ignore-platform-reqs. PHP 8.0.0 stable will be released on November 26 (https://wiki.php.net/todo/php80) and this will make it easier for users to install applications using sabre/event with 8.0 betas/RCs
  • The README was updated

Don't throw an error when resolve() is called twice

That is also how Promises/A+ spec behaves. It is very useful to register the fulfill function as an event handler for example and get the promise resolved as soon as it is called, no matter if it will be called more times afterwards.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.