Changeset View
Changeset View
Standalone View
Standalone View
src/xsprintf/xsprintf.php
| Show First 20 Lines • Show All 61 Lines • ▼ Show 20 Lines | if ($conv) { | ||||
| if ($arg >= $argc) { | if ($arg >= $argc) { | ||||
| throw new BadFunctionCallException( | throw new BadFunctionCallException( | ||||
| pht( | pht( | ||||
| 'Too few arguments to %s.', | 'Too few arguments to %s.', | ||||
| 'xsprintf()')); | 'xsprintf()')); | ||||
| } | } | ||||
| if ($callback !== null) { | 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); | $callback($userdata, $pattern, $pos, $argv[$arg], $len); | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| if ($c === '%') { | if ($c === '%') { | ||||
| // If we have "%%", this encodes a literal percentage symbol, so we are | // If we have "%%", this encodes a literal percentage symbol, so we are | ||||
| // no longer inside a conversion. | // no longer inside a conversion. | ||||
| ▲ Show 20 Lines • Show All 50 Lines • Show Last 20 Lines | |||||