EventManager or Stdlib\CallbackHandler can't handle WeakRef enough. #3882

Closed
wants to merge 1 commit into
from

Conversation

Projects
None yet
2 participants
Contributor

weierophinney commented Apr 4, 2013

In develop branch,
I got this error.

$ php -d extension=weakref.so /usr/bin/phpunit ZendTest/EventManager
PHPUnit 3.7.14 by Sebastian Bergmann.

Configuration read from /home/sasezaki/zf2/tests/phpunit.xml.dist

.....................................E........................... 65 / 86 ( 75%)
.....................

Time: 0 seconds, Memory: 3.25Mb

There was 1 error:

1) ZendTest\EventManager\EventManagerTest::testWeakRefsAreHonoredWhenTriggering
call_user_func() expects parameter 1 to be a valid callback, no array or string given

/home/sasezaki/zf2/library/Zend/EventManager/EventManager.php:460
/home/sasezaki/zf2/library/Zend/EventManager/EventManager.php:204
/home/sasezaki/zf2/tests/ZendTest/EventManager/EventManagerTest.php:560

FAILURES!
Tests: 86, Assertions: 224, Errors: 1.

I did run under environment.

$ php -v
PHP 5.4.11-1~precise+1 (cli) (built: Jan 24 2013 15:22:16) 
Copyright (c) 1997-2013 The PHP Group
Zend Engine v2.4.0, Copyright (c) 1998-2013 Zend Technologies
    with Xdebug v2.2.1, Copyright (c) 2002-2012, by Derick Rethans

(When turn off xdebug or -d apc.enabled=0, I got same error).

This WeakRef issue occurs ZendSkeletonApplication can't run.

Amazium referenced this pull request Apr 3, 2013

Closed

weakref callback issue #4173

Contributor

sasezaki commented Apr 3, 2013

I retried with Weakref-0.0.1 & Weakref-0.1.0, but got same error.

Contributor

sasezaki commented Apr 3, 2013

ouch! when "git checkout release-2.0.0beta2", above test wil be pass, when "git checkout release-2.0.0beta3" test will fails.

Owner

weierophinney commented Apr 3, 2013

That helps identify what change introduced the issue! Thanks, @sasezaki !

@weierophinney weierophinney [#3882] Fix issue with expired WeakRef callbacks
- Added code that validates that we have a callback from the listener
  prior to executing it. If not, we unregister the listener. This
  reinstates the original behavior from the tests (which were failing
  when WeakRef was present).
91613c5
Owner

weierophinney commented Apr 4, 2013

When merged, fix also addresses #4173

Contributor

sasezaki commented Apr 4, 2013

@weierophinney Great!thanks!

mwillbanks closed this in 03cb499 Apr 4, 2013

@mwillbanks mwillbanks added a commit that referenced this pull request Apr 4, 2013

@mwillbanks mwillbanks Merge branch 'hotfix/3882' into develop
Forward port #3882
e2e9a75

@weierophinney weierophinney added a commit to zendframework/zend-eventmanager that referenced this pull request May 15, 2015

@weierophinney weierophinney [zendframework/zendframework#3882] Fix issue with expired WeakRef cal…
…lbacks

- Added code that validates that we have a callback from the listener
  prior to executing it. If not, we unregister the listener. This
  reinstates the original behavior from the tests (which were failing
  when WeakRef was present).
dbb6c0b

@gianarb gianarb pushed a commit to zendframework/zend-eventmanager that referenced this pull request May 15, 2015

@mwillbanks mwillbanks Merge branch 'hotfix/3882' of git://github.com/weierophinney/zf2 into… 6d779b2

@gianarb gianarb pushed a commit to zendframework/zend-eventmanager that referenced this pull request May 15, 2015

@mwillbanks mwillbanks Merge branch 'hotfix/3882' into develop 0c36811
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment