|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2014-11-29 13:52 UTC] jpauli@php.net
[2014-11-29 13:52 UTC] jpauli@php.net
-Status: Open
+Status: Closed
[2014-11-29 13:52 UTC] jpauli@php.net
[2014-11-29 13:53 UTC] jpauli@php.net
[2014-11-29 13:53 UTC] jpauli@php.net
-Status: Closed
+Status: Feedback
[2014-11-29 13:53 UTC] jpauli@php.net
[2014-12-05 07:00 UTC] ab@php.net
[2014-12-05 07:00 UTC] ab@php.net
-Status: Feedback
+Status: Closed
[2014-12-06 12:57 UTC] mplomer at gmx dot de
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Tue Oct 28 13:00:01 2025 UTC |
Description: ------------ When overwriting an old signal handler (that references "$this" for example) with SIG_DFL, the reference counter on $this is not decreased, so when unsetting the object, it cannot be freed. My current workaround: When overwriting the signal handler with an empty function before ("function() {}"), the ref-count is correctly decreased (WTF?!), and the instance is immediately freed, when unsetting the object. Test script: --------------- class Test { public function __construct() { pcntl_signal(SIGUSR1, array($this, 'signalHandler'), false); //pcntl_signal(SIGUSR1, function() {}); // destruct works correctly when commenting in pcntl_signal(SIGUSR1, SIG_DFL); } public function signalHandler() { } public function __destruct() { echo '__destruct' . PHP_EOL; } } $test = new Test(); echo 'unsetting' . PHP_EOL; unset($test); echo 'end' . PHP_EOL; Expected result: ---------------- unsetting __destruct end Actual result: -------------- unsetting end __destruct