Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Paste
P26
test-logs-multilistener.php
Active
Public
Actions
Authored by
avivey
on Nov 24 2023, 17:09.
Edit Paste
Archive Paste
View Raw File
Subscribe
Mute Notifications
Award Token
Flag For Later
Advanced/Developer...
View Handle
View Hovercard
Tags
None
Referenced Files
F406284: Command-Line Input
Nov 24 2023, 17:09
2023-11-24 17:09:16 (UTC+0)
Subscribers
None
#!/usr/bin/env php
<?php
require_once
'scripts/__init_script__.php'
;
function
handler1
(
$event
,
$value
,
array
$metadata
)
{
echo
pht
(
'Handler 1 - event is `%s`'
.
"\n"
,
$event
)
;
}
function
handler2
(
$event
,
$value
,
array
$metadata
)
{
echo
pht
(
'Handler 2 - event is `%s`'
.
"\n"
,
$event
)
;
}
echo
"First error - no handler registered:\n"
;
strlen
(
null
)
;
echo
"\n"
;
PhutilErrorHandler
::
setErrorListener
(
"handler1"
)
;
echo
"Registered one handler, error again:\n"
;
strlen
(
null
)
;
echo
"\n"
;
PhutilErrorHandler
::
setErrorListener
(
"handler2"
)
;
echo
"Registered 2 handlers, error again:\n"
;
strlen
(
null
)
;
echo
"\n"
;
Event Timeline
avivey
created this paste.
Nov 24 2023, 17:09
2023-11-24 17:09:16 (UTC+0)
avivey
changed the title of this paste from
Command-Line Input
to
test-logs-multilistener.php
.
Nov 24 2023, 17:09
2023-11-24 17:09:34 (UTC+0)
avivey
updated the paste's language from
autodetect
to
php
.
avivey
mentioned this in
D25388: PhutilErrorHandler: support multiple error listeners
.
avivey
mentioned this in
rARC25611ba24add: PhutilErrorHandler: support multiple error listeners
.
Nov 27 2023, 18:32
2023-11-27 18:32:18 (UTC+0)
Log In to Comment