Why does this PHP preg_match offset break position check?

Why does this PHP preg_match offset break position check. The PHP code uses preg_match with offset on a substring but returns position relative to offset. In PHP parsing this returns wrong index.

#whatswrongwiththisphpcode #phpbug #phpproductionbug #phpdebugging #phpbackend #phpcodereview #phpsecurity #phpperformance #phpreliability #phpapi #phpwebdevelopment #phpengineering #phppregmatch ...

https://www.youtube.com/watch?v=xZJfEgyMZ2U

Why does this PHP preg_match offset break position check? #phpparsing

YouTube