Page MenuHomePhabricator

D21541.id51275.diff
No OneTemporary

D21541.id51275.diff

diff --git a/src/xsprintf/xsprintf.php b/src/xsprintf/xsprintf.php
--- a/src/xsprintf/xsprintf.php
+++ b/src/xsprintf/xsprintf.php
@@ -67,6 +67,18 @@
}
if ($callback !== null) {
+
+ // See T13588 and D21500. This function uses "$callback()", instead
+ // of "call_user_func()", to simplify reference behavior: some of
+ // these arguments must be passed by reference.
+
+ // Prior to PHP7, this syntax will not work if "$callback" is a
+ // string referencing a static method, like "C::m".
+
+ // This syntax does work if "$callback" is an array referencing
+ // a static method, like "array('C', 'm')", in all versions of PHP
+ // since PHP 5.4.
+
$callback($userdata, $pattern, $pos, $argv[$arg], $len);
}
}

File Metadata

Mime Type
text/plain
Expires
Sun, Mar 23, 10:28 PM (1 d, 11 h ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7657684
Default Alt Text
D21541.id51275.diff (830 B)

Event Timeline