This might actually be a bug with PHP, but Phalanger acts differently from PHP that can cause problems.
When an optional matching group doesn't match in a preg_match_all() call with PREG_OFFSET_CAPTURE, PHP returns "" (an empty string) for that group, whereas Phalanger returns array("",0).
@mgduk Phalanger's development is mostly discontinued in favor of PeachPie, the more modern compiler and runtime that also targets .NET Core. Please feel free to give that a try.
This might actually be a bug with PHP, but Phalanger acts differently from PHP that can cause problems.
When an optional matching group doesn't match in a preg_match_all() call with PREG_OFFSET_CAPTURE, PHP returns "" (an empty string) for that group, whereas Phalanger returns array("",0).
Reproduction code:
PHP returns:
Phalanger:
Phalanger 3.0 PHP 5.0.4 – 5.5.18.