Skip to content

Commit 0c49e19

Browse files
committed
[Bug] Fixed fatal error on PHP5.3 using timer
PHP5.3 does not support calling $this within a closure
1 parent 4e4bd2c commit 0c49e19

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

LibEventLoop.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,9 @@ protected function addTimerInternal($interval, $callback, $periodic = false)
172172

173173
$timer->signature = spl_object_hash($timer);
174174
$timersGc = $this->timersGc;
175-
$callback = function () use ($timer, $timersGc) {
175+
176+
$self = $this;
177+
$callback = function () use ($timer, $timersGc, $self) {
176178
foreach ($timersGc as $resource) {
177179
event_free($resource);
178180
}
@@ -183,7 +185,7 @@ protected function addTimerInternal($interval, $callback, $periodic = false)
183185
if ($timer->periodic === true) {
184186
event_add($timer->resource, $timer->interval);
185187
} else {
186-
$this->cancelTimer($timer->signature);
188+
$self->cancelTimer($timer->signature);
187189
}
188190
}
189191
};

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy